How to exchange position of delete key and print screen?

On my laptop keyboard I would like to exchange position of delete key and print screen.

Here is output of command setxkbmap -query

WARNING: Running setxkbmap against an Xwayland server
rules:      evdev
model:      pc105
layout:     us

Here is my System Information using inxi-info

System:
  Kernel: 6.1.41-1-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 13.1.1
    parameters: BOOT_IMAGE=/@/boot/vmlinuz-6.1-x86_64
    root=UUID=f3b83d2a-757a-4910-9d47-34478e12b69a rw rootflags=subvol=@ quiet
    splash resume=UUID=bfbc27d0-b1c1-40cd-bc59-63d31357fc12
    udev.log_priority=3
  Desktop: KDE Plasma v: 5.27.6 tk: Qt v: 5.15.10 wm: kwin_wayland vt: 1
    dm: SDDM Distro: Manjaro Linux base: Arch Linux
Machine:
  Type: Laptop System: HP product: OMEN by HP Gaming Laptop 16-n0xxx v: N/A
    serial: <superuser required> Chassis: type: 10 serial: <superuser required>
  Mobo: HP model: 8A42 v: 38.62 serial: <superuser required> UEFI: AMI
    v: F.16 date: 03/20/2023
Battery:
  ID-1: BAT0 charge: 71.3 Wh (100.0%) condition: 71.3/71.3 Wh (100.0%)
    volts: 17.4 min: 15.4 model: HP Primary type: Li-ion serial: <filter>
    status: full cycles: 5
Memory:
  System RAM: total: 16 GiB note: est. available: 14.85 GiB
    used: 13.73 GiB (92.4%)
  RAM Report: permissions: Unable to run dmidecode. Root privileges required.
CPU:
  Info: model: AMD Ryzen 7 6800H with Radeon Graphics bits: 64 type: MT MCP
    arch: Zen 3+ gen: 4 level: v3 note: check built: 2022 process: TSMC n6 (7nm)
    family: 0x19 (25) model-id: 0x44 (68) stepping: 1 microcode: 0xA404102
  Topology: cpus: 1x cores: 8 tpc: 2 threads: 16 smt: enabled cache:
    L1: 512 KiB desc: d-8x32 KiB; i-8x32 KiB L2: 4 MiB desc: 8x512 KiB L3: 16 MiB
    desc: 1x16 MiB
  Speed (MHz): avg: 2577 high: 4617 min/max: 1600/4784 boost: enabled
    scaling: driver: acpi-cpufreq governor: schedutil cores: 1: 2378 2: 2298
    3: 4615 4: 4617 5: 3287 6: 2841 7: 2052 8: 1600 9: 2052 10: 2031 11: 2054
    12: 2052 13: 2049 14: 1600 15: 3282 16: 2431 bogomips: 102246
  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 erms extapic
    extd_apicid f16c flushbyasid fma fpu fsgsbase fsrm fxsr fxsr_opt ht
    hw_pstate ibpb ibrs ibs invpcid irperf lahf_lm lbrv lm mba mca mce
    misalignsse mmx mmxext monitor movbe msr mtrr mwaitx nonstop_tsc nopl npt
    nrip_save nx ospke osvw overflow_recov pae pat pausefilter pclmulqdq
    pdpe1gb perfctr_core perfctr_llc perfctr_nb pfthreshold pge pku 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 vaes vgif vmcb_clean vme vmmcall vpclmulqdq wbnoinvd wdt
    x2apic 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: mmio_stale_data status: Not affected
  Type: retbleed 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: always-on, RSB filling, PBRSB-eIBRS: Not affected
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: AMD Navi 23 [Radeon RX 6650 XT / 6700S 6800S]
    vendor: Hewlett-Packard driver: amdgpu v: kernel arch: RDNA-2 code: Navi-2x
    process: TSMC n7 (7nm) built: 2020-22 pcie: gen: 4 speed: 16 GT/s lanes: 16
    ports: active: none empty: HDMI-A-1,eDP-1 bus-ID: 03:00.0
    chip-ID: 1002:73ef class-ID: 0300
  Device-2: AMD Rembrandt [Radeon 680M] vendor: Hewlett-Packard
    driver: amdgpu v: kernel arch: RDNA-2 code: Navi-2x process: TSMC n7 (7nm)
    built: 2020-22 pcie: gen: 4 speed: 16 GT/s lanes: 16 ports: active: eDP-2
    empty: DP-1, DP-2, DP-3, DP-4, DP-5, DP-6, DP-7, DP-8 bus-ID: 08:00.0
    chip-ID: 1002:1681 class-ID: 0300 temp: 54.0 C
  Device-3: Luxvisions Innotech HP Wide Vision HD Camera driver: uvcvideo
    type: USB rev: 2.0 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-3:2
    chip-ID: 30c9:0069 class-ID: fe01 serial: <filter>
  Display: wayland server: X.org v: 1.21.1.8 with: Xwayland v: 23.1.2
    compositor: kwin_wayland driver: X: loaded: amdgpu
    unloaded: modesetting,radeon alternate: fbdev,vesa dri: radeonsi
    gpu: amdgpu,amdgpu display-ID: 0
  Monitor-1: eDP-2 res: 1920x1080 size: N/A modes: N/A
  API: OpenGL v: 4.6 Mesa 23.0.4 renderer: AMD Radeon Graphics (rembrandt
    LLVM 15.0.7 DRM 3.49 6.1.41-1-MANJARO) direct-render: Yes
Audio:
  Device-1: AMD Navi 21/23 HDMI/DP Audio vendor: Hewlett-Packard
    driver: snd_hda_intel v: kernel pcie: gen: 4 speed: 16 GT/s lanes: 16
    bus-ID: 03:00.1 chip-ID: 1002:ab28 class-ID: 0403
  Device-2: AMD Rembrandt Radeon High Definition Audio
    vendor: Hewlett-Packard driver: snd_hda_intel v: kernel pcie: gen: 4
    speed: 16 GT/s lanes: 16 bus-ID: 08:00.1 chip-ID: 1002:1640 class-ID: 0403
  Device-3: AMD ACP/ACP3X/ACP6x Audio Coprocessor vendor: Hewlett-Packard
    driver: snd_pci_acp6x v: kernel alternate: snd_pci_acp3x, snd_rn_pci_acp3x,
    snd_pci_acp5x, snd_acp_pci, snd_rpl_pci_acp6x, snd_pci_ps,
    snd_sof_amd_renoir, snd_sof_amd_rembrandt pcie: gen: 4 speed: 16 GT/s
    lanes: 16 bus-ID: 08:00.5 chip-ID: 1022:15e2 class-ID: 0480
  Device-4: AMD Family 17h/19h HD Audio vendor: Hewlett-Packard
    driver: snd_hda_intel v: kernel pcie: gen: 4 speed: 16 GT/s lanes: 16
    bus-ID: 08:00.6 chip-ID: 1022:15e3 class-ID: 0403
  API: ALSA v: k6.1.41-1-MANJARO status: kernel-api with: aoss
    type: oss-emulator tools: alsactl,alsamixer,amixer
  Server-1: JACK v: 1.9.22 status: off tools: N/A
  Server-2: PipeWire v: 0.3.75 status: off with: wireplumber status: active
    tools: pw-cli,wpctl
  Server-3: PulseAudio v: 16.1 status: active with: pulseaudio-alsa
    type: plugin tools: pacat,pactl
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: Hewlett-Packard driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s
    lanes: 1 port: e000 bus-ID: 05:00.0 chip-ID: 10ec:8168 class-ID: 0200
  IF: eno1 state: down mac: <filter>
  Device-2: MEDIATEK MT7922 802.11ax PCI Express Wireless Network Adapter
    vendor: Foxconn driver: mt7921e v: kernel pcie: gen: 2 speed: 5 GT/s lanes: 1
    bus-ID: 06:00.0 chip-ID: 14c3:0616 class-ID: 0280
  IF: wlp6s0 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: Foxconn / Hon Hai Wireless_Device driver: btusb v: 0.8 type: USB
    rev: 2.1 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-4:3 chip-ID: 0489:e0e0
    class-ID: e001 serial: <filter>
  Report: rfkill ID: hci0 rfk-id: 0 state: up address: see --recommends
Logical:
  Message: No logical block device data found.
RAID:
  Message: No RAID data found.
