rednotebook
rednotebook copied to clipboard
Tray Icon behaving unexpectedly
Describe the bug
I noticed that the Tray Icon behaves unexpectedly in three scenarios:
- If I click on the Tray Icon by mistake, the default method to close the menu is to click elsewhere on the screen. But, here clicking elsewhere still keeps the menu open. Even if I click in another app. The only way to close this is to either click on any of the options, or to click inside the RedNotebook application.
- If I click on the Tray Icon from any other screen (or, workspace? -- For a mac, maximizing any app automatically moves it to a new workspace), it doesn't show me the menu there. Instead, the options are displayed on the main screen/workspace. Please check the video I attached for more details.
- After opening the Tray Icon, if I click on "Show RedNotebook", it moves the window to top left corner.
To Reproduce I've added all the steps in the above points, and in the video.
Screenshots
https://user-images.githubusercontent.com/15556382/104815681-f7e18980-583b-11eb-8f68-bbc49fe62529.mov
Versions: I'm running rednotebook directly from master on macOS Big Sur 11.0.1.
Log output when reproducing bug
Adding /Users/rahuljha/rj/rednotebook to sys.path
2021-01-16 19:45:43,871 INFO Writing log to file "/Users/rahuljha/.rednotebook/rednotebook.log"
2021-01-16 19:45:43,871 INFO System encoding: utf-8
2021-01-16 19:45:43,871 INFO Language code: en_US
/Users/rahuljha/rj/rednotebook/rednotebook/journal.py:162: PyGIDeprecationWarning: Since version 3.11, calling threads_init is no longer needed. See: https://wiki.gnome.org/PyGObject/Threading
GObject.threads_init()
2021-01-16 19:45:43,936 INFO WebKit2Gtk 4.0 (gir1.2-webkit2-4.0) not found. Please install it if you want in-app previews. Error message: "Namespace WebKit2 not available"
2021-01-16 19:45:43,949 WARNING For spell checking, please install enchant (python3-enchant).
2021-01-16 19:45:44,036 INFO Using pyyaml for loading and dumping
2021-01-16 19:45:44,040 INFO Running in portable mode: False
2021-01-16 19:45:44,040 INFO First Start: False
2021-01-16 19:45:44,040 INFO RedNotebook version: 2.21
2021-01-16 19:45:44,058 INFO System info: machine: x86_64, platform: macOS-11.0.1-x86_64-i386-64bit, processor: i386, python_version: 3.9.1, release: 20.1.0, system: Darwin, GTK: (3, 24, 24), Glib: (2, 66, 2), PyGObject: (3, 38, 0), YAML: 5.3.1
2021-01-16 19:45:44,865 DEBUG Default font: .AppleSystemUIFont 12
2021-01-16 19:45:44,865 DEBUG Default size: 12.0
2021-01-16 19:45:45,047 DEBUG Tray icon visible: False
2021-01-16 19:45:45,058 INFO Opening journal at '/Users/rahuljha/.rednotebook/data'
2021-01-16 19:45:45,058 DEBUG Starting to load files in dir "/Users/rahuljha/.rednotebook/data"
2021-01-16 19:45:45,059 DEBUG Loading file "/Users/rahuljha/.rednotebook/data/2021-01.txt"
2021-01-16 19:45:45,062 DEBUG Finished loading files in dir "/Users/rahuljha/.rednotebook/data"
/Users/rahuljha/rj/rednotebook/rednotebook/journal.py:225: PyGIDeprecationWarning: GObject.idle_add is deprecated; use GLib.idle_add instead
GObject.idle_add(self.archiver.check_last_backup_date)
/Users/rahuljha/rj/rednotebook/rednotebook/journal.py:232: PyGIDeprecationWarning: GObject.timeout_add_seconds is deprecated; use GLib.timeout_add_seconds instead
GObject.timeout_add_seconds(600, self.save_to_disk)
2021-01-16 19:45:45,166 INFO Connected Signals: [<Signals.SIGHUP: 1>, <Signals.SIGINT: 2>, <Signals.SIGQUIT: 3>, <Signals.SIGABRT: 6>, <Signals.SIGTERM: 15>, <Signals.SIGTSTP: 18>]
2021-01-16 19:45:45,166 DEBUG Start took 1.1273601055145264 seconds
2021-01-16 19:45:45,166 DEBUG Trying to enter the gtk main loop
2021-01-16 19:45:45,306 INFO Last backup was made 6 days ago
2021-01-16 19:55:45,248 INFO Wrote file /Users/rahuljha/.rednotebook/data/2021-01.txt
2021-01-16 19:55:45,249 INFO The content has been saved to /Users/rahuljha/.rednotebook/data
2021-01-16 19:55:45,249 INFO The content has been saved to '/Users/rahuljha/.rednotebook/data'
2021-01-16 19:55:45,250 INFO Configuration has been saved to /Users/rahuljha/.rednotebook/configuration.cfg
2021-01-16 20:05:45,206 INFO Wrote file /Users/rahuljha/.rednotebook/data/2021-01.txt
2021-01-16 20:05:45,208 INFO The content has been saved to /Users/rahuljha/.rednotebook/data
2021-01-16 20:05:45,208 INFO The content has been saved to '/Users/rahuljha/.rednotebook/data'
2021-01-16 20:05:45,209 INFO Configuration has been saved to /Users/rahuljha/.rednotebook/configuration.cfg
Hi Rahul, thanks for the report! I agree that it would be nice to fix all three issues. Feel free to investigate if you like.
Since many OSs and distributions deprecate tray icons, I think one option for resolving the issues could be to disable the tray icon completely on macOS. Personally, I'd go with that option and I think the same is already done for Linux.
Some more information:
- I noticed the log:
and verified2021-01-17 22:28:07,460 DEBUG Tray icon visible: False
closeToTray
was indeed set to 0 in the configuration. I'm a bit confused as I was under the impression that setting this to 0 would disable the tray icon. Is this not the case? (Also, I tried changing it to 1, but as far as I can tell, it didn't change anything.) - I was working on the laptop alone when I reported the issues yesterday. I added another monitor today and saw that clicking on the Tray Icon on one screen (which also had RedNotebook open), changes the workspace on the other screen to the default one.
- Yesterday, the window stuck to the top-left corner. But, now it moves it the center of the screen.
Since many OSs and distributions deprecate tray icons, I think one option for resolving the issues could be to disable the tray icon completely on macOS.
Given that these bugs are probably in Gtk, and not in RedNotebook, I also think that this should be the way forward. But given pt. 1 above, I'm not sure how easy it would be to do so.
If you'd be kind enough to let me know what needs to be done, I'd be happy to take a look and fix/disable this.
Regarding 1: yes, that sounds like a bug. I briefly looked at the code but couldn't find an obvious mistake. Can you investigate deeper? The tray icon should be visible if and only if closeToTray is 1. And the option to set closeToTray to 1 via the GUI preferences dialog should only show up on Windows.
I'm closing this issue for now, since there hasn't been any recent activity. Feel free to reopen it if the issue persists in the latest RedNotebook version.