You may not post on this forum because you're not logged in.

#1 05-Jul-2012 16:19:42

DreymaR
Member
From: Bærum, Norway
Registered: 13-Dec-2006
Posts: 2,628

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

DREYMAR'S (XKB): DreymaR's Extensive Yet Modular AR'Senal (for X KeyBoarding)

[CAVEAT EMPTOR: This work is still under some construction due to its complexity.
Almost all areas are now nicely domitable, but a hard-hat area or two may still be found.]

NOTE: This topic has a sister topic describing my Bag Of Tricks for PKL on Windows. It covers the same topics, but this is the main post as I'm not reposting all info in that other place.

Since I started using Colemak I've been fiddling with it, trying out ideas from the forum and adding a few of my own. Colemak per se is to me only the letter block mappings including the semicolon, including their shifted counterparts (i.e., modifier lv 1-2). I've always ended up with that intact and it has stood the test of time since 2007 for me.

My personal Colemak arsenal now includes several other enhancements:
• New "Colemak[eD]" AltGr mappings (lv 3-4) putting dead keys on AltGr+symbol keys and reworking most other mappings
• An Angle/Wide modification ("AWide-35") to improve wrist angles, hand spacing and right pinky stretch/load effort
• An Extend layer using Caps Lock for its modifier (lv 5-8; "Extend") for navigation from the home position and more
• For several locales, a 'Unified Symbols' layout with only a few necessary locale changes from the standard Colemak[eD];
• Also, a layout to 'Keep Local Symbols' like their default (QWERTY-type) counterparts and key cap markings for that locale
• Access to Cyrillic, Greek and Hebrew letters using layout toggling to intuitive phonetic Colemak layouts
• Access to a mirrored Colemak that allows one-handed typing (I haven't used it much - but if I ever break an arm...!)
• Access to an enhanced set of useful characters via dead key additions (presently only for Windows/PKL)
• The 4 Tarmak transitional Colemak layouts for learning Colemak in smaller steps if so desired

I use Farkas Máté's excellent Portable Keyboard Layout ('PKL') to achieve most of the above for Windows but over the last years I've been using Linux (Ubuntu and others) more and more. So I hacked up a bunch of modifications to the X.Org XKB files. I'm pretty proud of it, I must say! :)

I'll be posting topics for discussing some of the modifications on their own, but here is the whole shebang in one place for Linux users! An advantage with my implementation is that you can pick and choose most of the enhancements as modules: The Wide mod is a keyboard model so it works with any layout you choose (including QWERTY or Dvorak ones) and may be chosen per user; the Extend layer and its switch key are Options and should work with nearly any existing layout; the locale/phonetic, Mirrored and Tarmak options are separate layouts that may use various chooser keys as desired. Freedom of choice through modularity is an ideal in the Linux world.


COLEMAK[eD] - EDITION DREYMAR

(See this forum topic by me)

Update: I've changed this layout slightly since its inception (notably the 2 3 4 V B K M H J L ' keys).
Again, see the main Colemak[eD] topic.

This is my own preferred AltGr mappings (modifier lv3-4 in Linux terminology) for the Colemak layout. I've tried to add much functionality while keeping it intuitive. In particular, I want to be able to write different scripts and tech/maths symbols.

See the xkb/symbols/colemak file for comments and explanations, in addition to these design goals:
- Keeping level 1-2 of Colemak intact! This is what I think of as the Colemak layout per se.
- Dead keys easily accessible as unshifted AltGr+symbol keys; common ones in good positions.
- Added letters/quotes allowing many of the major latin scripts to be written correctly.
- Added symbols/glyphs similar to, e.g., Mac ones - allowing common math/tech/etc typing.
- The positions of added letters and symbols should as far as possible be easy to remember!

   Cmk-ISO-eD-Angle_90d-FingerShui.png
   The Colemak [edition DreymaR] layout, using different lv3-4 mappings from the standard Colemak.
   Shown with the ZXCVB_ 'Angle' ergonomic mod (see below), dead key emphasis and color-coded proposed fingering.

HowTo:
• You can select the various layouts for different locales (see below) that all have my Colemak[eD] mappings, in the standard layout chooser
• I often type 'colemak' or the language name into the search field to narrow down the search
• Alternatively, you may use a 'setxkbmap' terminal command such as 'setxkbmap -layout "us(cmk_ed_us)" -v 9' (see below)
• The mappings with a golden glow in the image above are dead keys


THE ANGLE/WIDE KEYBOARD MODEL MODS

(See for instance this topic by cevgar on Wide mods, and this topic by DreymaR on Angle mods)

These are ergonomic mods, moving some keys around to achieve straight wrists (the Angle mods), as well as better hand separation and right pinky load (the Wide mods). The Angle part is almost a no-brainer to me as it allows the left hand to keep a straight wrist without changing the fingering on ZXCV, and makes B easier to reach. You will need a 102/105-key (ISO) keyboard for it. The ANSI solution is usually to move the Z to the middle which is more dramatic. The Wide mod is more optional, but it does put some load off the right-hand pinky, widen the arm distance (useful for small keyboards in particular, but nice regardless), and provide easier access to AltGr/Enter/Backspace/RShift.

When I use these I like to move the key caps around and make the change global - my family actually don't seem to mind as the changes are fairly intuitive and unintrusive, leastways for the run-of-the-mill keyboard user who looks at symbol key caps to find them. I got used to the changes quickly, too, and I recommend at least an Angle shift if you have an ISO (102/105-key) keyboard! But you can implement the change on a per-user basis if you wish (if you do, take care with your logon dialogs and passwords!).

The Angle/Wide mods are implemented as keyboard models! This means that you can use them with any layout including the QWERTY and Dvorak ones. Modularity at your fingertips, again.

   Cmk-ISO-AWide35_90d-FingerShui.png
   The AngleWide-Slash ('AWide-35') wide keyboard mod for a PC105/ISO keyboard.

I've implemented the ZXCVB_ 'Angle' shift for ISO keyboards both separately and as part of the AngleWide-Slash wide mod (or 'AWide-35', so named because it puts the Slash key with scan code 35 at the Right Bracket position) that I use myself. For ANSI boards there are less perfect options but I've made an implementation of the ZXCVB shift (moving the Z key to the middle) that someone asked for a while back and also a Wide(Quote) mod. If you need an A-Frame or something else, let me know and I'll consider it!

HowTo:
To use these, you might have to edit a file or so (see below under "Installation") unless your distro supports keyboard choice which Ubuntu used to do but doesn't anymore.
Otherwise, 'setxkbmap -model <name>' works on-the-fly.

The xkb ergonomic keyboard model mods are named as following:
• pc104angle-z – ANSI/US Angle mod, putting Z in the old B position
• pc104wide-qu - ANSI/US Wide mod, putting the Quote key in the old Right Bracket position
                         (this can be combined with Angle-Z by editing the keycodes/evdev or xfree86 file)
• pc105angle-lg - ISO/Euro Angle mod, putting <LSGT>/VK_102 in the old B position
• pc105awide-sl - ISO/Euro AngleWide mod, including Angle-LG and putting the Slash key in the old RBr position


EXTEND LAYERS AND THE CAPS SWITCH

This is my favorite mod next to Colemak itself! The ability to navigate and edit from the home position and its immediate surroundings is extremely powerful. It's like having part of the power of advanced editors like Vim ready in all situations. Plus a fully functional multimedia keyboard without sacrificing compactness.

From my source file:

// A modular Extend mapping layer like the one I have in Portable Keyboard Layout for Windows
// - Key names are in /usr/include/X11/keysymdef.h and XF86keysym.h (Removing the XK_ prefix)
// - <FK##> mapped as XF86 Multimedia keys; shifted versions were not implemented in WinPKL
//
// These keys are modified/transposed by holding down the 'extend key' (CapsLock by default):
// +------+------+------+------+------+------+------+------+------+------+------+------+------+
// |Esc + |F1 <> |F2 << |F3 >> |F4 <> |F5 <> |F6 << |F7 >> |F8 <> |F9 <> |F10<> |F11<> |F12<> |
// |      | Pause| Rew  | Fwd  | Eject| Sleep| Bri- | Bri+ | MyCmp| WWW  | Mail | App1 | App2 |
// | Caps | Play | Prev | Next | Stop | Mute | Vol- | Vol+ | Media| Home | Srch | File | Calc |
// +======+======+======+======+======+======+======+======+======+======+======+======+======+
// |` €€€ |1     |2     |3     |4     |5     |6     |7     |8     |9     |0     |-     |=     |
// | Del  | F1   | F2   | F3   | F4   | F5   | F6   | F7   | F8   | F9   | F10  | F11  | F12  |
// +------+------+------+------+------+------+------+------+------+------+------+------+------+
// |Tab   |Q €€€ |W *** |F <<> |P <>> |G *** |J ### |L ### |U ### |Y ### |; €€€ |[ €€€ |] €€€ |
// |      | Esc  | *WhUp| BrBck| BrFwd| *MUp | PgUp | Home | Up   | End  | Del  | Esc  | Ins  |
// +------+------+------+------+------+------+------+------+------+------+------+------+------+
// |Caps+ |A +++ |R *** |S +++ |T +++ |D *** |H ### |N ### |E ### |I ### |O €€€ |' €€€ |\ ><> |
// | ++++ | Alt  | *WhDn| Shift| Ctrl | *MDn | PgDn | Left | Down | Right| Back | Menu | BrFav|
// +------+------+------+------+------+------+------+------+------+------+------+------+------+
// |Z €€€ |X === |C === |V === |B *** |_ *** |K *** |M *** |, *** |. *** |/ €€€ |Spc € |Entr€ |
// | Undo | Cut  | Copy | Paste| *Bt1 | *MOn | *Bt2 | *Bt3 | *MLe | *MRi | Multi| Enter| Break|
// +------+------+------+------+------+------+------+------+------+------+------+-------------+
// Legend: # Movement; + Modifiers; = GUI edit; * Mouse; <> MultiMedia; € Various commands.

