• You are not logged in.

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

  • Started by DreymaR
  • 388 Replies:
  • Reputation: 214
  • From: Viken, Norway
  • Registered: 13-Dec-2006
  • Posts: 5,363

You know, I'm having trouble too with this! On my Ubuntu 13.10 (Unity) machine everything works perfectly, but I tried taking the mods to a Debian machine I set up and got exactly the same login problem as you! The patching went fine (just a little offset that I checked was harmless), but then boom finis. Ugh, I wish I knew what's going on here... :(

I had success activating one change at a time with setxkbmap. Then I tried setting an option in the layout GUI and it crashed badly on me. I'm suspecting that GNOME 3 might be the culprit as it overrides the X defaults in a somewhat fishy manner.

You're probably right that it'd be safer to activate the xkb changes after logon? But it annoys me if that's true...

It may be the many ways that xkb configurations are stored: In /etc/default/keyboard, but also in the Gnome gsetting org.gnome.libgnomekbd.keyboard and in xprop -root. And who knows where else or how these affect each other...

Actually, the options are only guaranteed to work on the first group/layout; this is a shortcoming of XKB as it stands. However, looking at 'setxkbmap -v 9' I see that the symbols component says '+level5(caps_switch_lock)+extend(basic):1+extend(basic):2' at the end even though the 'options' component only has 'misc:extend'. So the extend(basic) set is activated for both the first and second groups! This is because of rules I made in the base/evdev rules files.

I shouldn't think that you need the 'no' (Norwegian) layout at all, but maybe a 'pt' (Portuguese) one or something? Wild guess, but there are many choices on the locale list now.

Last edited by DreymaR (17-Feb-2014 12:17:37)

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

Offline
  • 0
  • Reputation: 0
  • Registered: 28-Jan-2014
  • Posts: 1

Hi DreymaR,

I don't see it listed in your bag of tricks, but you seem to have a lot of experience with xkb, so I'll ask -- do you think there is any way to map a pair of letters pressed simultaneously to a modifier key while leaving the individual letters alone?  I have this functionality on my Mac with the "Simultaneous Vi Mode" feature of KeyRemap4MacBook, but I have not figured out a way to get it on Linux.  It opens up a lot of extra mappings on the home row which is nice.  Maybe it would require something with features than xkb though?

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

Well, you can do something like "press one key to select Level5, then the other key's lv5+ mappings are what you want"; that's what my Extend layer is about. Some modifiers in XKB are mapped that way; pressing one lv5:<key>_switch_lock modifier selects lv5 while pressing two of them locks lv5 for instance.

However, making a bunch of these is bound to get you into trouble I fear. You haven't got that many states to play with so I think that my Extend mapping layer is among the most advanced projects around. It has four extra mappings per key, using Shift and AltGr mods. That's quite a lot actually.

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

Offline
  • 0
  • Reputation: 0
  • Registered: 11-Oct-2013
  • Posts: 79
wsha said:

Hi DreymaR,

I don't see it listed in your bag of tricks, but you seem to have a lot of experience with xkb, so I'll ask -- do you think there is any way to map a pair of letters pressed simultaneously to a modifier key while leaving the individual letters alone?  I have this functionality on my Mac with the "Simultaneous Vi Mode" feature of KeyRemap4MacBook, but I have not figured out a way to get it on Linux.  It opens up a lot of extra mappings on the home row which is nice.  Maybe it would require something with features than xkb though?

Are you talking about chording? As in letter+letter to get something else? There's no good current way to do this that I know. The closest way is to use something like at home modifier (AHM), which allows having any key set up to dual as a modifier when held and pressed with other keys (which means you can set up chords). It has a fast type feature that will prevent some accidental keypresses, but the problem is that it's not perfect.

Offline
  • 0
  • Reputation: 0
  • Registered: 07-Apr-2014
  • Posts: 5

Learning a whole new keyboard is too much for me, so I'm trying out your progressive layouts slightly modified to my physically US keyboard used with a french layout - I've been using french keyboards for years.

However, there is a show stopper for me. I have a laptop with both a trackpoint and a trackpad, and the trackpad drives me crazy. When I had applied your patches and rebooted, Ubuntu 13.10 no longer recognised them as separate devices and I couldn't disable the trackpad.

So for the moment I unpatched and just added your colemak file and hacked the rules files and the french file.

Any ideas how I could go about debugging the patches?

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

Oo, that's odd. To be honest, I have no idea why my patches should affect trackpoint/trackpad behavior at all.

On the lighter side of things, your approach works well. Unless/until we figure out the problem you should just stick to that.

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

Offline
  • 0
  • Reputation: 0
  • Registered: 07-Apr-2014
  • Posts: 5

I shall at least try adding the extended layer, or something like it - a number keypad would probably be more useful for me. I might also try out your wide layout mod.

I'll let you know if the problem comes up again.

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

There's a number keypad in the extended layer, but it's on level7-8 which usually means pressing both AltGr and Caps. I'm looking into making a level7 modifier for it. Extend is simple enough to use, as you just add it to your symbols definitions together with a lv5 modifier. See the setxkb.sh script in my tools folder for how to do this without using the GUI settings; I often just run that script from ~/.bashrc instead of using the keyboard settings these days (as I've had some strange crashes with GNOME at least using the settings GUI).

The Wide/Angle mods are similarly activated as keyboard models, as seen in the same script. Actually, that might lead to odd trackpoint behavior as the generic pc104/pc105 models on which they're based probably have no touch devices? Well, just try it out.

Last edited by DreymaR (07-Apr-2014 14:44:06)

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

Offline
  • 0
  • Reputation: 0
  • Registered: 07-Apr-2014
  • Posts: 5

I haven't been experimenting much lately, I haven't tried out the extended layer and I don't think I will. I shall probably modify the Alt-gr layer instead as I don't have much use for all the funny symbols on it. I shan't try the wide layout either because it would take my right hand too far away from the trackpoint on my laptop - that said, the idea is good.

I have however been fiddling with the different Tarmak levels because on levels 3 and 4 typing "po" is awful especially as I tend to use my ring finger for "p". So I've made myself a level 3 that puts the "rsdp" keys in place instead and puts "j" temporarily under the right pinkie. I shall probably go straight on to the full colemak after that. I have also added € to the "e" key on lv3, which is missing for us Europeans.

I like the numbers being on level 2 as on a typical french keyboard, that way there is plenty more space for symbols on level 1 - of course it is pretty horrible to get used to and longer numbers are less easy to type. I'm rather considering putting a number pad in level 3 near the Alt-gr key for easy one handed access. That would potentially free up a lot of space on level 2.

In your installation script you have a couple of udevadm commands to get the system to refresh its keyboard layouts. It never worked for me. Sometimes the changes weren't even incorporated after a full reboot. I found I often had to delete the contents of /var/lib/xkb/ for my edits to be taken into account. I'm running Ubuntu 13.10

Do you know of a french forum for variants of the colemak layout? I'd like to post my mods there.

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

Haha, you should read up on the latest developments on Tarmak; it should amuse you. Interesting observation about the 'PO/OP' bigram; it's probably another nail in the coffin of the Tarmak3(ETO) step in favor of Tarmak3(ETS)!

If you wish, you could remodel my extend file for use with a lvl3 modifier (such as AltGr). Then you'll have to remove two of the 'NoSymbol' entries for each key in the symbols/extend file – I think it'd be safe to search-replace as I've been consistent ttbomk. Then you'd activate extend as before but use a lvl3 modifier for it. As an added bonus, you'd get the keypad layer on the old lvl5 modifier should you wish to. Navigation on AltGr and keypad on Caps – sounds nifty.

I'll probably rewrite that udevadm part as I suspect it of messing up some systems. When I get around to it. And yes, you'll have to remove the .srv files for the changes to take which is an interesting quirk. My script used to do that but with the udevadm commands it wasn't necessary anymore. Guess I'll put that back too.

You're using the French (keep local symbols) Colemak then, I hope? That keeps the symbol keys as in the default French layout. If you need to keep them as in another French layout, it's easy to edit the symbols/fr file include.

There's no French Colemak forum to my knowledge, and Colemak probably isn't big enough to support one? So I'd post the mods in this forum if I were you, because the new French users will probably come here.

*** 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

just upgraded to 14.04

and as per every upgrade its beggared my keyboard up

so i delve back into the infamous patch and it doesn't work - agony all over again

so cue hours of manual cut and pasting

there has to be a better way!

i'm definitely never upgrading ubuntu again ;-)

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

Yes, these are rough times. I recommend using the changed files instead of the patch for now. My next download will likely use those instead of a diff patch anyway. And I think rebooting is safer than the udevadmin command.

I think there's some problem with the current GNOME at least. The whole layout mapping scheme has become too byzantine.

Last edited by DreymaR (19-May-2014 09:01:40)

*** 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

@dreymar

which are the changed files? are they in your zip file?

I agree, just copying in a set of changed files would prob be a lot easier, e.g. replacing the existing ones as opposed to trying to patch them

all after making a backup copy of the xkb dir of course (made that mistake once and only once a few upgrades ago)

the best bit was rebooting after the upgrade and not being able to type the password to log in, had it reverted to qwerty? had it just lost the wide angle mods? etc. etc. the only way to find out was protracted semi-informed semi-lucky blind guessing..

the real solution to all this is to sweet talk someone at ubuntu to include the dreymar mods, tarmak, wide angle etc. in the same way that someone has seen fit to include colemak as standard - the wide angle mods are so good and they benefit all layouts i can't see any reason why they shouldn't be included. There needs to be a separate dialog in the settings->keyboard to specify geometry as opposed to layout ideally

then it would all just work straight out of the box - heaven..

Last edited by bph (19-May-2014 11:48:09)
Offline
  • 0
  • Reputation: 11
  • Registered: 06-Jun-2013
  • Posts: 560

i think what i may do is copy the xkb dir from my other laptop, currently running 13.10 and working fine and just drop it into my 14.04 laptop and see what happens

when upgrading the 13.10 to 14.04 i'll back up the xkb dir *before* doing the upgrade as opposed to before running the patch, then i can just copy it back in place and hopefully everything will work as per normal

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

What you want is the xkb-data package for Ubuntu. If you refresh that, all my changes should be gone apart from a few harmless files such as xkb/symbols/colemak.

However, I'm worried that the settings may get borked. I'm trying to figure out the ins and outs of layout choosing in the different distros with gsettings and all, but it's complex.

Last edited by DreymaR (20-May-2014 10:11:40)

*** 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

weirdly my laptop decided it wanted another go at installing 14.04 yesterday and halfway through the process it came up with a dialog box asking what layout (geometry?) I was using, unfortunately the wide-angle wasn't there but there were loads of others like kinesis, typematrix, microsoft ergo etc.

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

right - back on track now, copied the xkb dir over from my other laptop and I now have the wide-angle mods back, colemak and only a few probs with some symbols that I will fix soon

So my top tip is back up the xkb dir before an upgrade and copy it back after

This works almost correctly and is a *large* improvement over patching post upgrade

its nice to be able to use my laptop again..

Offline
  • 0
  • Reputation: 0
  • Registered: 25-Jul-2014
  • Posts: 2

Hi!

I've tried to enable extend mode but I've failed.
I'm using xbuntu 14.04. I've copied your files from "xkb-mod-140128-ub1310".
Here is what I get:

mat@ubuntu:~$ setxkbmap -model pc -layout us -variant cmk_ed_us -option lv5:caps_switch_lock,misc:extend -v 9
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
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:      pc
layout:     us
variant:    cmk_ed_us
options:    lv5:caps_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_us)+inet(evdev)
geometry:   pc(pc104)

