12

I bought a „Microsoft Ergonomic” keyboard to replace my used up Microsoft Natural. They moved „Win” key to the left and placed new „Office” and „Emoji” keys on the right instead: Alt, Office, Emoji - new keys

By default, those keys seem to be not recognized by xorg (at least on Ubuntu 20.04 I use).

I am looking for hints how to map those keys. I heavily used Win-… combinations in my custom keyboard shortcuts, so I press those keys repeatedly). I'd prefer to make the Office key behave as Win used to (Super if I recall), and map Emoji as some new modifier.

I tried evtest; it emits some key combinations. Both reports below are from a single keypress.

(Office)

Event: time 1604935916.773242, -------------- SYN_REPORT ------------
Event: time 1604935919.037417, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e0
Event: time 1604935919.037417, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 1
Event: time 1604935919.037417, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e1
Event: time 1604935919.037417, type 1 (EV_KEY), code 42 (KEY_LEFTSHIFT), value 1
Event: time 1604935919.037417, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e2
Event: time 1604935919.037417, type 1 (EV_KEY), code 56 (KEY_LEFTALT), value 1
Event: time 1604935919.037417, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e3
Event: time 1604935919.037417, type 1 (EV_KEY), code 125 (KEY_LEFTMETA), value 1

(Emoji)