Hitting Caps+<LSGT> (or Shift+NumLock if that's enabled) enables/disables Pointer Mousing; when that's on you may move the mouse pointer with the GD<> keys and use BKM for buttons (or you can use the KeyPad keys as before). My mapped keys go a few pixels at a time so when acceleration is on you may travel quickly around the screen this way. Wheel mousing works but doesn't repeat so you'll have to press many times to scroll a long way.

The multimedia keys are mapped to the F keys (++) as intended but XKB/Linux doesn't necessarily link any actions to their key presses although these days most of the usual multimedia keys are configured as expected; this is done in the Shortcuts settings which can be accessed in Unity/Gnome via the Keyboard settings (or dconf-editor/gsettings to org.gnome.desktop.wm.keybindings for the Window Manager ones and ??? for other categories). You could also use xbindkeys, AutoKey or others to bind whatever you want to these keys.

Using the Settings > Keyboard panel in Unity/Gnome (gnome-control-center keyboard) doesn't work as expected with the Extend mapped keys, since the hotkey will register as a 'Level 5 shift' keypress when you press your Extend key! The trick is to press the modifier(s) before clicking on the shortcut you want to set! Then when 'New accelerator' is showing you press down the final key. I had to do that for the Calculator and Terminal keys (Lv5+<FK12>) as those shortcuts were disabled by default in my Ubuntu install.

   Cmk-ISO-Extend_90d.png
   A symbolic chart of my Extend mappings. Greens, navigation; blue/circled, mousing; orange, multimedia; gray, system/misc.

Holding down AltGr you get a NumPad layer (lv7-8) laid out pretty much like a standard one (but with the top row moved around a bit):

// KeyPad overlay with nav block to the left (lv7):
// +------+------+------+------+------+------+------+------+------+------+------+------+------+
// |` €€€ |1     |2     |3     |4 £   |5 €   |6     |7     |8     |9     |0     |-     |=     |
// | Del  |  !   |  @   |  #   |  $   |  %   |  ^   | KP_7 | KP_8 | KP_9 | KP_* | KP_- | KP_= |
// +------+------+------+------+------+------+------+------+------+------+------+------+------+
// |Tab   |Q ### |W ### |F ### |P €€€ |G     |J     |L     |U     |Y     |;     |[ {   |] }   |
// |      | Home | Up   | End  | Del  |      |      | KP_4 | KP_5 | KP_6 | KP_+ |  (   |  )   |
// +------+------+------+------+------+------+------+------+------+------+------+------+------+
// |Caps+ |A ### |R ### |S ### |T €€€ |D     |H     |N     |E     |I     |O     |' "   |\ |   |
// | ++++ | Left | Down | Right| Back |      |      | KP_1 | KP_2 | KP_3 | K_En |  '   |  \   |
// +------+------+------+------+------+------+------+------+------+------+------+------+------+
// |Z €€€ |X === |C === |V === |B *** |_ *** |K     |M     |,     |.     |/     |Spc   |Entr  |
// | Undo | Cut  | Copy | Paste| *Bt1 | *MOn |      | KP_0 |  ,   | KP_. | KP_/ | Spc  | K_En |
// +------+------+------+------+------+------+------+------+------+------+------+------+------+

Having to hold down both CapsLock and AltGr while entering numbers is hardly ideal. I'd like to use another key (but there are few to spare) and maybe make it a lock instead of a switch modifier (i.e., one you have to hold down). Unsure about that, really. But at least, here it is. Actually, one might construct a level7 modifier by combining level3 with level5.

There may be a need for navigating while entering numbers, but on the other hand KeyPad keys rarely use modifiers. So I moved the nav block from its UNEI arrow cross to the WARS cross familiar to gamers. Number row keys 1-6 are reverted to their lv2-3 symbols since these may be needed for numeric input, as are some other keys; the bracket keys cater for the parentheses in this layer which feels logical to me.

If you're cheeky and dexterous enough to press CapsLock+AltGr+Shift at the same time, you're treated to a set of double-arrow symbols of the kind used in mathematical proofs and more (⇖⇑⇗ ⇐⇔⇒ ⇙⇓⇘), laid out like in one of the preexisting xkb keypad layouts. I thought they might be somewhat handy, but the heavy chording required suits the fact that few need them very often! The single arrows didn't fit in, but at least the four orthogonal ones (←↑↓→) are already there in the lv3-4 Colemak[eD] mappings.

All KeyPad keys are affected by PointerEnable! So if you find the mouse pointer moving around instead of numbers being entered, hit the key to disable pointer mousing (Shift+NumLock or CapsLock+LSGT).

Not sure what to use the open positions for yet. And I still haven't got the Undo/Cut/Copy/Paste keys to work for me despite that tip from Kuglee below. :(

Note:
• The backtick/tilde key to the left of 1 is an extra Del, or you could make it whatever you want to.
• You can do some fancy stuff with this! Try A+4(=Alt+F4) to close programs (add T to close tabs!), T+J/H(=Ctrl+PgUp/PgDn) to switch tabs...

HowTo:
To get the Extend mappings to work in xkb, you need two things:
• Set the 'misc:extend' xkbmap option (see below under "installation"), and
• choose a modifier key to switch to level5; I've added a 'level5:caps_switch_lock' option to use the Caps key.
• There are others to choose from (lsgt, lalt, lwin and rwin) that were already available in xkb; you could even have more than one if you want!
• If you do have the 'Options...' menu (Gnome has it), these options are under the 'Miscellaneous' and 'Level 5' headings.

Update 2014-02-01: I've now managed to make XKB understand the Extend modifier keys (Alt/Shift/Ctrl on the AST keys) fully so you can Ctrl+Shift+Arrow for instance. Great, huh?!? I even got the Undo key to work (but it was hairy!). Even the F keys plus modifiers (Caps+A+4 closes your program) and WheelScroll succumbed to my will eventually.


LOCALE COLEMAK[eD] VARIANTS AND PHONETIC COLEMAK LAYOUTS

See my Locale Variants forum topic for the various locale solutions!

I took off a bit and made quite a bunch of these, heh! I can make more on request or if I'm bored at some point. It'd be nice with feedback from local users as some design decisions are open to debate and depend on actual usage as well as personal preferences.

Here's what I've covered so far, for the most part both with conservative 'keep local symbols' and my preferred 'unified symbols' variants
(On a side note, there are but 11 Dvorak layouts!):
be bg br ca cz de dk es fi fr gb gr il is it latam nl no pl pt ru se us

- The brackets (lvl3-4) and the LSGT key may hold the most common locale-specific keys.
     * The oe/aring special letters may well be replaced; these should also be on dead keys.
     * Furthermore, keys with non-essential mappings (H J K L) are up for grabs if need be.
     * See the colemak_template symbols file for more info on local Colemak[eD] variants.

   Cmk-X-eD-us-awide-sl_mask.png
   The Colemak [edition DreymaR] layout (the standard variant, found in the 'us'/'English' locale).
   Shown with the 'AngleWide-Slash' ergonomic mod (see the 'Angle/Wide' heading).

   Cmk-X-eD-no-usym+dk-awide-sl_crop.png
   The Colemak [edition DreymaR] layout, Norwegian+Danish 'Unified Symbols' variant (mostly like the standard Colemak).

   Cmk-X-eD-no-lsym-awide-sl_mask.png
   The Colemak [edition DreymaR] layout, Norwegian 'Keep Local Symbols' variant (symbols like local key markings).

Please note: The 'Local Symbols' variant for a locale uses symbol mappings from the default locale layout (usually a QWERTY one), which are also the ones normally found on physical key markings on keyboards made for that locale. The letter block, however, is the Colemak[eD] one which may lead to some inconsistencies or faults in lv3-4 mappings. For the most consistent and complete set of AltGr mappings, use the 'Unified Symbols' variants.

For the Greek and Hebrew phonetic variants I merely moved the keys of their default phonetic xkb layouts to a Colemak setup, hardly changing anything else. Ideally, I should be able to define phonetic names for the keys corresponding to Colemak so that other 'phonetic' layouts would work automatically, but I think the XKB way of doing that may be too QWERTY-centric for that to work right now. For Cyrillic, I've used Ghen's excellent Rulemak which under my xkb patch is found under 'Russian (Colemak, phonetic Rulemak)'. Of course it isn't for Russians only, but that's how xkb likes to sort things. There's also a Bulgarian variant now. Let me know how that works out?!

   Cmk-X-phon-gr-awide-sl_mask.png
   The Colemak phonetic layout for Greek, simply moving around the keys of the default (here xkb) Greek layout.

HowTo:
You can select any layout from the normal layout chooser – enter your language in the search field to narrow it down. There are three types:
• "Unified symbols" (cmk_ed_us) layouts, using the US-like symbol mappings that I recommend; these give the full Colemak[eD] experience
• "Keep local symbols" (cmk_ed_ks) layouts, if you don't want to change the symbol mappings from your locale but just the letter keys (and semicolon)
• "Colemak, phonetic" layouts, for the non-latin scripts as described above
• Using command line or default file, the Cmk[eD] layouts are called 'lo:cmk_ed_us' and 'lo:cmk_ed_ks', where 'lo' is the locale code ('se' for Swedish for instance)
• The phonetic layouts are called 'ru:colemak', 'bg:colemak', 'gr:colemak' and 'il:colemak'.


ENHANCED DEAD KEY MAPPINGS

For some reason, the Stroke dead key is still broken in my XKB. Gotta get that fixed soon (maybe it'll be my first Linux bugfix unless someone beats me to it). Furthermore, I'd like to add more mappings that feel intuitive to me such as superscripts on the acute accent key and subscripts on the grave accent key.

Some dead keys are almost empty: The doubleacute only caters for ő ű, and ring only caters for å ů ẘ ẙ. There's also a whole iota dead key that only concerns itself with Greek characters. I'm tempted to stuff something good into those cracks even if it's not an entirely logical thing to do (because the name of the dead key wouldn't reflect these extra mappings). If you use up a key mapping on a dead key it really shouldn't sit there taking up keyboard space for the meager purpose of providing 2-3 glyphs!

Update 2012-08-06: I think it's about the locales. The big en_US.UTF-8 Compose file has the dead_stroke key defined (and lots of other goodness!) so I should find out how to get that then. Defining my own ~/.XCompose file apparently involves setting the xim input method as the active one instead of a hard-compiled GTK one my Ubuntu must be using now I guess. It's a bit complex it seems... :o I'll be back on this issue when/if I find out more!


MIRRORED COLEMAK

Advanced typing is possible with only one hand given a modicum of familiarity with the mirroring method. In fact, this paragraph was written entirely using the left hand with the exception of the mirroring key itself, with hardly any training! The brain is inherently good at mirroring things.

I think the Colemak is a very good layout for this kind of one-handed typing: It scores well on home-row usage, finger load balance and same-finger digraph avoidance, and it doesn't focus overmuch on hand alternation which could lead to same-finger digraphs when mirror-typing (Dvorak has lots of hand alternation; it also has separate right-hand and left-hand variants but then you'd have to learn a new layout).

NOTE: Some adventurous souls might want to try the mirrored Colemak as a main layout?
     (They say it's more similar to Dvorak that way.) However, it's meant for one-handed typing.
     To use it as a standalone layout, you'll want to take out the remapping of special keys.

On XKB: Using a Group setup, add the mirrored Colemak[eD] as your next layout group.
     Then you may choose between a slew of "key(s) to change layout (while pressed)" options!
     This does compromise your group options a bit (if you need to use non-latin layouts etc).
     If that bothers you, consider using both 'next' and 'last' layout groups with chooser keys.
     Use Ubuntu: 'Keyboard Layout'->'Options'->'key(s) to change layout (while pressed)'.


   Cmk-ISO-MirrorOn-Angle_90d-FingerShui.png
   The Mirrored Colemak layout, which should be good for right-handed typing (the Angle mod is recommended for this)


   Cmk-ISO-MirrorOn-AWide35_90d-FingerShui.png
   The Mirrored Colemak layout with the AngleWide-Slash mod (see the Wide mod heading); better for left-handed typing

HowTo:
• This is only for English(US) – if you want something else you'll have to edit it in yourself.
• You can choose it in the normal language chooser; it's called "English (Colemak[eD], mirrored)"
• Using command line or default file, the layout is called 'us:cmk_ed_mirror'


THE TARMAK TRANSITIONAL COLEMAK LAYOUTS

There's a main forum topic on this that you may want to read. Basically, I've added four Tarmak layouts that provide stepping stones from the standard (US) English QWERTY layout to the Colemak[eD] layout by moving only 3-4 keys per step. Each step brings at least one important key to the home row (notably, E-T-O-I-R) and only uncommon keys like J and the semicolon are misplaced in the process.

Similar transitional layouts have been reported successful in easing the conversion to Colemak typing and although this evidence is anecdotal I find the proposed hypothesis that gradual changes should be easier to learn for many a plausible one.

User ghaz has provided a set of Tarmak keylayout definition files for the MacOS! Good job, ghaz!
   (Only the older ETOIR step progression)
Also, user BradWright made all the Tarmak steps available for KeyRemap4MacBook. Thanks, Brad!
   (Both old ETOIR and new ETROI progressions)

   Tarmak_Spectral_ETROI.png
   The 5-step Tarmak(ETROI) transitional Colemak layouts, spectrally color-coded from red (Tarmak#1) to violet (Colemak).

Because the XKB doesn't support full modularity practically, these are all based on my standard Colemak[eD](US English) layout with no options for other lv3-4 mappings. They are learning aids anyway, so this shouldn't be much of a problem for most.

HowTo:
• Entering "Tarmak" in the search field in the layout chooser should show the four Tarmak layouts from E (the first) to ETRO (the last step before Colemak)
• Using command line or default file, they're called:
  us:tarmak1_e       English (Tarmak1 - Colemak transitional)
  us:tarmak2_et      English (Tarmak2 - Colemak transitional)
  us:tarmak3_etr     English (Tarmak3 - Colemak transitional)
  us:tarmak4_etro    English (Tarmak4 - Colemak transitional)



DOWNLOAD AND INSTALL

COPYING FILES
I have been using patches (see the next section) up until now, but I think it's simpler and easier to just copy over the changed files (after backing up the old ones).

Here are the original and changed files for the latest xkb version (2.10.1.1). I'm in the process of making a script to make the backup and copying simple. My script will make a backup copy in the X11 directory.

Zipped archives for a few older versions (possibly not updated!) should be available. Also, if you're on another distro or something and want to run a 3-way diff feel free to use the original vs modded files archive; that could also be handy if you haven't got or don't want to use the patch command. You could just plop the modded files into their X11/xkb directories as root, replacing their unmodded counterparts.

PATCHING
Patch files for the X.Org xkb can be found here: drey-xkb-patches-ub1310.zip for Ubuntu 13.04 and 13.10 or other distros using the same xkb-data files; they also work for older versions like Ubuntu 12.04 with just an offset warning. These files were created using Ubuntu Linux but should be good for any distro using the same XKB (and probably others, as there aren't a lot of changes between versions).

I've provided a shell script that uses the patch command ('patch -p1 -i'); you'll need it installed. Then, to install the patch to a fresh XKB folder (back it up first just in case!), start a terminal window and run 'sudo sh instdiff.sh -t -d yymmdd' with the date (e.g., '-d 130518') of the file you want to use. The '-t' tag means it's only a test/"dry" run which I recommend to do first to see if it'll all be successful! Next, run the same command without the '-t' to patch for real. Afterwards, you can use '-r' to reverse a patch should you wish to uninstall the Big Bag from your system.

Remember to back up your xkb directory before messing anything up! You could get it back by reinstalling the 'xkb-data' package but better safe than sorry.


CONFIGURATION

After the files have been modified, a restart may be needed although in my instdiff script I have included a 'trigger' command to udevadm which should take care of business. You may also have to clean out the XKB server cache (/var/lib/xkb/server*.xkm) manually if you didn't use my script.

On Ubuntu using Gnome(?): If you go to the Layout settings, hit '+' to add a layout and type in 'Colemak' you should see a bunch of additions. The Extend option is found under Options -> Miscellaneous Compatibility Options, and you should choose an appropriate lv5 switch for it (I've added a Caps Lock option). If you can't find it, your distro may not have those options visible in the Settings GUI and you may have to do it the command-line, dconf-editor and/or config file way.

The xkb server can get its settings from several places so how your actual settings are determined may be a little confusing! It depends on whether you have Gnome, Unity, XFCE or something else but often the Gnome settings are present. This is what I think I know:
- If a compiled X server file is cached (/var/lib/xkb/server*.xkm), that usually takes presedence (until the udev settings are triggered?)
- The /etc/default/keyboard file should be read at startup to get default keyboard settings; I'm not sure when that happens though (due to the above?)
- The gnome settings ('gsettings list-recursively org.gnome.libgnomekbd.keyboard', or use 'dconf-editor') are important. They can also get messed up...
- (Did these settings use to reside in org.gnome.desktop.input-sources; do they still in some configurations?)
- The root windows has x properties ('xprop -root | grep XKB'). These reflect changes from the default file and setxkbmap.
- The setxkbmap command (see below) can override the above on a per-session basis; you can put it in a startup script if you wish.
- Sometimes on Debian I've experienced trouble with finding the server*.xkm file, and the Gnome settings conflicting with setxkbmap(?). Crashes have occurred.

The available Angle/Wide ergonomic mods are the Euro/ISO/PC-105 board ZXCVB> shift (named 'pc105angle-lg'), the Angle/Wide-Slash mod described above ('pc105awide-sl') as well as the US/ANSI/PC-104 board ZXCVB shift ('pc104angle-z') and Wide(Quote) mod ('pc104wide-qu'). Unfortunately, the current Ubuntu versions have lost the GUI Settings option to switch keyboard models (which I find very odd).

Start a terminal window and use the setxkbmap command to change your keyboard model, like this:

setxkbmap -model pc105awide-sl -v 9

(The '-v 9' is shorthand for '-query -verbose 9' which outputs useful info. You can run setxkbmap with only the '-v 9' switch if you wish.)
In my download archive there's a couple of shell scripts that do this for you.

If you have a non-PC104/PC105-compatible keyboard you might have to do it differently; let me know if you run into trouble.

The setxkbmap command can do more - particularly useful for, e.g., non-Gnome distros or if you like the command line:

setxkbmap -model pc105awide-sl -layout us,no -variant cmk_ed_us,cmk_ed_us \
  -option lv5:caps_switch_lock,misc:extend -v 9

The above example sets up an AngleWide-Slash keyboard with the standard Colemak[eD] layout for US and Norway (both using 'us' unified variants), Extend mode active and Caps as the Extend key. Thanks to Kruppe for this tip! :)

You may include the variants in parentheses, and if you only set the layouts you may omit the switch (see 'setxkbmap -help' for more info):

setxkbmap "us(cmk_ed_us),us(cmk_ed_mirror),fr(cmk_ed_ks),gr(colemak)" -v 9

(This time setting mirrored Colemak[eD] as the 2nd, French "keep local symbols" as the 3rd and Greek phonetic Colemak as the 4th layout)

To make the change persistent between startups, sudo edit the /etc/default/keyboard file. Let's say we want to set up, say, an AngleWide mod, US English Colemak[eD] with group switch to Greek Colemak and an Extend layer with Caps switch (plus standard options like putting Compose on the Menu key and switching groups with both Shift keys):

#XKBMODEL="pc105"
XKBMODEL="pc105awide-sl"
XKBLAYOUT="us,gr"
XKBVARIANT="cmk_ed_us,colemak"
XKBOPTIONS="lv5:caps_switch_lock,misc:extend,compose:menu,grp:shifts_toggle"

Remember that this would need a reboot (or at least 'pkill X' or a trigger command to udevadm?) to kick in. Hope it works for you!


NOTE:

• If a layout isn't the first in the list in Linux, some programs may cause problems (Alt key not working as it should in Emacs for instance)! This is a known but annoying bug.
• Something seems to be amiss with GNOME and possibly a few of the others these days. Not sure what, but it may cause some trouble. Keep a weather eye and take backups.


DONE:

• Make the Extend layer modifiers (A/S/T for Alt/Shift/Ctrl) work with the other keys like they do in my PKL implementation under Windows!
• Extend Undo/Cut/Copy/Paste, navigation and F-keys work as they should, as does Wheel Scrolling

TODO:

• Dead keys need fixing (slash/stroke, currency, IPA, super/subscripts etc);
   my plan is to make dead keys with currency++ on AltGr+4, tech/math stuff on AltGr+5 and IPA++ on AltGr+Shift+numbers
• Make the phonetic key alias remappings work: Is there something wrong with the XKB (too QWERTY-centric?) or just my way of using it?
• Planned locale variants: hu ro tr
• Make a level7 modifier (i.e., both level5 and AltGr) in compat for use with the second Extend layer?

Happy tapping!
2014-02, Øystein Bech "DreymaR" Gadmar

Last edited by DreymaR (25-Jul-2014 22:24:56)

Offline

#2 06-Jul-2012 18:11:34

dkun
New member
Registered: 06-Jul-2012
Posts: 4

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

amazing work !!

i just downloaded your version and i am gonna test it out
it might give me new ideas about the Greek Colemak Layout i am working on

Offline

#3 24-Jul-2012 14:06:29

kuglee
New member
Registered: 24-Jul-2012
Posts: 2

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

I've managed to get the cut, copy and paste keys to work everywhere.
gtk-2 apps: put this code into ~/.gtkrc-2.0

binding "gtk-xf86cut-copy-paste"
{
        bind "XF86Cut"   { "cut-clipboard" () }
        bind "XF86Copy"  { "copy-clipboard" () }
        bind "XF86Paste" { "paste-clipboard" () }
}

class "*" binding "gtk-xf86cut-copy-paste"

gtk-3apps: put this code into ~/.config/gtk-3.0/gtk.css

@binding-set gtk-xf86cut-copy-paste
{
        bind "XF86Cut"   { "cut-clipboard" () };
        bind "XF86Copy"  { "copy-clipboard" () };
        bind "XF86Paste" { "paste-clipboard" () };
}

* {
        gtk-key-bindings: gtk-xf86cut-copy-paste
}

Offline

#4 26-Jul-2012 11:37:57

DreymaR
Member
From: Bærum, Norway
Registered: 13-Dec-2006
Posts: 2,628

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

@Kuglee: Interesting! I'm on Ubuntu 12.04 and I have only a ~/.config/gtk-2.0/ directory with one file in it (gtkfilechooser.ini). Do I make a fresh gtk.css file in there with that code and nothing else in it then?

Offline

#5 26-Jul-2012 13:58:34

kuglee
New member
Registered: 24-Jul-2012
Posts: 2

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

DreymaR

@Kuglee: Interesting! I'm on Ubuntu 12.04 and I have only a ~/.config/gtk-2.0/ directory with one file in it (gtkfilechooser.ini). Do I make a fresh gtk.css file in there with that code and nothing else in it then?

Yes. I didn't have them either.

Offline

#6 10-Sep-2012 17:07:18

vaskozl
Member
From: Malmö, Sweden
Registered: 10-Sep-2012
Posts: 110

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

Hello DreymaR! Wow those are some awesome tricks you've got there! I especially like the extended layer that is activated when CapsLock is pressed.
I think it is really usefull since it is very frequent to jump between lines when writing code or essays. I am really tempted to use your layout, however I switch between ISO and ANSI very often when I work and therefor want one portable keyboard layout that I can universaly use.
I'm still a noob with portable keyboard layout. Can you please guide me on how to add the extended caps-lock layer and alt-gr mapping on normal colemak without having to use the angle/wide mod? Or even better, if it is relatively easy to achive, make one and add it to your post. I would be very greatfull to you if you did :).


Posted without the aid of a rodent.
Monster: Cherry G80-3000 with MX Blues

Offline

#7 10-Sep-2012 18:10:34

DreymaR
Member
From: Bærum, Norway
Registered: 13-Dec-2006
Posts: 2,628

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

Thanks for the kind words! :)

Since you're using Windows, keep in mind there's a sister topic to this one where the PKL files and descriptions reside. I'll try to answer there, to "keep the family together". ;)

Offline

#8 03-Nov-2012 02:12:06

pablox
Member
Registered: 31-Oct-2012
Posts: 5

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

Me again =P.

Looking at the source code of xkeyboard-config* (package name on arch), I realized that some files, for example rules/base.lst are generated through its Makefile. Your diffs patch also patch the generated files so I was wondering if it was easier (or more straight-forward) to patch them from the upstream to get some kind of patched-version of xkeyboard-config.


*http://xorg.freedesktop.org/archive/ind … .7.tar.bz2

Last edited by pablox (03-Nov-2012 02:12:19)

Offline

#9 03-Nov-2012 08:05:58

DreymaR
Member
From: Bærum, Norway
Registered: 13-Dec-2006
Posts: 2,628

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

It's true that the rules files come with the warning that you shouldn't edit them directly but I couldn't work out how else to do it. That's something I've wanted to learn. On ubuntu I couldn't find the Makefile (maybe I didn't look in the right places).

Thanks for the tip, I'll look into it!

Last edited by DreymaR (03-Nov-2012 08:07:33)

Offline

#10 10-Nov-2012 01:37:27

cevgar
Member
Registered: 04-Feb-2010
Posts: 97

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

@ Dreymar: This has somewhat bothered me since you first started advertising your 'bag-o-tricks' thread, but how are you mirroring the keyboard? Mirroring is an awesome accessibility technique and you get serious bonus points in my book for including it, but while you mention that you typed a segment completely with the left hand with exception of the mirroring key, I see nothing to identify what key you are using to do it. Traditionally (and by traditionally I mean the Mattias 'I live on the blood sweat and tears of the disabled' Half-Qwerty Keyboard) mirroring has been done by holding the spacebar. Is that the idea here?

The extended mappings are a little confusing. You mention green, blue, orange and gray; and I'm looking at map that includes red, sand, purple, spruce... help! (Joking, but it could be clearer. Those circle buttons don't mean anything to me without looking at the code.)

Um... and while I have your attention, knowing you are into mechanicals, which mechanical switch do you prefer? The Bucking Springs require too much pressure for me, and I just got a keyboard with browns which I find... somewhat underwhelming. I'm wondering if it is an adjustment issue, or if maybe the blues or a Freestyle 2 might have been a better choice. Then again, even Sean Wrona seemed to be happy enough on one of those 'PerfectStroke' scissors Logitech has been producing (though they as clear about which models have it as they should be). If you have any input...?

Last edited by cevgar (10-Nov-2012 01:38:45)

Offline

#11 10-Nov-2012 11:04:35

DreymaR
Member
From: Bærum, Norway
Registered: 13-Dec-2006
Posts: 2,628

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

@Cevgar: Hiya, and thanks for the input! We love input. ;)

When I tested the mirroring, I used the RCtrl key as the mirror switch (i.e., I chose it as the Next Layout temporary switch key in Settings) and hit it with my other hand. I did that for both hands although if I were to use it much I'd of course choose the LCtrl or something like that for right-handed typing. This would be a decent way for people who can use the other hand but not its fingers well. For me it was only a test.

Any key can in theory be defined as the layout switch in the files, but it takes a little rules file fiddling (or recompiling, which I don't master yet).

I don't like spacebar mirroring, because since space is the most used character there's bound to be misfiring. I may be wrong, but that's my feeling about it. I've thought about using a foot switch (such as your brilliant "ghetto" solution!) but I'm uncertain as to whether it'd be fast enough? One rather promising and fascinating thought is those headbands that let you press a button (or two different buttons? not sure) by focusing your mind a certain way! If that's combinable with thinking about what you're typing it'd sure be a sweet and futurist approach.

OMG, you're actually more color-gay than I am! ;) Well, it probably could be clearer but this is what I've written up. I thought that between the graphic overview and the code snippet people would figure out what I mean. I guess a longer explanation would be productive but haven't found the "time" so far.

Concerning switches: I don't have strong preferences. I have a Buckling Spring board or two and like them (the old authentic IBM F feels better to me than the new Unicomp but I haven't used the latter a lot). In my daily routine however, I use laptop chicklet boards and I'm fine with that. Even the mushy membrane junk boards get the job done so I'm no snob. To me it's more about the mappings and posture.

Offline

#12 18-May-2013 23:58:30

DreymaR
Member
From: Bærum, Norway
Registered: 13-Dec-2006
Posts: 2,628

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

Inspired by Colemaker Lalop, I implemented a Wide mod for the ANSI/PC104/US generic keyboard model:

Colemak-eD_pc104Wide-Qu_Linux.gif

The "pc104Wide(Quote)" mod ('pc104wide-qu' is its keyboard model name in XKB) is a Wide ergonomic keyboard model that moves the four right-hand half-rows one key to the right. This helps hand separation notably on small keyboards, access to Enter/RAlt/Back and right hand pinky load.

Brackets are in the middle as with the pc105 Wide mod. The slash key simply moves into the middle which may be a little annoying to some but should be okay and is the most logical thing to do. The quote/apostrophe key had to move one row up but is still accessible with the same finger and a minimal change in effort. All in all it's a good mod I think.

I didn't implement any Angle mods for the lower left-hand half-row together with this Wide mod (for now). It's possible to edit the keycodes/evdev file yourself, commenting out the line in the pc104wide-qu section that augments pc104 and activating the line above that augments pc104angle-z instead. This won't change the displayed layout images like the one shown above (unless you also edit the corresponding part of geometry/pc) but it should affect the key presses after a restart. If not you may have to clear out the temp cache in /var/lib/xkb/ as described above.

Last edited by DreymaR (28-Jun-2013 13:03:09)

Offline

#13 06-Jun-2013 21:24:37

bph
Member
Registered: 06-Jun-2013
Posts: 128

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

hi dreymarr

i've just downloaded your zip and patched my xkb dir

I had a look at tarmak-1, i think it may contain a few errors

have a look at u, i, y and k (in qwerty terms)

a smart way of dealing with this could be to put your patch dir stuff on github or bitbucket - then i could just fork it and fix it then send you a pull request

i know how fiddly and error-prone this stuff is as i wrote tarmak-1 bindings myself before i found your link to your patches from this site

Offline

#14 07-Jun-2013 15:04:07

DreymaR
Member
From: Bærum, Norway
Registered: 13-Dec-2006
Posts: 2,628

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

Damn, you're right. I had forgotten to change some <AC##> codes to <AD##> ones (lines 235-256, 259-260 and 281 of symbols/colemak), affecting Tarmak 1–3. Wonder how that slipped by me. I'll fix it soon – but now you know what to change should you need it quickly. ;)

And you're right: I guess I should get this out to github. I'll figure out how, maybe this weekend.

[Edit: Okay, the ub1304 files are fixed properly and the ub1204 ones hack-fixed.]

Last edited by DreymaR (07-Jun-2013 21:42:19)

Offline

#15 07-Jun-2013 22:39:28

bph
Member
Registered: 06-Jun-2013
Posts: 128

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

no worries - I'd already fixed it

github is *very* good for this sort of stuff - would mean no repetition of effort for bug fixes/enhancements and the like

i used it for the first time when i wrote the minimak xkb bindings and was bowled over by how user-friendly it was

prior to that i'd been using mercurial/bitbucket for other projects which are great but I'd say github was even easier to use

Offline

#16 08-Jul-2013 08:59:47

lalop
Member
Registered: 04-Apr-2013
Posts: 509

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

Okay, github completely changed the game with their new web interface.  Everything can basically be done online now.  Now, even a technologically inept person can make pull requests.*

Would definitely recommend.


*Note: requires changes to be pasted directly into online text fields.  If you want to sync to local repository, well, that's a bit harder.  Haven't tried fancier stuff like syncing from upstream either.


Edit: it looks like they've had this for a while and I've only just discovered it.  Maybe the new web interface just made it more noticable or something.

Last edited by lalop (08-Jul-2013 09:02:51)

