9

This is still open - I did not find a solution. I will give a new bounty to the person who solves this!

——-

I have a HP 655 keyboard which has some quirks. One of them being for there is a key above backspace I keep hitting accidentally when typing which opens of all things “Settings”.

enter image description here

This is rather annoying so I would like to remap it. xev does not report key activity events even when Settings has launched which indicate to me that this require something else than xmodmap. showkey reports this to be 183.

How should I approach this?

8
  • 1
    Try the command sudo showkey: does that show a code? If using Gnome Shell, try the command: gsettings set org.gnome.settings-daemon.plugins.media-keys mic-mute-static ['']. If it works, it will at least remove the key binding so hitting it does not anymore interfere.
    – vanadium
    Commented Oct 25, 2023 at 15:04
  • Showkey reports this to be 183 so promising. What utility should I look at for remapping? Commented Oct 26, 2023 at 11:55
  • Add thiis info to your question - someone may help. In the extreme, it will be possible to change that key by editing the keyboard configuration files, but that is complicated.
    – vanadium
    Commented Oct 27, 2023 at 10:20
  • 1
    That is a multimedia key ... It's a bit different and requires special handling to remap ... Please see askubuntu.com/a/1200910 for how to do that.
    – Raffa
    Commented Nov 5, 2023 at 12:34
  • @ThorbjørnRavnAndersen Please note that you might need to do some digging as your key seems to not be identified as a MicMute key ... Also please note that some vendors have their own config files ... for example /usr/share/X11/xkb/symbols/hp_vndr/us has key <SYST> { [ hpSystem ]}; so keep that in mind too ... i.e. each keyboard is different and only the one laying hands on it can identify it ... My answer is an example on my keyboard ... I never said it's going to be easy :-)
    – Raffa
    Commented Nov 5, 2023 at 15:35

3 Answers 3

5
+250

I will suggest you to try the Input Remapper software. They provide a GUI for mapping your keys and it identifies almost all buttons (even the extra buttons in my mouse which didn't register any clicks in the xbindkeys) and shows up in this application.

Installation

Command line:

input-remapper is available in the Ubuntu repositories, so you can install by opening a terminal and running:

sudo apt install input-remapper

However, the version in this repository lags a bit behind the current version. For example, the version available for Ubuntu 22.04 (the latest LTS), is 1.4.0, while the latest version (at the time of writing this post) is 2.0.1. To install the latest version, according to the project's README, run these commands (adjust appropriately for the latest version):

sudo apt install git python3-setuptools gettext
git clone https://github.com/sezanzeb/input-remapper.git
cd input-remapper && ./scripts/build.sh
sudo apt install -f ./dist/input-remapper-2.0.1.deb

Note: Input-remapper ≥ 2.0 requires at least Ubuntu 22.04.

GUI:

You can find the software in the Software Center (or App Center) on Ubuntu.

app-center-screenshot

Interface

In the GUI, the software will list all the devices that are connected to your PC like this:

gui-devices

After selecting your device, you will get a window to edit your keys: key-mapper

In the above picture, you have to add:

  • Rename: Add a name to the mapping profile and press the down-arrow button on the right
  • Add: Use that button to create a new keymap for your profile. You may need to Stop the injection if you have already set up mapping before.
  • Record: Press this button and record your mic key on your keyboard.
  • Output: You can now map the new key in the output section on the right side of the window. You can refer to the project's Usage section for several key inputs.
  • Apply: Click on this button and also turn on the Autoload so that the profile gets activated once the software starts.

Also, don't forget to add this software to the Startup application along with enabling the Autoload option so that it will automatically map the key once you log in to the system.

starup-apps

0
2

You can use keyd. It is a key remapping tool.

To install it run the following commands one by one.

sudo apt install build-essential
git clone https://github.com/rvaiya/keyd
cd keyd
make && sudo make install
sudo systemctl enable keyd && sudo systemctl start keyd

First, run sudo keyd monitor and press the key you are trying to rename to know its name. I will call it name_of_the_key_you_found

Then, create the file /etc/keyd/default.conf with the following contents.

[ids]
0001:0001

[main]
name_of_the_key_you_found = backspace

Finally, run the command sudo keyd reload for the changes to take effect.

1
2

On Wayland, xmodmap seems to not be effective anymore, but XKB is ... and here is what I just did on my system:

First, I searched the files under /usr/share/X11/xkb/ (that's where your keyboard's data is defined) for the name of my keyboard's Microphone Muting key i.e. XF86AudioMicMute (those MultiMedia keys have names, please see the other linked answer below) like so:

$ grep -r -i 'XF86AudioMicMute' /usr/share/X11/xkb/
/usr/share/X11/xkb/symbols/inet:    key <FK20>   {      [ XF86AudioMicMute      ]       };
/usr/share/X11/xkb/symbols/inet:   key <I256>   {       [ XF86AudioMicMute               ]      }; // KEY_MICMUTE

... that shows two lines in the file /usr/share/X11/xkb/symbols/inet, and then I edited that file like so:

sudo gedit /usr/share/X11/xkb/symbols/inet

... then, commented out the two lines above and copied each one beneath it changing them to look like this:

#   key <FK20>   {      [ XF86AudioMicMute      ]       };
    key <FK20>   {      [ BackSpace             ]       }; // KEY_MICMUTE_REMAPED

...

#  key <I256>   {       [ XF86AudioMicMute               ]      }; // KEY_MICMUTE
   key <I256>   {       [ BackSpace                      ]      }; // KEY_MICMUTE_REMAPED

... leaving the rest of the other lines alone ... then, saved the file and logged out of my user's current desktop session and then logged in back again ... and, voila, my Microphone Mute key is now remapped to be a BackSpace key.

If you want to know more information about MultiMedia keys, please see my other (old) answer here.

It's worth noting as well that you can further limit the files of interest under /usr/share/X11/xkb to modify any key in your currently active layout for your currently active keyboard with setxkbmap used like so:

setxkbmap -print -verbose 10

... which gives output like this:

Setting verbose level to 10
locale is C
Trying to load rules file ./rules/evdev...
Trying to load rules file /usr/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules:      evdev
model:      pc105
layout:     us
Trying to build keymap using the following components:
keycodes:   evdev+aliases(qwerty)
types:      complete
compat:     complete
symbols:    pc+us+inet(evdev)
geometry:   pc(pc105)
xkb_keymap {
    xkb_keycodes  { include "evdev+aliases(qwerty)" };
    xkb_types     { include "complete"  };
    xkb_compat    { include "complete"  };
    xkb_symbols   { include "pc+us+inet(evdev)" };
    xkb_geometry  { include "pc(pc105)" };
};

... where each include next to each section e.g. xkb_symbols refers to related filenames to that section e.g. pc, us and inet.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .