• You are not logged in.

DreymaR's Big Bag of Keyboard Tricks (Linux/XKB files included)!

  • Started by DreymaR
  • 367 Replies:
  • Reputation: 0
  • Registered: 06-Oct-2020
  • Posts: 6

I'm a long time Colemak user that accidentally stumbled into the dh/extend/wide rabbit hole whilst trying to find Colemak friendly vim setups.

After a test drive, I was very impressed with what they offer over vanilla Colemak, so I've been trying/failing to make them a permanent part of my setup ever since. 

Desired mods:

-PC105-Curl(DH)AngleWide
-local variants: gb, es
-Extends, ralt_switch_lock

System:
Ubuntu 20.04 LTS
Keyboard: ISO/pc105

What I've done so far:

Followed this guide to the letter:

Point-by-point example: System install for Debian/Ubuntu and many other distros:

1. Download/unzip/clone the BigBagKbdTrixXKB dir to, say, your home desktop (~/Desktop)
2. Open a terminal window and go there, e.g.: cd ~/Desktop/BigBagKbdTrixXKB
3. To install/activate: sudo bash ./install-dreymar-xmod.sh -ox
4. See XKB Configuration step below and edit /etc/default/keyboard to make startup changes persistent
5. Reboot the system (to be on the safe side; may not be necessary)
6. Select your layout such as English(Colemak[Ed], Curl-DH ergo) from dropdown top-right menu (Ubuntu) or settings → keyboard

Used

sudo nano /etc/default/keyboard

and

sudo gedit /etc/default/keyboard

to update the config.   The changes persist in the config file on reboot but have no effect on the active layout. 

Ran this setxkbmap command, which initially activated the mods, now it produces no change in the active layout (see error message below)

setxkbmap -model pc105awide-sl -layout gb,es -variant cmk_ed_us,cmk_ed_us -option lv5:ralt_switch_lock,misc:extend -v 9

Gives me the following:

More than one keyboard model on command line
Using "pc105awide-sl", ignoring "pc105awide-sl"
More than one keyboard layout on command line
Using "gb,es", ignoring "gb,es"
More than one layout variant on command line
Using "cmk_ed_us,cmk_ed_us", ignoring "cmk_ed_us,cmk_ed_us"
Setting verbose level to 9
locale is C
Warning! Multiple definitions of keyboard model
         Using command line, ignoring X server
Warning! Multiple definitions of keyboard layout
         Using command line, ignoring X server
Warning! Multiple definitions of layout variant
         Using command line, ignoring X server
Trying to load rules file ./rules/evdev...
Trying to load rules file /usr/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules:      evdev
model:      pc105awide-sl
layout:     gb,es
variant:    cmk_ed_us,cmk_ed_us
options:    setxkbmap,lv5:ralt_switch_lock,misc:extend,lv5:lalt_switch_lock,misc:extend

Trying to build keymap using the following components:
keycodes:   evdev+aliases(qwerty)
types:      complete
compat:     complete
symbols:    pc+gb(cmk_ed_us)+es(cmk_ed_us):2+inet(evdev)+level5(ralt_switch_lock)+extend(basic):1+extend(basic):2
geometry:   pc(pc104)

Ran this command from /BigBagKbdTrixXKB-master

./setxkb.sh -a 5cw gb es

Produces "command not found"

Excuse the long winded first post, but thank you for taking the time to have a look.

Last edited by primetime (06-Oct-2020 19:47:12)
Offline
  • 0
  • Reputation: 149
  • From: Oslo, Norway
  • Registered: 13-Dec-2006
  • Posts: 5,007

Welcome! Sorry if it's a mess, one problem is that different distros have different strokes. So yes, unfortunately the /etc/default/ stuff doesn't always work anymore.

Your setxkbmap command looks fine, except you need to use quotes around "gb,es" and all the other option strings I think. That's what those "more than one" warnings are about. Why the geometry is wrong is beyond me.

The setxkb.sh command also looks okay, so it puzzles me that you'd get a "command not found" from it. Did you make sure with a 'ls' that you were in the right place? The reason I have that ./ in the start of it is to make sure it's interpreted as a command, you could also try 'bash setxkb.sh <args>'.

Wait... that setxkb.sh command is patently not okay. You've told it to run the "es" variant of the "gb" layout which doesn't exist. I don't remember if that script handles multiple layouts, but try it with "gb,es" "us,us" and see if it works. I don't think it will but you might be lucky. If not, you have to use your own setxkbmap command.

The way I prefer to set a layout is to run the setxkb script to produce a command line in ~/.bashrc so the layout gets activated on each startup. If your system doesn't use .bashrc, use another sourced file; the most logical one would be ~/.xprofile if your system uses it.

Best of luck! I'm sure you can make it work soon.  ( のvの) c[_]

Last edited by DreymaR (07-Oct-2020 12:29:26)

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

Offline
  • 1
  • Reputation: 0
  • Registered: 06-Oct-2020
  • Posts: 6

Thanks for the tips, I just might be getting somewhere,

So, I ran the following without language options to be on the safe side

 bash ./setxkb.sh -a 5cw

Appending bash, allowed the command to run successfully.

New issues
On reboot the active layout remains unchanged (vanilla colemak), when I type in the terminal or text editor.  However, once I start typing in firefox url/search bar the layout becomes 5cw with extend (caps lock) system wide.

Launching a terminal gives me:

Error loading new keyboard description
Error loading new keyboard description
Error loading new keyboard description

 

If your system doesn't use .bashrc, use another sourced file; the most logical one would be ~/.xprofile if your system uses it.

  My system is a fresh ubuntu install, from what I’ve gathered online it uses bashrc. Is there a simple way to confirm this?

I’ve attached a pic of my layout, in case it happens to be something other than pc104/105.  It has a few quirks, like the ’pipe + backslash’ next to the ’left shift’,

qw6dTzu.jpg

Last edited by primetime (08-Oct-2020 02:18:45)
Offline
  • 0
  • Reputation: 149
  • From: Oslo, Norway
  • Registered: 13-Dec-2006
  • Posts: 5,007

In your terminal, try a 'setxkbmap -v 9' command if you can, to see what it's trying to do. And check your .bashrc to see what the command at the end is.

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

Offline
  • 1
  • Reputation: 0
  • Registered: 06-Oct-2020
  • Posts: 6

setxkbmap -v 9

Setting verbose level to 9
locale is C
Trying to load rules file ./rules/evdev...
Trying to load rules file /usr/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules:      evdev
model:      pc105
layout:     us,us
variant:    cmk_ed_dh,
options:    lv5:lalt_switch_lock,misc:extend

Trying to build keymap using the following components:
keycodes:   evdev+aliases(qwerty)
types:      complete
compat:     complete
symbols:    pc+us(cmk_ed_dh)+us:2+inet(evdev)
geometry:   pc(pc105)

The active layout was qwerty on startup this morning.

bottom of bashrc

There are 9 lots of these DreymaR's SetXKB.sh settings, for brevity I only included the first two.

##-> DreymaR's SetXKB.sh: Activate layout
setxkbmap -model 'pc105caw-sl' -layout 'gb(cmk_ed_es)' -option 'misc:extend,lv5:caps_switch_lock,grp:shifts_toggle,compose:menu,misc:cmk_curl_dh'
##<- DreymaR's SetXKB.sh

##-> DreymaR's SetXKB.sh: Activate layout
setxkbmap -model 'pc105caw-sl' -layout 'gb(cmk_ed_es)' -option 'misc:extend,lv5:caps_switch_lock,grp:shifts_toggle,compose:menu,misc:cmk_curl_dh'
##<- DreymaR's SetXKB.sh


All your layouts were missing from ubuntu ’Region & Languages‘, so I ran

./install-dreymar-xmod.sh -r 1

followed by:

bash install-dreymar-xmod.sh -ox

which returned them.

The persistent error in terminal is now:

Illegal map name '(cmk_ed_lv5:ralt_switch_lock+misc:extend):' in symbols name 'pc+-option(cmk_ed_lv5:ralt_switch_lock+misc:extend):2+inet(evdev)+group(shifts_toggle)+compose(menu)+level5(caps_switch_lock)+extend(basic):1+colemak(cmk_ed_dh):1+extend(basic):2'

I deleted the surplus settings in bashrc and left

##-> DreymaR's SetXKB.sh: Activate layout
setxkbmap -model 'pc105caw-sl' -layout '-option(cmk_ed_lv5:ralt_switch_lock,misc:extend)' -option 'misc:extend,lv5:caps_switch_lock,grp:shifts_toggle,compose:menu,misc:cmk_curl_dh'
##<- DreymaR's SetXKB.sh

Colemak [eD], curl DH is the active layout.

Thanks

Last edited by primetime (09-Oct-2020 16:50:02)
Offline
  • 0
  • Reputation: 149
  • From: Oslo, Norway
  • Registered: 13-Dec-2006
  • Posts: 5,007

Yeah, I see you'd run the script many times so you had multiple lines in your .bashrc – that would give you errors. Now you've deleted wrongly, take that last one away and either run the script again or use one of the lines you have under "the first two" above.  (✿◠‿◠)

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

Offline
  • 1
  • Reputation: 0
  • Registered: 06-Oct-2020
  • Posts: 6

I followed the instructions and managed to get 5cw to persist on reboot but not extend.  My keyboard tinkering credits are maxed out, so I'll have to call it day on this for the moment but I'll keep an eye on the repo for updates and/or look into kmonad. Anyway, thanks for the responsive support.

Offline
  • 0
  • Reputation: 149
  • From: Oslo, Norway
  • Registered: 13-Dec-2006
  • Posts: 5,007
UPDATE:

• There was a bug in the last commit of the BigBag for XKB ("Extend pointer-enable moved")! It's fixed in the latest commit.
• Also in the latest commit is the new Colemak-DH standard. We have decided to promote DHm (M on the home row) as standard, instead of the DHk one from 2017 (K on the home row). See elsewhere for explanations, for instance the main BigBag topic.

Maybe that's what was amiss with the Extend when you last tried it, Primetime? Try pulling the repo and installing it again?

Last edited by DreymaR (05-Nov-2020 13:27:54)

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

Offline
  • 0
  • Reputation: 1
  • Registered: 26-Dec-2020
  • Posts: 4

Hi!

Is there a way to get the DH(m) mod without changing the AltGr symbols from the default Colemak layout? The original post says that unfortunately it's not as modular and can't be really used separately. I really need those keys for my native language (Spanish), specifically á, é, í, ó, ú, ñ. Am I better off just editing the default Colemak layout and swapping the keys manually?

Also I can't find the reply anymore but I agree with making this layout separate from the default Colemak that comes with most Xorg installations, so that it can be packaged. Just renaming the files is usually good enough as far as I'm aware.

Thanks!

Offline
  • 0
  • Reputation: 1
  • Registered: 26-Dec-2020
  • Posts: 4

I ended up just replacing the keys in from the mods I wanted to use with the default Colemak layout keys. It wasn't too difficult to do, I just had to do some editor magic hehe. I might end up adding extra "cmk" (non "_ed") symbol definitions and making a PR ;)

I'll probably do that once I get comfortable with Colemak though, it'll be my personal challenge to do it all in Colemak :o

Oh and thank you DreymaR for putting together all these mods like this! I just added the wide mod to my setup and I feel like this is the best typing experience I've ever had. I can't wait till I get fast with this

Offline
  • 0
  • Reputation: 149
  • From: Oslo, Norway
  • Registered: 13-Dec-2006
  • Posts: 5,007
SeerLite said:

Is there a way to get the DH(m) mod without changing the AltGr symbols from the default Colemak layout? The original post says that unfortunately it's not as modular and can't be really used separately. I really need those keys for my native language (Spanish), specifically á, é, í, ó, ú, ñ. Am I better off just editing the default Colemak layout and swapping the keys manually?