Event: time 1604935938.159725, -------------- SYN_REPORT ------------
Event: time 1604935942.720256, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e0
Event: time 1604935942.720256, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 1
Event: time 1604935942.720256, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e1
Event: time 1604935942.720256, type 1 (EV_KEY), code 42 (KEY_LEFTSHIFT), value 1
Event: time 1604935942.720256, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e2
Event: time 1604935942.720256, type 1 (EV_KEY), code 56 (KEY_LEFTALT), value 1
Event: time 1604935942.720256, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e3
Event: time 1604935942.720256, type 1 (EV_KEY), code 125 (KEY_LEFTMETA), value 1
Event: time 1604935942.720256, -------------- SYN_REPORT ------------
Event: time 1604935942.728233, type 4 (EV_MSC), code 4 (MSC_SCAN), value 7002c
Event: time 1604935942.728233, type 1 (EV_KEY), code 57 (KEY_SPACE), value 1
Event: time 1604935942.728233, -------------- SYN_REPORT ------------
^X@s^[^@Event: time 1604935942.872415, type 4 (EV_MSC), code 4 (MSC_SCAN), value 7002c
Event: time 1604935942.872415, type 1 (EV_KEY), code 57 (KEY_SPACE), value 0
Event: time 1604935942.872415, -------------- SYN_REPORT ------------
Event: time 1604935942.880280, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e0
Event: time 1604935942.880280, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 0
Event: time 1604935942.880280, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e1
Event: time 1604935942.880280, type 1 (EV_KEY), code 42 (KEY_LEFTSHIFT), value 0
Event: time 1604935942.880280, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e2
Event: time 1604935942.880280, type 1 (EV_KEY), code 56 (KEY_LEFTALT), value 0
Event: time 1604935942.880280, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e3
Event: time 1604935942.880280, type 1 (EV_KEY), code 125 (KEY_LEFTMETA), value 0
Event: time 1604935942.880280, -------------- SYN_REPORT ------------
Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
Mekk
  • 231
  • 1
  • 7
  • 1
    I found similar (but unanswered) question on askubuntu, with more detailed comments about events: https://askubuntu.com/questions/1288519/how-to-remap-microsoft-ergonomic-keyboard-2019-model-the-office-and-the-emoji-ke/1290922#1290922 – Mekk Nov 09 '20 at 16:17
  • 1
    @phg Could you add the information about the codes via `sudo showkey -s` and `xev`? – tukan Jun 29 '22 at 10:42
  • "Microsoft Ergonomic” keyboard ? Do you mean "Microsoft Natural Ergonomic 4000" or "Microsoft Natural Wireless Ergonomic 7000" ? Then, if under KDE-Plasma there are ready made choices for these under system-settings/input devices/keyboard/keyboard model – MC68020 Jun 30 '22 at 10:18
  • @MC68020: The current iteration is called just “Microsoft Ergonomic Keyboard” without a marketing number attached. FWIW the PCI ID is 045e:082c. – phg Jul 01 '22 at 07:15
  • ``lsusb -v`` output: https://paste.centos.org/view/873f9905 – phg Jul 01 '22 at 07:18
  • @tukan ``xev`` output: https://paste.centos.org/view/afdd7660 – yes, that is from a single keypress! Pretty much the same picture as in the ``evtest`` output that @Mekk supplied. – phg Jul 01 '22 at 07:20
  • @tukan ``showkey -s`` output: ``0x1d 0x2a 0x38 0xe0 0x5b 0x9d 0xaa 0xb8 0xe0 0xdb`` – phg Jul 01 '22 at 07:24
  • @phg Oh my, you can't even map that as modifier as there is a limit of 4 keycodes. which of the keys produce the output? The office or the emoji? We have to thank you Microsoft for such *"great"* idea. – tukan Jul 01 '22 at 07:40
  • @phg if you do `xbindkeys --key` or `xbindkeys --multikey` what does it return? – tukan Jul 01 '22 at 08:13
  • Output of ``xbindkeys --multikey``:https://paste.centos.org/view/4acaa9ec – it’s the “rectangular thingy” key. The emoji sends one more input before that with ``space`` instead of ``Control_L``. – phg Jul 01 '22 at 11:36
  • @phg I can't find the pasted text any more. I think the safest way would this route via xchainkeys already answered - https://unix.stackexchange.com/a/303698/258307. Would love to help more but I don't have the keyboard. – tukan Jul 04 '22 at 07:46
  • If you can determine the keycode with xev, check the example in this manual https://man.archlinux.org/man/community/xcape/xcape.1.en – gabor.zed Jul 07 '22 at 16:25

2 Answers2

2

I just bought the Microsoft Ergonomic Keyboard and I'm using Pop!_OS.  I had the same question and this page happens to be the top search result, so here's what I've got:

The "MS Office" key is a Shift+Ctrl+Alt+Super combination key.  You're expected to combine it with another key to form a full shortcut, so pressing MS Office+A would be equivalent to Shift+Ctrl+Alt+Super+A.

The "Emoji" key is itself equivalent to MS Office+Space, or Shift+Ctrl+Alt+Super+Space.

Your Linux flavor may vary, but Gnome-based environments like Pop!_OS have a "Keyboard" section in its Settings app that allows you to assign all kind of behaviors to keyboard shortcuts of your choice.
This allows you to map multiple shortcuts to a single action, so you can have both Super+F and Shift+Ctrl+Alt+Super+F open the file manager, which can be used to approximate what an xbindkeys + xautomation combo would provide.

Let's list some other weird key mappings.

  • The "magnifying glass" key found above the Pause key emits a Shift+Super+Touchpad toggle shortcut.
  • The "lock" icon found above the Delete key emits a Super+L shortcut.
  • The "overlapping windows" icon next to it emits a Super+Tab shortcut.
  • The icon next to it emits a Shift+Super+S shortcut, intended to bring up a configurable screenshotting UI.
  • The 1, 2 and 3 keys on the top left corner emit Super+1, Super+2 and Super+3 respectively, which on many environments should already work as intended by opening the first three apps in your app bar.

After mapping all that stuff to my taste, all that was left to do for me was to tweak the Compose key setting to use Right Alt so I could type weird little áccented charactêrs again.

0

I use the Ubuntu package xbindkeys in combination with the package xautomation to achieve this task. I don't know if evtest give compatible output for the configuration. My choice is xev. Launched from a CLI it prints the keycodes, keydescriptions and button numbers on the terminal. I have also heared that there is a package xbindkeys-config for easier setup, but I don't use it. Here is a little sample config I use for sending CTRL+PgUP and CTRL+PgDOW to a browser for switching through open TABs, when I use special mouse-buttons.

"xte 'usleep 100000' 'keydown Control_R' 'key Page_Up' 'keyup Control_R'"
   b:8 + Release # mouse-button 8

"xte 'usleep 100000' 'keydown Control_R' 'key Page_Down' 'keyup Control_R'"
   b:9 + Release # mouse-button 9
Winnie Tigger
  • 447
  • 2
  • 7
  • 1
    Could you elaborate how that helps with those Microsoft special keys that send like five keycodes at the same time? I need one of those keys to act as *Compose* btw. Can ``xbindkeys`` do that? – phg Aug 08 '22 at 06:27
  • Apologies for my delayed response. I was AFK. And also sorry, that I cannot tell you. The man pages have some hints for multikey. But I am uncertain if this points in the right direction. – Winnie Tigger Aug 24 '22 at 08:04