Author Topic: XKB Layouts / Ideas / Talk  (Read 3603 times)

0 Members and 1 Guest are viewing this topic.

Offline Taurusko

  • Thread Starter
  • Posts: 10
  • Location: Slovakia
XKB Layouts / Ideas / Talk
« on: Thu, 06 November 2014, 09:21:45 »
X KeyBoard

XKB is a very powerful, but horribly documented tool for managing layouts on Linux. The learning curve is steep and for most occasions xmodmap is sufficient alternative.
Yet still, I got my hands dirty and I can tell you that the moment you understand how it all works, a new world opens up with infinite possibilities.

Some useful docs:
http://www.charvolant.org/~doug/xkb/html/node5.html
https://wiki.archlinux.org/index.php/X_KeyBoard_extension

This thread can serve as a showcase for all of your xkb layouts, Q&A and general talk.


I'll start with the layout I'm currently working on.
  • It is based on Slovak QWERTZ layout with four levels (Base, Shift, AltGr, AltGr+Shift). The base/shift layer is for general typing with accents and punctuation. AltGr opens up other symbols, such as brackets, programming stuff and some commonly used characters. Right now, it is cluttered with obscure stuff (everything is default), but maybe I'll make some changes, so that programming characters are more intuitive.
  • CapsLock changed for Control
  • Another layer with Mod3 modifier (Win_R) populated with arrows, numpad and stuff
  • Caps Lock = Mod3 + original Caps Lock key
  • Mod3 Lock = Mod3 + "-" (the key to the left of the Shift_R)
  • Another Mod3 Lock = Win_L + "-" (as above)
  • Mod3 indicator = Scroll Lock indicator (reacts to Win_R pressed and also Mod3 Lock)
Suggestions / Improvements / Critics are welcome :)

.xkb file:
https://drive.google.com/file/d/0B1oaGhBuhlq9cDNmWV9ZZnYtZTg/view?usp=sharing
Keyboard Layout
http://www.keyboard-layout-editor.com/#/layouts/7bbf08583d9bf26e10602b956692cdf3
« Last Edit: Thu, 06 November 2014, 16:07:23 by Taurusko »
Looking for the impossible - 60-75% 'board with Clears and ISO

Offline PieterGen

  • Posts: 135
Re: XKB Layouts / Ideas / Talk
« Reply #1 on: Wed, 26 November 2014, 08:24:11 »
Thank you Taurusko. I will definitely ask questions here, as I'm about to implement my own layout.

Let me ask a first question: is it possible in XKB to assign 2 or more characters to 1 key? I mean: in many languages, the Q is always followed by a U. Que, quote, quality, quiche. Is it possible to make the Q always type QU ?

Normally you would do this in a script, such as Autokey. But in xkb itself is more elegant. Can it be done?

Offline kebby

  • Posts: 92
Re: XKB Layouts / Ideas / Talk
« Reply #2 on: Sun, 14 December 2014, 05:10:54 »
I've been fiddling with xkb a bit. I use a custom version of the neo2 layout with standard qwerty alphas and a modified layer 4. My current issue is that I'd like to use the modifier (right alt) that activates the 4th layer also as Meta in Emacs. This would let me use the movement keys from that layer and add the Emacs specifics on top of that.

I'm just not very clear on whether there is some fundamental difference between a modifier like this that switches between layers and one that you can normally use for keyboard shortcuts. Do you know if the config I want is even possible with xkb?

edit:
Well I think I actually finally managed to do this. Only remaining thing is that seems my terminal doesn't play nice with it.
« Last Edit: Sun, 14 December 2014, 05:38:04 by kebby »

Offline Taurusko

  • Thread Starter
  • Posts: 10
  • Location: Slovakia
Re: XKB Layouts / Ideas / Talk
« Reply #3 on: Mon, 15 December 2014, 14:07:22 »
Sorry for my inactivity. Deadlines are happening.
I took a break from XKB. It was acting strange (stuck keys, not registering keypresses, etc.). No, it wasn't keyboards fault. When I switched back to default setup, everything seems fine. I'll look into this on holidays.


Is it possible in XKB to assign 2 or more characters to 1 key?

As far as I know, this isn't possible. XKB only changes the processing of the keys, it can not create new stuff. But I may be wrong.
So far, the only way is scripting (xdotool, autokey, etc.).

I'm just not very clear on whether there is some fundamental difference between a modifier like this that switches between layers and one that you can normally use for keyboard shortcuts. Do you know if the config I want is even possible with xkb?

edit:
Well I think I actually finally managed to do this. Only remaining thing is that seems my terminal doesn't play nice with it.

Could you please share the original setup and the solution? It sounds like an interesting problem, but I am not sure if I understand what are you trying to accomplish ;)
Looking for the impossible - 60-75% 'board with Clears and ISO

Offline kebby

  • Posts: 92
Re: XKB Layouts / Ideas / Talk
« Reply #4 on: Tue, 16 December 2014, 07:08:03 »
I'm just not very clear on whether there is some fundamental difference between a modifier like this that switches between layers and one that you can normally use for keyboard shortcuts. Do you know if the config I want is even possible with xkb?

edit:
Well I think I actually finally managed to do this. Only remaining thing is that seems my terminal doesn't play nice with it.

Could you please share the original setup and the solution? It sounds like an interesting problem, but I am not sure if I understand what are you trying to accomplish ;)

So I just wanted neo2's movement layer to be triggered with the same modifier I use in Emacs so I could memorise the same keys for all programs and have the additional stuff Emacs provides alongside the basics. In the end it was very simple but I think the solution may be fairly shell/Emacs-specific, most other applications aren't looking for what meta etc. are bound to. I feel like I don't really fully understand how XKB works at this point so it was a slow process of trial and error.

I just assigned the (I assume fake) key <HYPR> to the right modifier which allowed Emacs to see it as the hyper key:
Code: [Select]
modifier_map Mod3 { <HYPR> };
 Chose hyper to not affect the shell and mapped it to be meta in Emacs with x-meta-keysym and x-hyper-keysym. The fake keys like <HYPR> may be specific to the neo2 layout shipping with xorg.


Offline drrtyrokka

  • Posts: 69
  • Location: Bavaria, Germany
Re: XKB Layouts / Ideas / Talk
« Reply #5 on: Tue, 23 December 2014, 03:02:29 »
Here is an interesting project from Øystein Bech "DreymaR" Gadmar.

I mainly adopted the "Extended" Layout, which gives you extended functionality through replacing capslock with a mod_level_5.
The good thing is, you can add this to your existing layout with an option in dconf-editor.

The layout looks like this in his file:


I had to adjust it a bit for my needs, because some functions didn't work as expected.
I had to disable the media key functionality on the function row, because I couldn't change to my ttys.
Futhermore, reenabling capslock lays on scroll lock, but I didn't like that. I changed it with dconf-editor to activate when I tap both Shift keys a time.
(See page 4 in the forum post I mentioned above, There I've described my steps to solve these problems).

Have fun!

Offline kebby

  • Posts: 92
Re: XKB Layouts / Ideas / Talk
« Reply #6 on: Tue, 23 December 2014, 03:47:16 »
The layout looks like this in his file:
Show Image


So the mouse keys can just work from the layer without any need to switch to keyboard mousing? If so I may have to incorporate that to my layer.

Offline drrtyrokka

  • Posts: 69
  • Location: Bavaria, Germany
Re: XKB Layouts / Ideas / Talk
« Reply #7 on: Tue, 23 December 2014, 04:00:04 »
I don't really use it, but it works, yes. You can activate/deactivate mouse functions with Extend+Z. 
I recognized that this only works in Firefox for me, but I'm on a VM, perhaps this is the issue. Would be nice if you could have a look in the extend xkb file, if there are suggestions to make it better. I can't tell, that I really understand xkb :D
« Last Edit: Tue, 23 December 2014, 04:01:55 by drrtyrokka »