0

I have a simple python3.9 rumps app, roughly following the documented example https://rumps.readthedocs.io/en/latest/examples.html.

main.py:

import rumps


class SiMenuBarApp(rumps.App):
    def __init__(self):
        super(SiMenuBarApp, self).__init__("SiProdHacks")
        self.menu = ["Item1"]

    @rumps.clicked("Item1")
    def item_one(self, _):
        print("Hi Si!")
        rumps.notification("SiProdHacks", "Keeping Si's Brain Free since 2021", "KAPOWIE!")


if __name__ == '__main__':
    app = SiMenuBarApp()
    app.icon = "happyicon.png"
    app.run()

It runs fine, but when I click the menu bar item1, it prints my console message, but no notification occurs.

I am using python 3.9.0, rumps=0.3.0, iTerm and Mac OS 10.15.7 (Catalina).

Console output is:

❯ pipenv run python main.py
Hi Si!
srowland
  • 1,625
  • 1
  • 12
  • 19

2 Answers2

1

Ok, I did some more digging on this, and discovered the debug mode of rumps:

import rumps
rumps.debug_mode(True)

which added the following to the output:

In this case there is no file at "/Users/simonrowland/.local/share/virtualenvs/si-menu-productivity-mlyLc7OG/bin/Info.plist"

Running the following command should fix the issue:
/usr/libexec/PlistBuddy -c 'Add :CFBundleIdentifier string "rumps"' /Users/simonrowland/.local/share/virtualenvs/si-menu-productivity-mlyLc7OG/bin/Info.plist

Running the suggested command:

/usr/libexec/PlistBuddy -c 'Add :CFBundleIdentifier string "rumps"' ${PATH_TO_VENV_BIN_DIR}/bin/Info.plist

Made it work!

enter image description here

srowland
  • 1,625
  • 1
  • 12
  • 19
0

For other's stumbling on this. It may be that you don't have notifications enabled for pylauncher while running your menu bar app in the IDE.

Mustafa
  • 45
  • 6