Change mapping of specific key on keyboard


does anyone know how to remap a key on Fedora 36?

I am a Spanish native speaker so I use a lot the “ñ” letter… The problem is that I’m living in Germany, which implies QWERTZ keyboards, so in the place of the “ñ”, I have an “ö”…

Right now is configured to have both layouts, one in Spanish and one in German, which I change using the Home + Space shortcut and is changing only in one App but is still kind of annoying, since now is 5 keys I have to press instead of 2 to write one letter → Home + Space + Ö ++ Home + Space [the non-letter/non-numeric symbols also change, so it gets confusing leaving it in Spanish]

I’m relatively new to Fedora and in Ubuntu I used to change the “de” file in the X11 folder to add the “ñ” when pressing AltGr + N, which was the perfect solution, since it allowed me to have a Spanish and German keyboard together, sacrificing the ” symbol. However, I don’t mind, since I still have Mayus + 2 (->"<- instead of ->”<-)… It doesn’t seem to work on Fedora…

I have also tried dumping the current keyboard map to a new file in my home directory with

xmodmap -pke > ~/.xmodmap

to change that file and import the modified keymap with

xmodmap ~/.xmodmap

which works… Till I reboot or upgrade.

I also tried with xkeycaps but didn’t work and when trying to uninstall my GUI crashed :person_shrugging:

Welcome to ask.fedora @akuilera

Is this your layout?

You should be able to achieve this while pressing the tilde ~ and then the n = ñ

For the ä ö ü i use the ¨ + a o u on a default Portugues_BR Keyboard.

If you give us more information like inxi -Fzx (use command in terminal) and post the output here as </> pre-formated text, we will be able to see which environment you are using and where you could make the changes you are looking for.

1 Like

When I do that I get “~n” :sweat_smile:… But I would also find that a great solution…

Is really similar to that one but not specifically. Mine doesn’t have two buttons between AltGr and Stgr and has also a numerical section… Is more like this one but the Fn Keys are just a bit different…

inxi -Fzx
  Kernel: 5.19.16-200.fc36.x86_64 arch: x86_64 bits: 64 compiler: gcc
    v: 2.37-36.fc36 Desktop: GNOME v: 42.5 Distro: Fedora release 36 (Thirty
  Type: Laptop System: LENOVO product: 82EY v: IdeaPad Gaming 3 15ARH05
    serial: <superuser required>
  Mobo: LENOVO model: LNVNB161216 v: SDK0J40709 WIN
    serial: <superuser required> UEFI: LENOVO v: FCCN13WW date: 06/29/2020
  ID-1: BAT0 charge: 25.7 Wh (69.1%) condition: 37.2/45.0 Wh (82.6%)
    volts: 11.6 min: 11.4 model: SMP L19M3PF7 status: discharging
  Info: 8-core model: AMD Ryzen 7 4800H with Radeon Graphics bits: 64
    type: MT MCP arch: Zen 2 rev: 1 cache: L1: 512 KiB L2: 4 MiB L3: 8 MiB
  Speed (MHz): avg: 1774 high: 2900 min/max: 1400/2900 boost: enabled
    cores: 1: 1400 2: 1400 3: 1400 4: 1400 5: 2900 6: 2900 7: 1397 8: 1400
    9: 2900 10: 2900 11: 1400 12: 1400 13: 1397 14: 1397 15: 1400 16: 1395
    bogomips: 92628
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
  Device-1: NVIDIA TU117M [GeForce GTX 1650 Ti Mobile] vendor: Lenovo
    driver: nvidia v: 515.76 arch: Turing bus-ID: 01:00.0
  Device-2: AMD Renoir vendor: Lenovo driver: amdgpu v: kernel
    arch: GCN-5.1 bus-ID: 05:00.0
  Device-3: IMC Networks Integrated Camera type: USB driver: uvcvideo
    bus-ID: 1-3:2
  Display: wayland server: X.Org v: with: Xwayland v: 22.1.3
    compositor: gnome-shell driver: gpu: amdgpu resolution: 1920x1080~120Hz
  OpenGL: renderer: AMD RENOIR (LLVM 14.0.0 DRM 3.47
    5.19.16-200.fc36.x86_64) v: 4.6 Mesa 22.1.7 direct render: Yes
  Device-1: NVIDIA driver: snd_hda_intel v: kernel bus-ID: 01:00.1
  Device-2: AMD ACP/ACP3X/ACP6x Audio Coprocessor vendor: Lenovo
    driver: N/A bus-ID: 05:00.5
  Device-3: AMD Family 17h/19h HD Audio vendor: Lenovo
    driver: snd_hda_intel v: kernel bus-ID: 05:00.6
  Sound Server-1: ALSA v: k5.19.16-200.fc36.x86_64 running: yes
  Sound Server-2: PulseAudio v: 15.0 running: no
  Sound Server-3: PipeWire v: 0.3.59 running: yes
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: Lenovo driver: r8169 v: kernel port: 2000 bus-ID: 03:00.0
  IF: eno1 state: down mac: <filter>
  Device-2: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter
    vendor: Lenovo driver: ath10k_pci v: kernel bus-ID: 04:00.0
  IF: wlp4s0 state: up mac: <filter>
  Device-1: Qualcomm Atheros QCA61x4 Bluetooth 4.0 type: USB driver: btusb
    v: 0.8 bus-ID: 3-3:2
  Report: rfkill ID: hci0 rfk-id: 3 state: down bt-service: enabled,running
    rfk-block: hardware: no software: yes address: see --recommends
  Local Storage: total: 476.94 GiB used: 200.69 GiB (42.1%)
  ID-1: /dev/nvme0n1 vendor: Toshiba model: KBG40ZNT512G MEMORY
    size: 476.94 GiB temp: 31.9 C
  ID-1: / size: 475.35 GiB used: 200.37 GiB (42.2%) fs: btrfs
    dev: /dev/nvme0n1p3
  ID-2: /boot size: 973.4 MiB used: 313.6 MiB (32.2%) fs: ext4
    dev: /dev/nvme0n1p2
  ID-3: /boot/efi size: 598.8 MiB used: 13.9 MiB (2.3%) fs: vfat
    dev: /dev/nvme0n1p1
  ID-4: /home size: 475.35 GiB used: 200.37 GiB (42.2%) fs: btrfs
    dev: /dev/nvme0n1p3
  ID-1: swap-1 type: zram size: 8 GiB used: 0 KiB (0.0%) dev: /dev/zram0
  System Temperatures: cpu: 42.2 C mobo: N/A gpu: amdgpu temp: 41.0 C
  Fan Speeds (RPM): N/A
  Processes: 439 Uptime: 35m Memory: 15 GiB used: 4.44 GiB (29.6%)
  Init: systemd target: graphical (5) Compilers: gcc: 12.2.1 Packages: 92
  note: see --rpm Shell: Bash v: 5.2.2 inxi: 3.3.21


I installed Input Remaper following their instructions for manual to remap AltGr + n and AltGr + N.

To avoid using sudo pip I used for the first two lines of the installation:

yum install python-devel python-pip gcc
yum install kernel-headers-$(uname -r)

But I couldn’t find a way for the third line…

The remapping actually works but “ñ” is not included as a recognized symbol so I tried to follow their instructions on emitting unavailable symbols but they don’t work for me (I guess because I’m using Fedora?), it just won’t write anything… When I change it to spanish it actually works so I thought maybe if I set the mapping to:

modify(Super_L, key(space)).wait(150).

it would do it but it doesn’t, neither with ntilde instead of odiaeresis. The first line is not actually changing the input source, instead it adds a space (that’s the reason of the BackSpace in the second line).

Funny fact: I started writing this reply as the answer because I thought for about half an hour that I did it but while writing I noticed that the symbols were all changed and that it was actually configured to Spanish :sweat_smile:

1 Like

Ok, the answer to my problem was actually easy… So easy that I feel a bit ashamed, haha! Is was just Settings → Keyboard and in Input Sources changing the keyboard layout to German (dead tilde) and now I can press AltGr + “+” and I get ~ to compose ñ…

Should I mark this as the solution, erase the question or what? I’m a bit confused, since the question was somehow answered with the different tools that didn’t work for the specific character Ñ and the answer I found is actually not answering the question I posted…

1 Like

Yes, mark that as the solution. Leaving the thread & question with a solution helps the next user.

1 Like