Offline

#17 14-Jul-2013 07:57:36

lalop
Member
Registered: 04-Apr-2013
Posts: 509

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

Since I'd previously created the tarmak KLA exports, I've taken the liberty of submitting them to the new KLA site since you're away.  (It says "Submitted by DreymaR" because I filled in the "author" metadata that way, and I guess that's how author is rendered for now.)

I thought you might also be interested in submitting your wide/angle mods, etc.  He even has a European template with those extra keys!

(IIRC, 1-2 layer Extend can even be emulated by setting AltGr as Caps Lock.  However, the only mappings that currently make a difference seem to be those that print a character (and possibly backspace if he ever simulates an "error rate" in the analysis), so this might not make a big difference.)

Last edited by lalop (14-Jul-2013 08:31:09)

Offline

#18 17-Sep-2013 14:07:59

Akiva
Member
Registered: 17-Sep-2013
Posts: 8

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

your instructions are vague. I am having an incredibly hard time figuring out where to run this script from.

Last edited by Akiva (17-Sep-2013 14:08:15)

Offline

#19 20-Sep-2013 21:42:31

bph
Member
Registered: 06-Jun-2013
Posts: 128

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

just tried your wide angle mods for the first time

they are awesome! almost no impact on my typing ability but it feels like the keyboard has 'opened up' underneath my fingers

