• You are not logged in.

    Help with Linux XKB

    • Started by bph
    • 7 Replies:
    • Reputation: 11
    • Registered: 06-Jun-2013
    • Posts: 560

    Hi,

    If my desired layout can be specified as:

    $ bash setxkb.sh '5ca gb ks'

    resulting in show-xkb.sh output:

    ••• DreymaR's Show XKB info script (by GadOE, 2014) •••
    
    
    ••• Output from 'xprop -root | grep "XKB"': •••
    
    _XKB_RULES_NAMES(STRING) = "evdev", "pc105angle", "gb(cmk_ed_ks)", "", "misc:extend,lv5:caps_switch_lock,grp:shifts_toggle,compose:menu,misc:cmk_curl_dh"
    
    ••• Output from 'gsettings list-recursively org.gnome.libgnomekbd.keyboard': •••
    
    org.gnome.libgnomekbd.keyboard layouts @as []
    org.gnome.libgnomekbd.keyboard options @as []
    org.gnome.libgnomekbd.keyboard model ''
    
    ••• Output from 'setxkbmap -print': •••
    
    xkb_keymap {
    	xkb_keycodes  { include "evdev(pc105angle)+aliases(qwerty)"	};
    	xkb_types     { include "complete"	};
    	xkb_compat    { include "complete"	};
    	xkb_symbols   { include "pc+gb(cmk_ed_ks)+inet(evdev)+group(shifts_toggle)+compose(menu)+level5(caps_switch_lock)+extend(basic)+colemak(cmk_ed_dh)"	};
    	xkb_geometry  { include "pc(pc105angle)"	};
    };

    What would my

    /etc/default/keyboard

    file have to look like to represent the same setup?

    It currently looks like this:

    XKBMODEL=pc105angle
    XKBLAYOUT=gb,gb
    BACKSPACE=guess
    XKBVARIANT=,cmk_ed_dh

    I'd rather set my keyboard file directly as using the setxkb.sh mucks up having multiple keyboard layouts available as drop-down options top right of screen in ubuntu

    That keyboard file (I think) represents two available layouts, a qwerty one and a colemak-dh one.

    In a perfect world I'd have the qwerty on a pc105 layout and the colemak-dh on pc105angle. Is that even possible?

    Note that using the setxkb script seems to break things a little bit, i.e. after executing it I can no longer C-x C-f to open a file in emacs, I get an error:

    C-x <XF86Back is undefined
    Last edited by bph (24-Sep-2021 17:21:16)
    Offline
    • 0
    • Reputation: 11
    • Registered: 06-Jun-2013
    • Posts: 560

    Investigating a bit further, I'm thinking I'd like to add something like this from evdev.lst:

    cmk_ed_ks       gb: English (UK, Colemak[eD], keep local symbols)

    but for colemak-dh:

    cmk_ed_dh       us: English (Colemak[eD], Curl-DH ergo mod)

    I sort of need:

    cmk_ed_dh       gb: English (Colemak[eD], Curl-DH ergo mod)

    Then I could set up my keyboard layout from the Ubuntu Settings->Language & Region dialog box

    Feel like I'm getting a bit closer, but possibly need a bit of a steer to implement it?

    Last edited by bph (24-Sep-2021 16:12:31)
    Offline
    • 0
    • Reputation: 11
    • Registered: 06-Jun-2013
    • Posts: 560

    Is the advice to loading a colemak layout to add a call to setxkb.sh in your .bashrc file?

    seems sub optimal as you have to open a term to get the layout loaded, you have to enter your root pwd (and for every additional term you open) and the script automatically closes the term.

    I think I'm missing something here...

    the only way I can get the layout I want currently is running:

    source setxkb.sh '5ca gb ks'

    I can't get the equivalent layout using the ubuntu settings -> language dialog

    Theres got to be another way right?

    Offline
    • 0
    • Reputation: 23
    • From: Belgium
    • Registered: 26-Feb-2008
    • Posts: 482

    Put it in your .xsession, it is run at the start of your X11 session.
    (don't forget to make it executable)

    Offline
    • 0
    • Reputation: 11
    • Registered: 06-Jun-2013
    • Posts: 560

    cheers ghen, will give that a try.

    Do you know how to get setxkb.sh to output the setxkbmap command so I can put that in my .xsession instead - seems a bit cleaner that way?

    I tried combinations of the -a and -f options but they didn't seem to do anything.

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

    If you're hell-bent on avoiding setxkbmap, then no, I don't think you can use multiple models with multiple layouts. This is one reason that's not included in my scripts. You'd have to make changes to the symbols/colemak file, baking the ergo mod into the layout so it'd work with the normal pc105 model.

    However, if you could live with setxkbmap after all, I'd make aliases to commands that switch both model and layout at once for you. Also, your /etc/default/keyboard file there doesn't give you Extend as that's an -option.

    I wouldn't source setxkb.sh, but use its option to write a setxkbmap command to a file (yes, it's the -a switch). By default it'll be the ~/.bashrc file as I find that's fairly robustly sourced by most distros, but ideally it should be the ~/.xsession or ~/.xprofile file. Did you look in ~/.bashrc for the command? If you use the other switch you can specify a file instead so you could get it anywhere you want.

    Last edited by DreymaR (26-Sep-2021 15:17:01)

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

    Offline
    • 0
    • Reputation: 11
    • Registered: 06-Jun-2013
    • Posts: 560

    sorry for being a dope here dreymar, but are you saying that if I run setxkb.sh with the -a option then an appropriate call to setxkbmap gets tagged on to the end of my .bashrc file? The other switch being the -f <filename> one? This should write to file in current directory?

    I'm currently manually running setxkb.sh every time I fire up my laptop.

    One thing I did note is that if you swap keyboard then you have to rerun setxkb

    Have been playing with extend today! On a machine where I'm not currently using emacs so it makes a lot of sense to give it a whirl..

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

    Yes, that's what I'm saying. The -f <filename> switch works in conjunction with -a to specify another file. So that's how I get the setup right at logon.

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

    Offline
    • 0