0

I am running Ubuntu 24.10 and I have a USB-C keyboard (Specifically a Varmilo VPE108, though I don't think that matters. I have set keyboard customizations in settings to have the keys I have control my media.

enter image description here

Initially, it worked fine. However, after some time and reboots, they have reverted to their initial behavior (opening the calculator, Thunderbird, etc.) Sometimes I can reset and reprogram them properly. Other times the customization menu doesn't seem to ever receive the keyboard input. For example, when I press the key to map the Calculator key to to Volume Down (pressing Calc when promtped "Enter new shortcut to change Volume Down) it opens the Calculator app and the dialog acts as if I have not pressed any keys.

1 Answer 1

0

I just tried this, and had kinda the same problem:
I can set the keybindings, but when I press the key, it opens my calculator instead of whatever I told it to do.

I was able to find that this is caused by a program called gsd-media-keys located at /usr/libexec/gsd-media-keys(if yours is not there, you can find it with ps -ef | grep gsd-media, though I don't think the location matters). You can see it working by running sudo journalctl -fe and then pressing the key:

Nov 12 20:34:29 Node-64 systemd[2009]: Started app-gnome-thunderbird-14449.scope - Application launched by gsd-media-keys.
Nov 12 20:34:58 Node-64 systemd[2009]: Started app-gnome-org.gnome.Calculator-14227.scope - Application launched by gsd-media-keys

As far as I could understand, normal keystrokes are sent to the application currently in focus, but multimedia keys are captured by gsd-media-keys, and then based on the way it is configured(for example All Running Media Players, The Last One Opened or Currently Playing) it will send some kind of a signal to the required application(s). You can actually see that:

  1. Install evtest.
  2. Run sudo evtest.
  3. Select your keyboard from the menu .
  4. If you have a second monitor, put the terminal over there.
  5. Use your keyboard a bit, you should see a lot of text get printed on the screen, stating every key that was pressed or released.
    # example pressing the dot "." key
    Event: time 1731432379.487057, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70037
    Event: time 1731432379.487057, type 1 (EV_KEY), code 52 (KEY_DOT), value 1
    Event: time 1731432379.487057, -------------- SYN_REPORT ------------
    Event: time 1731432379.566978, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70037
    Event: time 1731432379.566978, type 1 (EV_KEY), code 52 (KEY_DOT), value 0
    Event: time 1731432379.566978, -------------- SYN_REPORT ------------
    
  6. Press the media key (like open calculator) and you won't see anything get printed stating the pressed key.

To fix this(again, as far as I understood), you should capture the signal for that key from your keyboard with another application, then bind it to another key in that application(some unused key, for example F13), and then make your shortcuts in the settings app using that; Or you could just directly bind it to the multimedia keys for controlling volume if you need them for that.
I don't have enough time right now to test it and write a full walkthrough, so I'll link you to the post I found do this: Map media keys (Volume up/down) to custom actions


Here are other resources I found; They might come in handy for similar problems:
What is `gsd-media-keys`? - Unix Stackexchange
Multimedia keys sometimes stop working - Aks Ubuntu
Map media keys (Volume up/down) to custom actions - Ask Ubuntu
Help To Remap Home Key To Media Key - Linux Mint Forums
Keyboard key handling blocking some multimedia keys? - Ubuntu Budgie discourse

I hope this helps.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .