• You are not logged in.

    DreymaR's XKB Mod for Linux

    • Started by IQubic
    • 3 Replies:
    • Reputation: 0
    • Registered: 11-Sep-2015
    • Posts: 23

    Hey Y'all I would like to ask a question. Is there a way to replace CapsLock with backspace for all layouts?

    Offline
    • 0
    • Reputation: 0
    • Registered: 11-Sep-2015
    • Posts: 23

    Also, I want the name of this thread changed to be "Help with XKB"

    Offline
    • 0
    • Reputation: 2
    • Registered: 25-Oct-2013
    • Posts: 136

    If you want to change layouts in xkb, you need to modify the file. Let's say your layout is called "en".  Then usually that file is /usr/share/X11/xkb/symbols/en   Just open the file in an editor; do this as root, so first su - sudo won't always do the trick. Modify, save, exit root, and run it (setxkbmap -layout en)

    If you want to change capslock to backspace in all your layouts, you have to modify all these files. But - how many layouts do you use? Two? Three?  If you *must* you could also use a script to change capslock to backspace globally, for Linux you could use autokey.

    Offline
    • 0
    • Reputation: 210
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,343

    There is a way, and it's simpler than you think. :-)

    In XKB, modularity is appreciated. So while CapsLock key behaviour may be described in layouts, it's really more useful to use options for that! And one behaviour will overwrite the existing one (meaning that if your layout sets a key wrongly for you, you can activate something that sets it straight). So, looking in the xkb/rules/base.lst file you see this:

      ctrl:nocaps          Caps Lock as Ctrl
      ctrl:swapcaps        Swap Ctrl and Caps Lock
    [...]
      caps:numlock         Make Caps Lock an additional Num Lock
      caps:swapescape      Swap ESC and Caps Lock
      caps:escape          Make Caps Lock an additional ESC
      caps:backspace       Make Caps Lock an additional Backspace
      caps:super           Make Caps Lock an additional Super
      caps:hyper           Make Caps Lock an additional Hyper
      caps:shiftlock       Caps Lock toggles ShiftLock (affects all keys)
      caps:none            Caps Lock is disabled
      caps:ctrl_modifier   Make Caps Lock an additional Ctrl

    Thus, to get Caps as Ctrl one of these should do the trick:

    setxkbmap -option 'ctrl:nocaps'
    setxkbmap -option 'caps:ctrl_modifier'

    Not sure why there seems to be overlapping possibilities. Try both and see if they do the same or, if not, which one works the expected way.

    Or, set this option in your keyboard settings GUI if you have a decent one in your distro. Or, use the gsettings/dconf-editor (but beware, gnome settings are a bit finicky).

    Last edited by DreymaR (20-Jan-2016 10:54:10)

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0