How to swap media keys?

Hello, I’ve recently installed Fedora 38, and my media keys (Fn+button) are placed in non-intuitive locations. I’d like to swap the play-pause (Fn+up arrow) with volume-up (Fn+F11) and stop (Fn+down) with volume-down (Fn+F10).

I’ve tried going to Settings > Keyboard > Shortcuts > “Sound and Media” and setting Fn+up for “Volume Up” (which appears as “Audio Play” in the shortcut box), but pressing Fn+up still plays sounds instead of increasing the volume.

I’d like to ask how to swap those media keys. Thank you very much!

System information:

  • Laptop model: Acer Aspire 5 A515-45
  • OS: Fedora 6.2.12-300.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Apr 20 23:05:25 UTC 2023 x86_64 GNU/Linux
  • Gnome version: 44.0
  • Session type: wayland

You may need to change these keyboard assignments by manually editing the configuration. You can do so using dconf-editor. Media keys are assigned under /org/gnome/settings-daemon/plugins/media-keys/

Thanks for the setting name, that was a huge helper in pointing what I needed to do and how. I got some confusing options, though.

There is volume-up and volume-up-static, where the later seems to be a hardcoded value (?). I’ve found there that I need to set the -static one to [''] and then I can rebind the normal one. However, I don’t know the key names to rebind, and I don’t know if this is because I’m using wayland, but xev doesn’t report anything when I press a media key.

I’m also afraid that setting these keys will also affect how bluetooth peripherals interact, since I only want to swap these keys on my physical keyboard. But I think I can test this later.

Edit:
After reassigning volume-up-static, play-static and pause-static to [''] and restarting my computer:

  • Fn+up
    • no effect
    • xev reports XF86AudioPlay
  • Fn+F11
    • no effect
    • xev reports XF86AudioRaiseVolume
  • Headphone’s play/pause button
    • no effect
    • xevreports alternating XF86AudioPlay and XF86AudioPause
  • Headphone’s volume-up button
    • raises volume
    • xev doesn’t report anything

After setting volume-up to ['XF86AudioPlay'], play and pause to ['XF86AudioRaiseVolume'] and restarting my computer:

  • Fn+up
    • raises volume
    • xev doesn’t report anything
  • Fn+F11
    • can pause but not play
    • xev doesn’t report anything
  • Headphone’s play/pause button
    • raises volume every two presses
    • xevreports alternating XF86AudioPause when volume is not raised
  • Headphone’s volume-up button
    • raises volume
    • xev doesn’t report anything