Colemak is working good. Only ext mode is not working.

Thanks for help!

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

Huh, that looks right up to the symbols component; there you should've had the extend and caps_switch symbols. How is your rules file working? In the GUI menus for the keyboard setup, can you see for instance tarmak if you search for colemak?

If you copied the files manually, you may have to purge the x server files (see the main topic). But I don't think it should be necessary in this case.

I see that in my setxkbmap script I've enclosed each entry in quotes, like this: -option "misc:extend,lvl5:caps_switch_lock". Maybe that's a good idea. But it looks okay from the verbose description.

I'll look into it. I was about to set up an Ubuntu virtual machine, better get cracking...!

Last edited by DreymaR (25-Jul-2014 22:01:57)

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

Offline
  • 0
  • Reputation: 0
  • Registered: 25-Jul-2014
  • Posts: 2

I've tried enclosing each entry in quotes. It doesn't work. I will try to reinstall the whole thing. Maybe I did not copy some files.

thanks for helping :)

----EDIT-----

I've reinstalled whole bag and now its working :). Thx for such a great mod. My wrist and I are thanking you.

Last edited by hakujewas (28-Jul-2014 08:20:35)
Offline
  • 0
  • Reputation: 11
  • Registered: 06-Jun-2013
  • Posts: 560

my god - it is agony every single time no matter what you back up

every time it breaks in a subtly different way on ubuntu upgrade

i hate it with a passion - such a waste of time

every single time..

(note this is a rant against the ubuntu upgrade process not dreymars stuff - in fact his downloadable xkb dir has saved the day)

Last edited by bph (29-Aug-2014 14:51:51)
Offline
  • 0
  • Reputation: 23
  • From: Belgium
  • Registered: 26-Feb-2008
  • Posts: 482

You can mark the modified file(s) "immutable" (chattr +i), so the packager or upgrade process can't overwrite them.

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

I'm suspecting that file ownership issues play a big part in the troubles encountered. I've stopped using 'gksu nautilus' as I've heard that 'gksudo' albeit nearly the same command plays better with ownership. If the xkb files change owner or permissions you may be in big big trouble.

I was worried for a while that something was wrong in my files somewhere, causing crashes. I don't think that's the case anymore – I certainly hope not. At any rate, a poorly made xkb file shouldn't crash anything but simply make that layout setting fail. I've certainly had my share of those during development!

Using setxkbmap you can actually avoid overwriting system files quite simply: The command is set to first look for a rules file from the current directory, and if that fails it'll search the default location! This means that you could make a copy of the xkb files from your system, copy/replace my files into that new copy, set the copied xkb directory as your pwd and run setxkbmap! You won't get the GUI changes that way but at least it's very safe! And of course, you can have a little script that runs setxkbmap from your xkb dir every time you log on.

The big challenge for me has been to find a way of making my changes installable with system GUI and everything, while also allowing for a less intrusive way. I think this may be it!

Last edited by DreymaR (31-Aug-2014 14:56:52)

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

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

Hi DreymaR, I have a question that fits into your "big bag of tricks" knowledge, I hope! I could not find it in the AHK site or on SourceForge.... I have a custom made layout. On my Linux machines, I have made xkb files, works great. But I also work on a Windows machine (edit: I have no admin rights on that machine, if it matters). I want to make a Windows pkl for it. How do I make that custom pkl?

Is it basically a remap in autohotkey? Also, how would I change a pkl layout (say, Dvorak) and change it into my custom layout?

Thanks! :-)

Last edited by pieter (01-Sep-2014 19:01:22)
Offline
  • 0
  • Reputation: 214
  • From: Viken, Norway
  • Registered: 13-Dec-2006
  • Posts: 5,363

For that, you should've asked in the sister topic in my signature – that's dedicated to PKL. Also, did you read that topic and look at my pkl download?

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

Offline
  • 0