What's up with the display switch key?

I received a new Framework 13 recently. I’ve found that the “display switch” key (the fn-F9 key combination) on the keyboard resolves to Super_L+p instead of XF86Display.

What gives? I thought we stopped doing that in the '90s (except Kinesis, but even they’ve since seen the light). Given Framework’s target demographic, this sort of non-configurable setting makes no sense to me.

Furthermore, this kind of hard-coding operates by keycode, so if i remap Super_L to <other>, then the hardcoded combination now resolves to <other>-p. E.g., if i swap Super_L and Alt_L, then the combination produced is now Alt_L+p.

Given that i already use the relevant key combos for switching between frames in my window manager, this key (which i used frequently on my old Thinkpad) is now useless to me. It’s fine, i’ll use a different key combination… but it just rubs me the wrong way every time i look at it.

Okay, rant over.

Framework, if you read this, please reconsider this decision on the next iteration of your keyboards. That and those cursed mixed-height arrow keys…

2 Likes

On the FW13, it’s done in the Embedded Controller, not the keyboard itself. They keyboard just passes the raw matrix over to the mainboard. And since the EC is open source, one can modify it if they want to get into it. People have done other modifications to it. No need for a change in the keyboard itself.

3 Likes

Thanks for this pointer. It took a bit to find, so for posterity, the code in question is in keyboard_customization.c in whatever branch and location applies to your laptop. Search for SCANCODE_F9.

For intel, that file is under board/hx20 or board/hx30 (depending on generation), and for AMD, it’s under lotus-zephyr/zephyr/program/lotus/azalea/src.

2 Likes

It could very well be due to either or both of the following:

  1. The embedded controller simulates a PS/2 keyboard, and there is no PS/2 scancode for the Display key. Therefore, it would need to use the same HID emulation it uses for the brightness and airplane mode keys (which are also not present in PS/2).
  2. Windows may not support the Display key as presented over HID. I don’t know whether this is true.

If you find an appropriate PS/2 set 2 scancode, you can test it by remapping one of the matrix positions using ectool and the Update Keyboard Matrix host command.

3 Likes

Please let me know when or if a solution is found, how to remap this key. Thanks in advance.

I just discovered this peculiarity myself. It seems that Windows uses Windows+p to open the “Projector” display settings so FW have mapped this F9 media key to that for Windows compatibility. It appears that Gnome also maps this shortcut too.

I am running keyd to remap rightalt to F15 (bound to previous workspace) and rightctrl to F16 (bound to next workspace). I was able to adjust my keyd config so I can remap the FW display media key to be something else other than leftmeta+p and then bind suspend to it.

Another option is to go into dconf-editor and unbind <Super>p from switch-monitor in org.gnome.mutter.keybindings. Then Super+P can be bound to something else.

It does look like using ectool to do all this would be the way to go though. Then I can ditch keyd.

[ids]

*

[main]

rightalt = f15
rightcontrol = f16
leftmeta = layer(meta)

[meta]
p = f17