I don't think the original Colemak AltGr mappings are so good, and my Colemak-eD mappings are far better thought out and more robust as far as I can see. But in EPKL for Windows we now have EsAlt and ItAlt layouts that aren't in the XKB BigBag (yet); these do use AltGr instead of dead keys for the accented letters. Personally I think it's still nicer with the dead keys on your index fingers as per my default EsLat variant, but some may not like that. For now, I'd edit the keys directly in the xkb/symbols/colemak file if I were you, putting the áéíóúñ letters on the AltGr+aeioun positions. These keys are all in the main letter block of Colemak-eD, and they aren't directly affected by the DH mod.

In the symbols/colemak file, under "cmk_ed_letters" and the 4 under "cmk_ed_symbols":

    key <AE04> { [             4,        dollar,       dead_currency,            EuroSign ] }; // 4

    key <AD07> { [             l,             L,               U2039,       guillemotleft ] }; // QWE U Cmk L
    key <AD08> { [             u,             U,                   ú,                   Ú ] }; // QWE I Cmk U - EsAlt
    key <AC01> { [             a,             A,                   á,                   Á ] }; // QWE A Cmk A - EsAlt
    key <AC06> { [             h,             H,           leftarrow,          rightarrow ] }; // QWE H Cmk H
//    key <AC07> { [             n,             N,                   ñ,                   Ñ ] }; // QWE J Cmk N - EsAlt ANSI
    key <AC08> { [             e,             E,                   é,                   É ] }; // QWE K Cmk E - EsAlt
    key <AC09> { [             i,             I,                   í,                   Í ] }; // QWE L Cmk I - EsAlt
    key <AC10> { [             o,             O,                   ó,                   Ó ] }; // QWE ; Cmk O - EsAlt
    key <LSGT> { [             ñ,             Ñ,                  oe,                  OE ] }; // <>          - EsAlt ISO
//    key <AB06> { [             k,             K,              endash,             uparrow ] }; // QWE N Cmk K - ANSI
    key <AD11> { [   bracketleft,     braceleft,           masculine,         ordfeminine ] }; // [{

You'll figure out where those keys go, right? From line 123 onwards. The ones marked EsAlt are the ones you need to get your letters; the others are so as not to lose useful mappings that were on the affected keys before.

Last edited by DreymaR (28-Dec-2020 16:29:33)

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

Offline
  • 1
  • Reputation: 1
  • Registered: 26-Dec-2020
  • Posts: 4

Yeah, I gave it some thought and I think you're right. Using the index finger for the acute accent is fine. I'm gonna be testing the modified latam variant more and see if I get used to it. Thank you again for the mods that allows this!


Now, something unrelated (just realized I didn't check if it had already been done in this thread, I hope this is still useful!):
I took your patch folder and diffed it with the bak folder and added all the changes to a fork of xkeyboard config repo, as best as I could.
This should make it easier to package and solve a lot of problems across distros (I was missing a feature from an updated Arch version and now I have it working!) I hope you like it!

It's here: https://github.com/SeerLite/xkeyboard-config-bbkt :)

I haven't tested everything but I'm 99% sure it all works as expected. It took me a while to figure out because the evdev files are generated from lots of separate files, so I had to apply the patch across all of them.

I've given you access rights in case you wanna change anything. Let me know if you want me to transfer it to your account, I think you'll do a better job maintaining it. (Otherwise you can always edit your original mod repo and ping me if you want the changes applied haha)

Note that this being a direct fork doesn't mean it can be merged with upstream xkeyboard-config. In fact, it will probably never be merged :( The way the mods are put in doesn't conform to the contribution rules at all. Maintaining a close fork with the patches applied is the best we can do (although I'm still figuring out how to do it correctly across older versions).

Next I'm gonna be trying to package it for the AUR. Maybe I learn some other packaging systems from other distros and package it for those too, depending on how hard it is hehe.

Edit: AUR package is here!

Last edited by SeerLite (05-Jan-2021 05:27:44)
Offline
  • 1
  • Reputation: 88
  • From: UK
  • Registered: 14-Apr-2014
  • Posts: 839

Nice work, it makes it easy to see all the additions in that one commit.

It's a shame xkeyboard-config is structured this way; it would make life easier if each of the files like "us", "dvorak", "colemak", etc were replaced by directories, and then mappings could be in separates file within their folders. That would make it much easier to apply changes as you'd just be adding files. Such a change is never likely to happen though.

A small suggestion for DreymaR too, I think the "backup" folder could be named better - as I understand it anyway, it's not really a backup. This confused me when I was first looking at it, I assumed from the name that your existing xkb files were "backed up" in that location. Maybe "original" or "upstream" or something would be a better name?

Using Colemak Mod-DH with some additional ergonomic keyboard mods.

Offline
  • 0
  • Reputation: 149
  • From: Oslo, Norway
  • Registered: 13-Dec-2006
  • Posts: 5,007

Wow, that's great! I've been wondering about how to make my changes more xconfig compatible, but I got lost in the forest of subfiles. I'll look into this when I have time.

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

Offline
  • 0
  • Reputation: 149
  • From: Oslo, Norway
  • Registered: 13-Dec-2006
  • Posts: 5,007

The backup folder is a backup of the original files. The installer actually also makes a backup from the currently installed files. I thought it a good name, but maybe 'originial' is indeed a better name.

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

Offline
  • 0
  • Reputation: 1
  • Registered: 26-Dec-2020
  • Posts: 4
stevep99 said:

Nice work, it makes it easy to see all the additions in that one commit.

Thanks! :) I hope it becomes useful to more people soon. I'm currently trying to package it for Debian but I have to admit it's really hard to do on Arch (especially since I've never used Debian before lol)

stevep99 said:

It's a shame xkeyboard-config is structured this way; it would make life easier if each of the files like "us", "dvorak", "colemak", etc were replaced by directories, and then mappings could be in separates file within their folders. That would make it much easier to apply changes as you'd just be adding files. Such a change is never likely to happen though.

I agree! I think the whole repo is a mess tbh.
I was thinking that maybe it's possible to make a new system/package as a replacement to xkeyboard-config. It'd have nicer organization using directories for everything. This could be done by making a fork of setxkbmap that handles this structure (apart from regular xkeyboard-config). This way mods can easily be installed as distro packages or as files, like you said.
Oh and as a plus, making a GTK standalone tray app as a replacement for the keyboard layout management that comes built in to most DEs (or maybe ask the maintainers of these DEs to also support this system alongside with the current xkeyboard-config) so it integrates nicely with GUI and people don't have to run xkbcomp commands to get it working.

Sounds like a nice project but unfortunately too big for me. XKB also feels more intimidating after patching all these files hehe

Besides Wayland seems to be getting popular now, so maybe the effort isn't worth it and it's a better idea to get this all working on there instead. Speaking of, has anyone gotten the mods working on Wayland yet?

Offline
  • 0
  • Reputation: 1
  • Registered: 09-Sep-2020
  • Posts: 7
eater said:

I am very much enjoying this Extend functionality! But I'm having one issue. When I'm using Google Spreadsheets, whenever I hit Caps Lock (which is mapped to ISO_Level5_Shift) it clears the current spreadsheet cell. I have to use these spreadsheets for collaboration at work and I'm getting a reputation as the person who accidentally deletes other people's data.

Is there some other modifier I could map Caps to that would avoid that side effect?

Thanks!

This is still driving me crazy. No reply from Google about it, of course.

Offline
  • 0
  • Reputation: 1
  • Registered: 09-Sep-2020
  • Posts: 7

OK, I've got Google Sheets convinced that my Linux laptop caps lock key is actually the Windows key with

sudo setkeycodes 0x3a 125

but I can't figure out a workaround for USB and Bluetooth keyboards, only the built-in one.

Offline
  • 1