Drives:
  Local Storage: total: 953.87 GiB used: 288.39 GiB (30.2%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Samsung model: MZVL21T0HCLR-00BH1
    size: 953.87 GiB block-size: physical: 512 B logical: 512 B speed: 63.2 Gb/s
    lanes: 4 tech: SSD serial: <filter> fw-rev: HPS3NGXH temp: 40.9 C
    scheme: GPT
  Message: No optical or floppy data found.
Partition:
  ID-1: / raw-size: 683.59 GiB size: 683.59 GiB (100.00%)
    used: 285.95 GiB (41.8%) fs: btrfs dev: /dev/nvme0n1p6 maj-min: 259:6
    label: N/A uuid: f3b83d2a-757a-4910-9d47-34478e12b69a
  ID-2: /boot/efi raw-size: 550 MiB size: 548.9 MiB (99.80%)
    used: 580 KiB (0.1%) fs: vfat dev: /dev/nvme0n1p8 maj-min: 259:8 label: N/A
    uuid: 9E3C-6373
  ID-3: /home raw-size: 683.59 GiB size: 683.59 GiB (100.00%)
    used: 285.95 GiB (41.8%) fs: btrfs dev: /dev/nvme0n1p6 maj-min: 259:6
    label: N/A uuid: f3b83d2a-757a-4910-9d47-34478e12b69a
  ID-4: /var/cache raw-size: 683.59 GiB size: 683.59 GiB (100.00%)
    used: 285.95 GiB (41.8%) fs: btrfs dev: /dev/nvme0n1p6 maj-min: 259:6
    label: N/A uuid: f3b83d2a-757a-4910-9d47-34478e12b69a
  ID-5: /var/log raw-size: 683.59 GiB size: 683.59 GiB (100.00%)
    used: 285.95 GiB (41.8%) fs: btrfs dev: /dev/nvme0n1p6 maj-min: 259:6
    label: N/A uuid: f3b83d2a-757a-4910-9d47-34478e12b69a
Swap:
  Kernel: swappiness: 60 (default) cache-pressure: 100 (default)
  ID-1: swap-1 type: partition size: 17.53 GiB used: 2.43 GiB (13.9%)
    priority: -2 dev: /dev/nvme0n1p7 maj-min: 259:7 label: N/A
    uuid: bfbc27d0-b1c1-40cd-bc59-63d31357fc12
Unmounted:
  ID-1: /dev/nvme0n1p1 maj-min: 259:1 size: 260 MiB fs: vfat label: SYSTEM
    uuid: 1A0F-3826
  ID-2: /dev/nvme0n1p2 maj-min: 259:2 size: 16 MiB fs: <superuser required>
    label: N/A uuid: N/A
  ID-3: /dev/nvme0n1p3 maj-min: 259:3 size: 201.03 GiB fs: bitlocker
    label: N/A uuid: N/A
  ID-4: /dev/nvme0n1p4 maj-min: 259:4 size: 625 MiB fs: ntfs
    label: Windows RE tools uuid: A0FA127AFA124CC2
  ID-5: /dev/nvme0n1p5 maj-min: 259:5 size: 50.29 GiB fs: bitlocker
    label: N/A uuid: N/A
USB:
  Hub-1: 1-0:1 info: hi-speed hub with single TT ports: 4 rev: 2.0
    speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 chip-ID: 1d6b:0002
    class-ID: 0900
  Device-1: 1-3:2 info: Luxvisions Innotech HP Wide Vision HD Camera
    type: video driver: uvcvideo interfaces: 3 rev: 2.0
    speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 power: 500mA
    chip-ID: 30c9:0069 class-ID: fe01 serial: <filter>
  Device-2: 1-4:3 info: Foxconn / Hon Hai Wireless_Device type: bluetooth
    driver: btusb interfaces: 3 rev: 2.1 speed: 480 Mb/s (57.2 MiB/s) lanes: 1
    mode: 2.0 power: 100mA chip-ID: 0489:e0e0 class-ID: e001 serial: <filter>
  Hub-2: 2-0:1 info: super-speed hub ports: 2 rev: 3.1
    speed: 10 Gb/s (1.16 GiB/s) lanes: 1 mode: 3.2 gen-2x1 chip-ID: 1d6b:0003
    class-ID: 0900
  Hub-3: 3-0:1 info: hi-speed hub with single TT ports: 3 rev: 2.0
    speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 chip-ID: 1d6b:0002
    class-ID: 0900
  Hub-4: 3-2:2 info: Realtek RTS5411 Hub ports: 2 rev: 2.1
    speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 chip-ID: 0bda:5411
    class-ID: 0900
  Hub-5: 4-0:1 info: super-speed hub ports: 2 rev: 3.1
    speed: 10 Gb/s (1.16 GiB/s) lanes: 1 mode: 3.2 gen-2x1 chip-ID: 1d6b:0003
    class-ID: 0900
  Hub-6: 4-2:2 info: Realtek Hub ports: 2 rev: 3.2
    speed: 5 Gb/s (596.0 MiB/s) lanes: 1 mode: 3.2 gen-1x1 chip-ID: 0bda:0411
    class-ID: 0900
  Hub-7: 5-0:1 info: hi-speed hub with single TT ports: 1 rev: 2.0
    speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 chip-ID: 1d6b:0002
    class-ID: 0900
  Hub-8: 6-0:1 info: Linux Foundation 3.0 root hub ports: N/A rev: 3.0
    speed: 5 Gb/s (596.0 MiB/s) lanes: 1 mode: 3.2 gen-1x1 chip-ID: 1d6b:0003
    class-ID: 0900
  Hub-9: 7-0:1 info: hi-speed hub with single TT ports: 1 rev: 2.0
    speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 chip-ID: 1d6b:0002
    class-ID: 0900
  Hub-10: 8-0:1 info: super-speed hub ports: 1 rev: 3.1
    speed: 10 Gb/s (1.16 GiB/s) lanes: 1 mode: 3.2 gen-2x1 chip-ID: 1d6b:0003
    class-ID: 0900
  Hub-11: 9-0:1 info: hi-speed hub with single TT ports: 1 rev: 2.0
    speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 chip-ID: 1d6b:0002
    class-ID: 0900
  Hub-12: 10-0:1 info: super-speed hub ports: 1 rev: 3.1
    speed: 10 Gb/s (1.16 GiB/s) lanes: 1 mode: 3.2 gen-2x1 chip-ID: 1d6b:0003
    class-ID: 0900
Sensors:
  System Temperatures: cpu: 78.5 C mobo: N/A
  Fan Speeds (RPM): fan-1: 2619 fan-2: 2428
  GPU: device: amdgpu temp: 51.0 C device: amdgpu temp: 49.0 C mem: 46.0 C
    fan: 0 watts: 4.00
Info:
  Processes: 447 Uptime: 6h 53m wakeups: 11258 Init: systemd v: 253
  default: graphical tool: systemctl Compilers: gcc: 13.1.1 clang: 15.0.7
  Packages: 1240 pm: pacman pkgs: 1234 libs: 377 tools: pamac pm: flatpak
  pkgs: 6 Shell: Zsh v: 5.9 default: Bash v: 5.1.16 running-in: konsole
  inxi: 3.3.28

AFAIK the end result would be a custom layout. So I think you need to go through:

https://wiki.archlinux.org/title/X_keyboard_extension

More specifically:

https://wiki.archlinux.org/title/Xmodmap#Modifier_keys

Thank you. I will work on this.

1 Like

I tried to exchange delete and pause keys. I created MyKeyMap with following text.
keycode 127 = Delete NoSymbol Delete
keycode 119 = Pause NoSymbol Pause

Thereafter I gave terminal command xmodmap ~/MyKeyMap

In firefox and thunderbird, delete and pause keys are exchanged, but not in my text editor kate, and Libreoffice. I would prefer changes across all applications.

You seem to be using wayland, so you’ll need to configure it there too, or switch to X.

Thank you. Yes just confirmed that using echo $XDG_SESSION_TYPE

How, in wayland, can I swap delete with either pause or print screen?

Just found that if I login using X11, then following .Xmodmap results in swap of delete & print screen keys.
keycode 107 = Delete NoSymbol Delete
keycode 119 = Print NoSymbol Print

I would prefer to swap under wayland. Looking for solution.

There are a few options.

https://wiki.archlinux.org/title/Input_remap_utilities

I’ve never used wayland or any of these remapping utilities before. I just tried the first in the list, evremap, and it worked.

You may have to change the device name to match your keyboard.

yay -S evremap
# /etc/evremap.toml

device_name = "AT Translated Set 2 keyboard"

[[remap]]
input = ["KEY_DELETE"]
output = ["KEY_PRINT"]

[[remap]]
input = ["KEY_PRINT"]
output = ["KEY_DELETE"]
sudo systemctl enable --now evremap

If you use this you should probably undo the xmodmap config.

Because evremap targets the evdev layer of libinput, its remapping is effective system-wide: in Wayland, X11 and the linux console.

@dmt
Thanks a lot for resolving the issue. :smiling_face_with_three_hearts:

I went for the gui option at GitHub - sezanzeb/input-remapper: 🎮 ⌨ An easy to use tool to change the behaviour of your input devices. which is listed at 1.6 in your suggested link. It worked well in Plasma (Wayland).

I am not frequent on the forum, and visit only when confronted with any issue. So nice of you to have spared time for me. Thanking you again.

1 Like

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