Is it possible to allow a keyboard's volume keys to continue working when your desktop is locked? Currently, the default behavior disables all special-function keys until the desktop's unlocked. I like to use my PC as a music player and leave it locked when I'm not directly at the console, but I still want to let people to control the volume if a song's too loud.
|
|
Somewhat of a shameful plug, but since there didn't seem to be any existing solution, and since the task seemed relatively straight-forward, I wrote a simple Python daemon to fix the problem. It uses the python-xlib API to capture system-wide key presses and then runs custom shell commands. It assumes a basic Debian/Ubuntu setup, but would probably work on most Linux systems with a few tweaks. For my case, the volume up/down keys map to the code 122/123, so the corresponding commands to lower or raise volume only when the desktop is locked are:
Admittedly, that's a bit verbose. The second grep is to find the active sound interface on systems that might have several (e.g. my laptop has a Master and Headphone interface, allowing these commands to control either). |
|||
|
|
|
This problem needs to be solved on a general level. A workaround is no solution. With older Ubuntu versions (from 2010 or so) the volume hotkey still worked at a locked screen. I consider this a bug, especially since other hotkeys still work at a locked screen, like the WiFi key, screen brightness and sleep. For security reasons, I'd rather see the WiFi and sleep hotkeys locked, but not locking hotkeys at all - of course - is most convenient. Best choice is to have an option for this at "System Settings/Brightness & Lock" or in gconf. |
|||
|
|
|
Locking the screen deprives the xserver session of Pulseaudio privileges (among others) unless the user password is provided. Keyboard's volume keys probably work fine (and using them when the screen saver kicks in during the lock probably does wake the sleeping display) but when your graphical logon is locked, it has no power over Pulseaudio. Running sound server as a On the contrary, in case you're willing to risk compromising your system security, it might be simpler to just disable auto-locking. It this isn't acceptable, consider logging in as a guest user when listening to the music. |
|||||||||||
|