Change one keyboard key for another

Hi,

On my new laptop, I’m missing the “end” and “home” keys as quick keys, but I have some useless keys but not recognized by manjaro, like play, pause, next one, previous one who should be use with a player

I would like to replace for exemple “previous” and “next” with “home” and “end”.

How can I do this?

Thanks

… you mean the arrow keys?
… you only have up and down, but not left and right?

Perhaps show your actual physical keyboard layout - as well as hardware and system info via inxi
(search for “how to provide good information”)
and the keyboard layout you elected to apply and are currently using

Perhaps you just selected the wrong keyboard layout …

Thanks, unfortunately, I can’t provide a link or image… so it’s difficult to provide details

I don’t speak about arrow key, but “home” and “end”, these keys are usually next to “delete” and “insert”.

This is not a keyboard layout issue, sometimes on keyboards and especially laptops, the configuration is non-standard, and I want to be able to replace a shortcut key that I do not use dedicated in this case to the playback of videos and not recognized by the system, by keys corresponding to my use.

post the type and version of the keyboard and others can check the net forthemselve on this type.
also:
:+1: Welcome to Manjaro! :+1:

  1. Please read this:
    [HowTo] Provide System Information
    and press the three dots below your post and press the :pencil2: to give us more information so we can see what’s really going on.
    Now we know the symptom of the disease, but we need some more probing to know where the origin lies… :grin:
  2. An inxi --admin --verbosity=7 --filter --no-host --width would be the minimum required information for us to be able to help you. (Personally Identifiable Information like serial numbers and MAC addresses will be filtered out by the above command)
    Also, please copy-paste that output in-between 3 backticks ``` at the beginning and end of the code/text.

:+1:

on the one hand:
I know
on the other:
on my laptop, these functions are available via the Fn key,
in combination with the left arrow (labelled: “Pos 1”)
and right arrow (labelled: “End”).

So: is my laptop keyboard layout what is unusual - or is yours? :wink:

… share the keyboard layout that you elected to use
as well as the info on your laptop/hardware

What you want to do is very likely possible - but it might be unnecessary to do.

you should be able to paste a link
when you format it as a quote - see the editing symbols in the top row …
… or put some spaces … get creative :wink:

This is my Fr Keybord : ibb. co/zhdty8C
unrecognized keys that I want to reassign : ibb. co/gv50bfW

I know it is possible to combine the Fn+home or Fn+end key, but I prefer a direct access to this key that I use very regularly.

As resquested, but i don’t think this will help :

System:
  Kernel: 5.17.6-1-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 11.2.0
    parameters: BOOT_IMAGE=/boot/vmlinuz-5.17-x86_64
    root=UUID=db52b91e-9a4f-4c43-8ef7-f3d7278d56a3 rw quiet
    cryptdevice=UUID=acbb0721-8e24-4652-a068-ab7f1c12303a:luks-acbb0721-8e24-4652-a068-ab7f1c12303a
    root=/dev/mapper/luks-acbb0721-8e24-4652-a068-ab7f1c12303a apparmor=1
    security=apparmor
    resume=/dev/mapper/luks-fa2dcf24-0ccf-4f22-854c-36397ced4c4d
    udev.log_priority=3
  Desktop: Cinnamon v: 5.2.7 tk: GTK v: 3.24.33 vt: 7 dm: LightDM v: 1.30.0
    Distro: Manjaro Linux base: Arch Linux
Machine:
  Type: Laptop System: LENOVO product: 21A4 v: ThinkBook 15 G3 ACL
    serial: <superuser required> Chassis: type: 10 v: ThinkBook 15 G3 ACL
    serial: <superuser required>
    date: 04/29/2021
Memory:
  RAM: total: 35.13 GiB used: 2.71 GiB (7.7%)
  RAM Report:
    permissions: Unable to run dmidecode. Root privileges required.
CPU:
  Info: model: AMD Ryzen 5 5500U with Radeon Graphics bits: 64 type: MT MCP
    arch: Zen 2 family: 0x17 (23) model-id: 0x68 (104) stepping: 1
    microcode: 0x8608103
  Topology: cpus: 1x cores: 6 tpc: 2 threads: 12 smt: enabled cache:
    L1: 384 KiB desc: d-6x32 KiB; i-6x32 KiB L2: 3 MiB desc: 6x512 KiB L3: 8 MiB
    desc: 2x4 MiB
  Speed (MHz): avg: 1274 high: 2071 min/max: 400/4056 boost: enabled
    scaling: driver: amd-pstate governor: schedutil cores: 1: 1899 2: 2071
    3: 1034 4: 1032 5: 1263 6: 1413 7: 1097 8: 1098 9: 1097 10: 1098 11: 1097
    12: 1097 bogomips: 50325
  Flags: 3dnowprefetch abm adx aes aperfmperf apic arat avic avx avx2 bmi1
    bmi2 bpext cat_l3 cdp_l3 clflush clflushopt clwb clzero cmov cmp_legacy
    constant_tsc cpb cppc cpuid cqm cqm_llc cqm_mbm_local cqm_mbm_total
    cqm_occup_llc cr8_legacy cx16 cx8 de decodeassists extapic extd_apicid
    f16c flushbyasid fma fpu fsgsbase fxsr fxsr_opt ht hw_pstate ibpb ibrs ibs
    irperf lahf_lm lbrv lm mba mca mce misalignsse mmx mmxext monitor movbe
    msr mtrr mwaitx nonstop_tsc nopl npt nrip_save nx osvw overflow_recov pae
    pat pausefilter pclmulqdq pdpe1gb perfctr_core perfctr_llc perfctr_nb
    pfthreshold pge pni popcnt pse pse36 rapl rdpid rdpru rdrand rdseed rdt_a
    rdtscp rep_good sep sha_ni skinit smap smca smep ssbd sse sse2 sse4_1
    sse4_2 sse4a ssse3 stibp succor svm svm_lock syscall tce topoext tsc
    tsc_scale umip v_spec_ctrl v_vmsave_vmload vgif vmcb_clean vme vmmcall
    wbnoinvd wdt xgetbv1 xsave xsavec xsaveerptr xsaveopt xsaves
  Vulnerabilities:
  Type: itlb_multihit status: Not affected
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: spec_store_bypass
    mitigation: Speculative Store Bypass disabled via prctl
  Type: spectre_v1
    mitigation: usercopy/swapgs barriers and __user pointer sanitization
  Type: spectre_v2 mitigation: Retpolines, IBPB: conditional, IBRS_FW,
    STIBP: conditional, RSB filling
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: AMD Lucienne vendor: Lenovo driver: amdgpu v: kernel pcie: gen: 3
    speed: 8 GT/s lanes: 16 link-max: gen: 4 speed: 16 GT/s ports: active: eDP-1
    empty: DP-1,DP-2,HDMI-A-1 bus-ID: 06:00.0 chip-ID: 1002:164c
    class-ID: 0300
  Device-2: IMC Networks Integrated Camera type: USB driver: uvcvideo
    bus-ID: 1-3:2 chip-ID: 13d3:56ff class-ID: 0e02
  Display: x11 server: X.Org v: 21.1.3 driver: X: loaded: amdgpu
    unloaded: modesetting alternate: fbdev,vesa gpu: amdgpu display-ID: :0
    screens: 1
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.00x11.22")
    s-diag: 582mm (22.93")
  Monitor-1: eDP-1 mapped: eDP model: AU Optronics 0xe48d built: 2019
    res: 1920x1080 hz: 60 dpi: 142 gamma: 1.2 size: 344x194mm (13.54x7.64")
    diag: 395mm (15.5") ratio: 16:9 modes: max: 1920x1080 min: 640x480
  Message: Unable to show GL data. Required tool glxinfo missing.
Audio:
  Device-1: AMD Renoir Radeon High Definition Audio vendor: Lenovo
    driver: snd_hda_intel v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16
    link-max: gen: 4 speed: 16 GT/s bus-ID: 06:00.1 chip-ID: 1002:1637
    class-ID: 0403
  Device-2: AMD ACP/ACP3X/ACP6x Audio Coprocessor vendor: Lenovo driver: N/A
    alternate: snd_pci_acp3x, snd_rn_pci_acp3x, snd_pci_acp5x, snd_sof_amd_renoir
    pcie: gen: 3 speed: 8 GT/s lanes: 16 link-max: gen: 4 speed: 16 GT/s
    bus-ID: 06:00.5 chip-ID: 1022:15e2 class-ID: 0480
  Device-3: AMD Family 17h/19h HD Audio vendor: Lenovo driver: snd_hda_intel
    v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16 link-max: gen: 4
    speed: 16 GT/s bus-ID: 06:00.6 chip-ID: 1022:15e3 class-ID: 0403
  Sound Server-1: ALSA v: k5.17.6-1-MANJARO running: yes
  Sound Server-2: JACK v: 1.9.21 running: no
  Sound Server-3: PulseAudio v: 15.0 running: yes
  Sound Server-4: PipeWire v: 0.3.51 running: yes
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: Lenovo driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 1
    port: 3000 bus-ID: 04:00.0 chip-ID: 10ec:8168 class-ID: 0200
  IF: enp4s0 state: down mac: <filter>
  Device-2: Realtek RTL8852AE 802.11ax PCIe Wireless Network Adapter
    vendor: Lenovo driver: rtw89_pci v: kernel pcie: gen: 1 speed: 2.5 GT/s
    lanes: 1 port: 2000 bus-ID: 05:00.0 chip-ID: 10ec:8852 class-ID: 0280
  IF: wlp5s0 state: up mac: <filter>
  IP v4: <filter> type: dynamic noprefixroute scope: global
    broadcast: <filter>
  IP v6: <filter> type: dynamic noprefixroute scope: global
  IP v6: <filter> type: noprefixroute scope: link
  WAN IP: <filter>
Bluetooth:
  Device-1: Realtek Bluetooth Radio type: USB driver: btusb v: 0.8
    bus-ID: 3-4:3 chip-ID: 0bda:4852 class-ID: e001 serial: <filter>
  Report: rfkill ID: hci0 rfk-id: 3 state: down bt-service: enabled,running
    rfk-block: hardware: no software: yes address: see --recommends
Logical:
  Message: No logical block device data found.
  Device-1: luks-acbb0721-8e24-4652-a068-ab7f1c12303a maj-min: 254:0
    type: LUKS dm: dm-0 size: 892.57 GiB
  Components:
  p-1: nvme1n1p2 maj-min: 259:6 size: 892.57 GiB
  Device-2: luks-fa2dcf24-0ccf-4f22-854c-36397ced4c4d maj-min: 254:1
    type: LUKS dm: dm-1 size: 38.64 GiB
  Components:
  p-1: nvme1n1p3 maj-min: 259:7 size: 38.64 GiB
RAID:
  Message: No RAID data found.
Drives:
  Local Storage: total: 1.38 TiB used: 11.71 GiB (0.8%)
  SMART Message: Required tool smartctl not installed. Check --recommends
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Western Digital
    model: PC SN530 SDBPMPZ-512G-1101 size: 476.94 GiB block-size:
    physical: 512 B logical: 512 B speed: 31.6 Gb/s lanes: 4 type: SSD
    serial: <filter> rev: 21160001 temp: 29.9 C scheme: GPT
  ID-2: /dev/nvme1n1 maj-min: 259:4 vendor: Samsung model: SSD 980 1TB
    size: 931.51 GiB block-size: physical: 512 B logical: 512 B speed: 31.6 Gb/s
    lanes: 4 type: SSD serial: <filter> rev: 2B4QFXO7 temp: 28.9 C scheme: GPT
  Message: No optical or floppy data found.
Partition:
  ID-1: / raw-size: 892.57 GiB size: 877.49 GiB (98.31%)
    used: 11.68 GiB (1.3%) fs: ext4 dev: /dev/dm-0 maj-min: 254:0
    mapped: luks-acbb0721-8e24-4652-a068-ab7f1c12303a label: N/A
    uuid: db52b91e-9a4f-4c43-8ef7-f3d7278d56a3
  ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%)
    used: 27.8 MiB (9.3%) fs: vfat dev: /dev/nvme1n1p1 maj-min: 259:5
    label: NO_LABEL uuid: ABEE-8A55
Swap:
  Kernel: swappiness: 60 (default) cache-pressure: 100 (default)
  ID-1: swap-1 type: partition size: 38.64 GiB used: 0 KiB (0.0%)
    priority: -2 dev: /dev/dm-1 maj-min: 254:1
    mapped: luks-fa2dcf24-0ccf-4f22-854c-36397ced4c4d label: swap
    uuid: ba645f64-3509-45af-a666-3e31e1064562
Unmounted:
  ID-1: /dev/nvme0n1p1 maj-min: 259:1 size: 16 MiB fs: <superuser required>
    label: N/A uuid: N/A
  ID-2: /dev/nvme0n1p2 maj-min: 259:2 size: 340.2 GiB fs: ntfs label: N/A
    uuid: A67841217840F21B
  ID-3: /dev/nvme0n1p3 maj-min: 259:3 size: 136.72 GiB fs: ntfs
    label: Data-NTFS uuid: 96629873629859B7
USB:
  Hub-1: 1-0:1 info: Hi-speed hub with single TT ports: 4 rev: 2.0
    speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900
  Device-1: 1-3:2 info: IMC Networks Integrated Camera type: Video
    driver: uvcvideo interfaces: 2 rev: 2.0 speed: 480 Mb/s power: 500mA
    chip-ID: 13d3:56ff class-ID: 0e02
  Hub-2: 2-0:1 info: Super-speed hub ports: 2 rev: 3.1 speed: 10 Gb/s
    chip-ID: 1d6b:0003 class-ID: 0900
  Hub-3: 3-0:1 info: Hi-speed hub with single TT ports: 4 rev: 2.0
    speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900
  Device-1: 3-3:2 info: Elan Micro ELAN:Fingerprint type: <vendor specific>
    driver: N/A interfaces: 1 rev: 2.0 speed: 12 Mb/s power: 100mA
    chip-ID: 04f3:0c4b class-ID: 0000
  Device-2: 3-4:3 info: Realtek Bluetooth Radio type: Bluetooth
    driver: btusb interfaces: 2 rev: 1.0 speed: 12 Mb/s power: 500mA
    chip-ID: 0bda:4852 class-ID: e001 serial: <filter>
  Hub-4: 4-0:1 info: Super-speed hub ports: 2 rev: 3.1 speed: 10 Gb/s
    chip-ID: 1d6b:0003 class-ID: 0900
Sensors:
  System Temperatures: cpu: N/A mobo: N/A gpu: amdgpu temp: 38.0 C
  Fan Speeds (RPM): N/A
Info:
  Processes: 353 Uptime: 19m wakeups: 3 Init: systemd v: 250 tool: systemctl
  Compilers: gcc: 11.2.0 clang: 13.0.1 Packages: pacman: 1123 lib: 293
  flatpak: 0 Shell: Bash v: 5.1.16 running-in: gnome-terminal inxi: 3.3.15

Thanks for the clarification.
The functions are available - but, just as for me, only as a compound (press two keys instead of just one).

So, for you, it is something necessary.

Unfortunately I cannot for the life of me remember the way to do it.
I just seem to remember that
xev
was involved
to find out the keycode to use in the reconfiguration/reassignment.

I’d have to do some googling to refresh my memory - what did you find out?

It is not Manjaro specific - so: any resource you find will likely be helpful to you.
Perhaps even the Arch Wiki has something on it - this would be my first source to go to if it appeared in the search results.

Others here probably do know/remember the procedure.
I unfortunately don’t right now.

First i have install xev
pacman -S xorg-xev

If i run
xev
i get

FocusOut event, serial 38, synthetic NO, window 0x3600001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 38, synthetic NO, window 0x3600001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 38, synthetic NO, window 0x0,
    keys:  4294967210 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

FocusOut event, serial 38, synthetic NO, window 0x3600001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 38, synthetic NO, window 0x3600001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 38, synthetic NO, window 0x0,
    keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0

With a usual key i get

KeyPress event, serial 38, synthetic NO, window 0x3600001,
    root 0x6aa, subw 0x0, time 1544905, (-117,86), root:(754,531),
    state 0x0, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

It seems that the keys are not recognized at all by the system.
system.
Does anyone have an opinion or an idea?

For now i follow this source
dedoimedo. com/computers/linux-keyboard-custom-remap.html
wiki.archlinux. org/title/Linux_console/Keyboard_configuration

The first output looks like you pressed two consumer control keys (eg media keys), or the same key twice.

You can use xmodmap or xkbcomp (not both at the same time). The latter applies the config much faster and can apply a custom map per device (if you supply an id, which can be found using xinput), it’s more flexible, newer and should probably be preferred.

# get config
xmodmap -pke ~/xmodmap

# edit file
keycode 110 = Home NoSymbol Home
keycode 172 = XF86AudioPlay XF86AudioPause XF86AudioPlay XF86AudioPause
# becomes
keycode 172 = Home NoSymbol Home
keycode 110 = XF86AudioPlay XF86AudioPause XF86AudioPlay XF86AudioPause

# re-apply
xmodmap ~/xmodmap

With xkbcomp the file consists of 4 sections but we only care about sections 1 and 3. Section 1 contains label to keycode mappings, section 3 contains label to keytable (may not be the correct term) mappings. Some labels are not descriptive so look in section 3 to see which key is which.

# get config
xkbcomp $DISPLAY ~/xkbcomp

#edit file
# section 1
<HOME> = 110;
<I172> = 172;

# section 3
key <HOME> {         [            Home ] };
key <I172> {         [   XF86AudioPlay,  XF86AudioPause ] };

# either section can be swapped
# don't swap both at the same time
# I'll use the 1st section
<HOME> = 172;
<I172> = 110;

# re-apply
xkbcomp ~/xkbcomp $DISPLAY

Mapping scancodes to keycodes may be better, if possible.

xmodmap - ArchWiki
Xorg/Keyboard configuration - ArchWiki
Map scancodes to keycodes - ArchWiki
Xbindkeys - ArchWiki

Consumer control scancodes
// Power Control
#define CONSUMER_CONTROL_POWER                             0x0030
#define CONSUMER_CONTROL_RESET                             0x0031
#define CONSUMER_CONTROL_SLEEP                             0x0032

// Screen Brightness
#define CONSUMER_CONTROL_BRIGHTNESS_INCREMENT              0x006F
#define CONSUMER_CONTROL_BRIGHTNESS_DECREMENT              0x0070

// These HID usages operate only on mobile systems (battery powered) and
// require Windows 8 (build 8302 or greater).
#define CONSUMER_CONTROL_WIRELESS_RADIO_CONTROLS           0x000C
#define CONSUMER_CONTROL_WIRELESS_RADIO_BUTTONS            0x00C6
#define CONSUMER_CONTROL_WIRELESS_RADIO_LED                0x00C7
#define CONSUMER_CONTROL_WIRELESS_RADIO_SLIDER_SWITCH      0x00C8

// Media Control
#define CONSUMER_CONTROL_PLAY_PAUSE                        0x00CD
#define CONSUMER_CONTROL_SCAN_NEXT                         0x00B5
#define CONSUMER_CONTROL_SCAN_PREVIOUS                     0x00B6
#define CONSUMER_CONTROL_STOP                              0x00B7
#define CONSUMER_CONTROL_VOLUME                            0x00E0
#define CONSUMER_CONTROL_MUTE                              0x00E2
#define CONSUMER_CONTROL_BASS                              0x00E3
#define CONSUMER_CONTROL_TREBLE                            0x00E4
#define CONSUMER_CONTROL_BASS_BOOST                        0x00E5
#define CONSUMER_CONTROL_VOLUME_INCREMENT                  0x00E9
#define CONSUMER_CONTROL_VOLUME_DECREMENT                  0x00EA
#define CONSUMER_CONTROL_BASS_INCREMENT                    0x0152
#define CONSUMER_CONTROL_BASS_DECREMENT                    0x0153
#define CONSUMER_CONTROL_TREBLE_INCREMENT                  0x0154
#define CONSUMER_CONTROL_TREBLE_DECREMENT                  0x0155

// Application Launcher
#define CONSUMER_CONTROL_CONFIGURATION                     0x0183
#define CONSUMER_CONTROL_EMAIL_READER                      0x018A
#define CONSUMER_CONTROL_CALCULATOR                        0x0192
#define CONSUMER_CONTROL_LOCAL_BROWSER                     0x0194

// Browser/Explorer Specific
#define CONSUMER_CONTROL_SEARCH                            0x0221
#define CONSUMER_CONTROL_HOME                              0x0223
#define CONSUMER_CONTROL_BACK                              0x0224
#define CONSUMER_CONTROL_FORWARD                           0x0225
#define CONSUMER_CONTROL_BR_STOP                           0x0226
#define CONSUMER_CONTROL_REFRESH                           0x0227
#define CONSUMER_CONTROL_BOOKMARKS                         0x022A

// Mouse Horizontal scroll
#define CONSUMER_CONTROL_PAN                               0x0238

Thanks !
I had this two lignes in a script

xmodmap -e "keycode 173 = Home NoSymbol Home"
xmodmap -e "keycode 171 = End NoSymbol End"

It does the job

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.