Remap PrtSc to Meta/Super

On my Thinkpad T14s Gen 1, the right meta/super/windows key is replaced by a "PrtSc" key. I use Sway as my Wayland compositor and use the meta keys a lot to navigate and manage windows, and having only a left meta key makes some chords difficult to use. I thus wanted to remap PrtSc to Meta.

I found keyd which looked promising. To use this, I need to know what key PrtSc maps to in the OS. Using evtest:

Event: time 1674905628.580346, type 4 (EV_MSC), code 4 (MSC_SCAN), value b7
Event: time 1674905628.580346, type 1 (EV_KEY), code 99 (KEY_SYSRQ), value 1

It seems like it is interpreted as SysRq.

To only remap this keyboard and not any other keyboards connected to the computer, we'll need the vendor and product id of the built-in keyboard. That can be found in /proc/bus/input/devices:

$ cat /proc/bus/input/devices
I: Bus=0011 Vendor=0001 Product=0001 Version=ab83
N: Name="AT Translated Set 2 keyboard"


Next we'll configure keyd:

$ cat /etc/keyd/default.conf

sysrq = rightmeta

Restart keyd and we're done! The PrtSc key is interpreted as meta instead.