This how I remap my SP3's screen buttons to something more useable than the default binding.
By default Linux binds the windows key to LWIN, which overlaps with my window
manager's meta binding, and is pretty useless when using the Surface with the
keyboard folded. I remap it to F13 so I can bind it to custom scripts with
xbindkeys, but you can customize it to suit your needs.
There's probably a better place to put the xkb and have it loaded at system boot instead, but this works good enough for me.
Setup is as follows:
~/.xinitrc
#...
SP3_BUTTON_XINPUT_ID=$(xinput | grep 'Surface Pro 3/4 Buttons' | sed 's/\s/\n/g' | grep id | sed 's/id=//')
xkbcomp -i "$SP3_BUTTON_XINPUT_ID" ~/.config/sp3buttons.xkb "$DISPLAY" &
#...~/.config/sp3buttons.xkb
xkb_keymap {
xkb_keycodes { include "evdev" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols {
key <LWIN> { [ F13 ] };
key <VOL-> { [ XF86AudioLowerVolume ] };
key <VOL+> { [ XF86AudioRaiseVolume ] };
};
};
Restart X and enjoy :)