Skip to content

Fix keyboard shortcuts on Wayland sessions - #433

Open
xreed88 wants to merge 1 commit into
linuxmint:masterfrom
xreed88:fix/wayland-keyboard-shortcuts
Open

xreed88 wants to merge 1 commit into
linuxmint:masterfrom
xreed88:fix/wayland-keyboard-shortcuts

Conversation

@xreed88

@xreed88 xreed88 commented Sep 25, 2026 •

Copy link
Copy Markdown

Problem

In a Wayland session, Hypnotix's keyboard shortcuts stop working while a stream is playing. That covers f/F11 (fullscreen), F6, F7, Esc, Backspace, ↑/↓ (channel switching) and Ctrl+R/Ctrl+F.

Hypnotix embeds mpv's video window through wid with vo=x11, so under Wayland that window runs through XWayland. With input_vo_keyboard=True, the embedded mpv window takes key presses before the GTK window, so on_key_press_event never runs.

Fix

input_vo_keyboard is now False only when XDG_SESSION_TYPE is wayland:

input_vo_keyboard=os.environ.get("XDG_SESSION_TYPE") != "wayland",
  • X11 sessions (e.g. Cinnamon on Linux Mint) are unchanged. The value is still True there.
  • mpv's own key bindings still work on Wayland. on_key_press_event already forwards every key it doesn't handle to mpv with the keypress command, so keys like space, m and 9/0 keep working through that path.

Testing

  • Wayland (Hyprland on Arch, hypnotix 5.6): with input_vo_keyboard=False, the shortcuts above work during playback. Hyprland puts XDG_SESSION_TYPE=wayland in the environment that launched apps get.
  • X11: not tested. The expression evaluates to True there, which is the current behavior.

🤖 Generated with Claude Code

@mtwebster

Copy link
Copy Markdown
Member

Hi can you get rid of the .pyc file please? That's probably an artifact from you (or maybe an ai agent) executing the code in-tree.

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.
@xreed88
xreed88 force-pushed the fix/wayland-keyboard-shortcuts branch from b2c56ed to 44ecd93 Compare September 26, 2026 00:18
@xreed88

xreed88 commented Sep 26, 2026

Copy link
Copy Markdown
Author

Done, the .pyc is gone. The PR is back to a single commit that only touches usr/lib/hypnotix/hypnotix.py. Thanks for catching it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants