Skip to content

Commit

Permalink
ui: let DEs control notifications timeouts
Browse files Browse the repository at this point in the history
There have been some issues (#673) informing that the notifications
timeout were not working on KDE.

On 843412d I wrote that the timeout unit is millisecond, as stated on
the docs here:
https://notify2.readthedocs.io/en/latest/#notify2.Notification.set_timeout

But after some trial and error:
 - set_timeout() units are in seconds, at least for KDE 5.26.3, Xfce
   4.18 and GNOME 43.
 - not specifying the timeout with set_timeout() lets the Desktop
   Environment handle the timeout for us, from their respective
   preferences window.

So at least now there're some DEs where the notifications are closed as
expected.
  • Loading branch information
gustavo-iniguez-goya committed Jun 20, 2023
1 parent f7eec83 commit 6e61958
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions ui/opensnitch/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,6 @@ def show(self, title, body, icon="dialog-information", urgency=URGENCY_NORMAL, c
try:
ntf = self.ntf2.Notification(title, body, icon)

# timeouts seems to be ignored (on Cinnamon at least)
timeout = self._cfg.getInt(Config.DEFAULT_TIMEOUT_KEY, 15)
# -1 and 0 are special values
if timeout > 0:
timeout = timeout * 1000
ntf.set_timeout(timeout * 1000)
ntf.timeout = timeout * 1000

ntf.set_urgency(urgency)
ntf.set_category(self.CATEGORY_NETWORK)
# used to display our app icon and name.
Expand Down

0 comments on commit 6e61958

Please sign in to comment.