-
-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--pass-media-keys, --pass-screen-keys and --pass-power-keys options do not work in DEs #136
Comments
Weird. Probably related to #131. e: wait, it works when run over i3 but not when over xfce? |
Yes, I never had any issues in |
Huh, weird. Hopefully I can repro. |
I use OpenBox(with volumeicon) and also tried it on KDE-Plasma(with its own volume control) and on both of them the --pass-media-keys doesn't pass the media keys. Tried AUR i3lock-color-git and it still doesn't work |
Also in bspwm. It was working on i3. |
@AladW Is this still an issue for you? I think I'm getting the same issue as well. |
So I've just tested GNOME, Plasma and XFCE. Seems like these options don't work at all. @PandorasFox Did you make the original pass-media-keys option? How exactly does xcb_send_event(conn, true, screen->root, XCB_EVENT_MASK_BUTTON_PRESS, (char *)event); work? |
iirc what that bit of code does is, if the flag is specified, it just passes back the specified keypress to the root window (essentially the window manager?). I'm not really sure what would need to be different for different DEs to work. |
@PandorasFox Interesting, thanks. |
I am in bspwm, and the keys are bound to sxhkd. Can confirm the same issue. 😭 |
@subnut yeah, unfortunately, I've investigated far and wide, but I have no idea even which window in Plasma/KDE handles these events (for i3 it's simply root window), much less for all DEs. I need serious help on this one. |
I just switched to i3lock-color for the --pass-media-keys as well, and it's not working for me either. Weird thing is, I am in fact using i3 as a WM. I am not at all familiar with X11 / linux kernel Keyboard handling, but I noticed that if i run The reason I am posting this here is that it could maybe be related to the problems mentioned above. I hope I can find time in the next days to investigate this further - if I find out anything usefull, I will post it here |
I finally found some time to look into this some more. The problem seems to be that allthough I am using i3 as a window manager, I was using xbindkeys to handle volume control. I tried switching that over to i3 directly and now it works. So it seems that only i3 itself can receive key presses through the lock screen, and not any other program. This only partially solves the issue for me though, since I would still like to pass the actual key presses for Play/Pause/Next/Previous to chromium. Or to be more general...it would be great if EDIT: If I understand this (https://www.x.org/releases/current/doc/man/man3/xcb_send_event.3.xhtml) documentation correctly, the |
@moritzhoewer those keys already work in wms like i3 and dwm, that use the root window to control these functions. That's why the keys are passed to the root window. However, when using DEs, it's not the root window that parses these keys, and so it doesn't work; you have to send the keys to some window. |
I see - and since i3lock has grabbed the entire keyboard, there is no way to just pass the key press through and let whoever would normally have handled that particular key handle it. That is unfortunate...but I haven't found anything yet that would allow for what I am aiming at here, because that is probably not a use-case the X keyboard system was designed for. |
What if we add a param to pass in a window id to pass event to? Then one can use command like xdotool to grab the window id of whoever manages keybind and pass that in. I don't use a DE though, so not sure how easy it is to get the target window there. |
@Rio6 great suggestion. However, I couldn't find ANY documentation on which KDE (what I use, as an example) window even handles these things. I have a nasty feeling that even if I could find which window I wouldn't be able to use it statically (i.e. window id might change each startx and window might have no name) |
window id is definitely changing, but I'm hoping any of the window class, name, process name might stay the same. This will need some testing on different environments to know if it's actually viable tho. Hopefully something like this can work.
|
If I could make an alternative suggestion, All it needs to function is a syntax for mapping keysyms to commands, like
Thoughts? |
@jclds139 I feel like that would introduce unnecessary security risks (arbitrary command execution isn't really the best idea...) |
I personally don't like to maintain multiple copies of what each key does what :P, although I agree passing things to root window might not be the best solution (that's what this whole issue is about). Running arbitary commands might not be that bad, considering whoevers running the i3lock command can also run whatever commands separately too (unless someone decides to suid i3lock binary...). But I don't think it's safer than sending events to root window anyways. |
My thought was it's slightly safer since the root window could do exactly the same thing, but in this case the i3lock binary controls what commands are run, as opposed to the root window that's out of the locker's control. I can see both sides to the argument, though. |
Hmm you guys have fair points. This is starting to look like the best way to handle it. Reference for KDE volume control: https://askubuntu.com/questions/422078/how-do-i-control-the-volume-in-kde-from-the-command-line |
I have the same problem with qtile. |
Will xdotool work though? Won't it get intercepted by the lockscreen and infinite loop? |
Anything xdotool sends would just get intercepted, I'm pretty sure. The
commands need to get passed by something not X-related.
|
That's what I don't know. In manpage, if no |
Yeah, that would have the same problem we're getting now: we can forward
the key events, but need to know where to send them, and every DE handles
hotkeys differently. That's why I suggested just calling commands so the
user can set it up for their DE.
|
Yeah I think the commands are the way to go. |
I guess I've solved this. When trying on Python, Then, ungrab the keyboard, send the event to root, and grab the keyboard again was the solution. I'm using Awesome WM, and this works to me. |
I tested it on Ubuntu... doesn't work... Seems like the volume and brightness UI breaks it. Edit: Setting focus to i3lock after sending the key solves it. |
This issue is a....
Current Behavior
In XFCE, using
i3lock --pass-media-keys
does not pass the media keys to the desktop environment. This happens regardless if theXF86
keys are bound inxfce4-settings
, or through an external application such asvolumeicon
. I'm unsure why this happens, as--pass-media-keys
works as expected ini3
.Expected Behavior
--pass-media-keys
should pass the media keys to the underlying environment, regardless of the used window manager.Reproduction Instructions
Install XFCE (
pacman -S xfce4
), bindXF86AudioMute
either in keyboard settings or a program likevolumeicon
, try to mute when the screen is locked withi3lock --pass-media-keys
.Environment
Output of
i3lock --version
:Where'd you get i3lock-color from?
The text was updated successfully, but these errors were encountered: