2

I have the volume keys on the keyboard as FN+F3, FN+F2 respectively.

I would like to map the Pause button to volume up and SCRLK as volume down since those two buttons are useless anyway.

I tried setkeycodes XF86AudioRaiseVolume 0xff13 but it didn't work.

Is this doable? This is for an USB keyboard for my desktop.

PRATAP
  • 22,460
Dong
  • 133
  • 6

1 Answers1

3

Example on Ubuntu 19.10

  1. Open Gnome-Terminal
  2. Run xev | grep keycode
  3. Press SCRLK key once and Pause key once

you will have the result like this

$ xev | grep keycode
    state 0x10, keycode 36 (keysym 0xff0d, Return), same_screen YES,
    state 0x10, keycode 78 (keysym 0xff14, Scroll_Lock), same_screen YES,
    state 0x10, keycode 78 (keysym 0xff14, Scroll_Lock), same_screen YES,
    state 0x10, keycode 127 (keysym 0xff13, Pause), same_screen YES,
    state 0x10, keycode 127 (keysym 0xff13, Pause), same_screen YES,
$ 
  1. Note down the keycode for SCRLK and Pause 78 and 127 in my case.

  2. now run xmodmap -e "keycode 78 = XF86AudioLowerVolume"

  3. xmodmap -e "keycode 127 = XF86AudioRaiseVolume"

sample:

$ xmodmap -e "keycode 78 = XF86AudioLowerVolume"
$ xmodmap -e "keycode 127 = XF86AudioRaiseVolume"
$ 

Once you logout above changes will reset to normal..

There are different ways to make xmodmap changes permanently.. a google search will give you lot of links.. one of them is How to apply Xmodmap permanently

PRATAP
  • 22,460
  • It worked. Thank you, I did so much googling, didn't think it would be so easy, all in one line. My keycodes were the same so I didn't need to change anything. – Dong Oct 27 '19 at 03:13