From d687bdbef281b38d9331c227852f02b93c92c1e4 Mon Sep 17 00:00:00 2001 From: piotr Date: Mon, 10 Apr 2023 23:04:08 +0200 Subject: [PATCH 1/2] use on-button-release event instead of buggy on-button-press #199 --- nwg_panel/modules/swaync.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nwg_panel/modules/swaync.py b/nwg_panel/modules/swaync.py index fc8d9498..cbb6162b 100644 --- a/nwg_panel/modules/swaync.py +++ b/nwg_panel/modules/swaync.py @@ -55,7 +55,7 @@ def __init__(self, settings, icons_path, panel_position): if settings["on-left-click"] or settings["on-right-click"] or settings["on-middle-click"] or settings[ "on-scroll-up"] or settings["on-scroll-down"]: - self.connect('button-press-event', self.on_button_press) + self.connect('button-release-event', self.on_button_release) self.add_events(Gdk.EventMask.SCROLL_MASK) self.connect('scroll-event', self.on_scroll) @@ -120,7 +120,7 @@ def on_leave_notify_event(self, widget, event): widget.unset_state_flags(Gtk.StateFlags.DROP_ACTIVE) widget.unset_state_flags(Gtk.StateFlags.SELECTED) - def on_button_press(self, widget, event): + def on_button_release(self, widget, event): if event.button == 1 and self.settings["on-left-click"]: self.launch(self.settings["on-left-click"]) elif event.button == 2 and self.settings["on-middle-click"]: From 94f8651359e245743b9a8301fdf17b033d8ab678 Mon Sep 17 00:00:00 2001 From: piotr Date: Mon, 10 Apr 2023 23:08:51 +0200 Subject: [PATCH 2/2] don't check tree if not on sway --- nwg_panel/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nwg_panel/main.py b/nwg_panel/main.py index 255dd1e9..5378e575 100644 --- a/nwg_panel/main.py +++ b/nwg_panel/main.py @@ -804,7 +804,8 @@ def main(): common.outputs = list_outputs(sway=sway, tree=tree, silent=True) common.outputs_num = len(common.outputs) - Gdk.threads_add_timeout(GLib.PRIORITY_DEFAULT_IDLE, 200, check_tree) + if sway: + Gdk.threads_add_timeout(GLib.PRIORITY_DEFAULT_IDLE, 200, check_tree) if tray_available and len(common.tray_list) > 0: sni_system_tray.init_tray(common.tray_list)