How can I customize my keyboard layout on NixOS without admin access?

0
2
Asked By MellowPine42 On

I'm using NixOS with X11 and don't have administrator privileges. AltGr is working, but some of the characters it produces aren't useful to me, such as º and ª, and I'd like to replace them with a custom set of characters like {, [, ], and @. What's the right way to change these key mappings using only files or tools available in my home directory?

2 Answers

Answered By BrightCedar19 On

If you only have access to your home directory, system-wide keyboard configuration files may be off-limits, but an X11-level remapping should still work for your own session. Keep the custom configuration in your home directory and load it when your graphical session starts.

Answered By CloudyMarten7 On

You can do this with xmodmap, and it normally doesn’t require root access. First, export your current mappings with `xmodmap -pke > new_config`. Edit the resulting file, changing the symbols assigned to the relevant keycodes. For example, each line may look like `keycode 38 = a A a A ae AE ae`; the first entries represent the key by itself and with Shift, while later entries cover modifier combinations such as AltGr. After editing it, apply the layout with `xmodmap new_config`. You can place the command in your X session startup, such as `.xinitrc`, so the mapping is loaded automatically.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.