From 44ecd930b4aa048ba606d1db2b742000fc7a9752 Mon Sep 17 00:00:00 2001 From: Alex Reed Date: Fri, 25 Sep 2026 15:25:34 -0400 Subject: [PATCH] Fix keyboard shortcuts on Wayland sessions Hypnotix embeds mpv's x11 video window via wid. Under XWayland that window takes key presses before the GTK window, so on_key_press_event never runs and shortcuts (f/F11, F6, F7, Esc, Up/Down, Ctrl+R...) do nothing while a stream is playing. Disable input_vo_keyboard only when XDG_SESSION_TYPE is "wayland". on_key_press_event already forwards unhandled keys to mpv with the "keypress" command, so mpv's default bindings keep working. X11 sessions are unchanged. --- usr/lib/hypnotix/hypnotix.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/usr/lib/hypnotix/hypnotix.py b/usr/lib/hypnotix/hypnotix.py index e4241ce..c465d3a 100755 --- a/usr/lib/hypnotix/hypnotix.py +++ b/usr/lib/hypnotix/hypnotix.py @@ -1640,7 +1640,10 @@ def reinit_mpv(self): **options, script_opts="osc-layout=box,osc-seekbarstyle=bar,osc-deadzonesize=0,osc-minmousemove=3", input_default_bindings=True, - input_vo_keyboard=True, + # Under XWayland the embedded mpv window takes key presses first, + # so on_key_press_event never runs. It already forwards unhandled + # keys to mpv, so mpv's own bindings keep working. + input_vo_keyboard=os.environ.get("XDG_SESSION_TYPE") != "wayland", osc=osc, ytdl=True, wid=str(self.mpv_drawing_area.get_window().get_xid())