definitely going to stick with it - i think my right pinkie will thank me for it

i just swapped the j and k keycaps so i have the 'ridge' under my right index finger still  - left everything else the same

thanks again for providing this

Offline

#20 21-Sep-2013 21:54:00

bph
Member
Registered: 06-Jun-2013
Posts: 128

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

haha just fired up emacs - can i withdraw that last post, its actually really difficult

but i still like it!

Offline

#21 23-Sep-2013 09:05:17

DreymaR
Member
From: Bærum, Norway
Registered: 13-Dec-2006
Posts: 2,628

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

Hope it works for you, bph! :)

Akiva – any tips on improving the instructions? The script is run from wherever it's unpacked at long as that's in the same folder as the folder with the patch files. If you have a distro that keeps its X11 files anywhere else than /usr/share/X11 you'll have to edit the instdiff script a bit to reflect that.

Offline

#22 23-Sep-2013 10:06:06

bph
Member
Registered: 06-Jun-2013
Posts: 128

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

i wonder if the switch from X to mir in ubuntu 13.10 will beggar up all the keyboard stuff?

Offline

#23 23-Sep-2013 10:29:44

DreymaR
Member
From: Bærum, Norway
Registered: 13-Dec-2006
Posts: 2,628

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

I've thought about Mir. My impression is that they'll keep the old layout definition syntax for Mir, since there's a huge amount of files written for all sorts of locales. Maybe they'll try to clean up some of it, but as long as they stick to the same syntax I'll be fine I guess. The way I gather it, the XKB component isn't the most controversial part of X.

Maybe the 'rules' (or whatever it'll be called) will follow a different format; if so, we'll just have to figure it out.

Offline

#24 23-Sep-2013 13:44:36

bph
Member
Registered: 06-Jun-2013
Posts: 128

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

tempted to swap \# for =- on the bottom row to make it more programmer friendly...

(and after another day of use I revert to my initial position that the wide/angle mods aren't too difficult to pick up)

Last edited by bph (23-Sep-2013 13:47:24)

Offline

#25 24-Sep-2013 14:35:42

DreymaR
Member
From: Bærum, Norway
Registered: 13-Dec-2006
Posts: 2,628

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

Both '\' and '-' are frequently necessary for coding so I'm not sure what that'd accomplish. It's a bit of a dilemma; if I coded enough I'd consider putting some of the symbols and brackets on easily reachable AltGr positions like others have done before. As it stands, I'm happy with the AltGr mappings I use now.

Last edited by DreymaR (24-Sep-2013 14:38:11)

Offline

Board footer