• You are not logged in.

    Xmodmap Stuff

    • Started by angelic_sedition
    • 19 Replies:
    • Reputation: 0
    • Registered: 11-Oct-2013
    • Posts: 79

    Since there doesn't seem to be a lot of stuff on here about xmodmap (besides people posting their configs or some simple remappings) , I thought I'd post what I've learned from using it. It's all pretty basic, but I thought it might help someone, and I already had most of this written as a reference for myself.

    For remapping in Linux you have primarily two options: xkb (X KeyBoard extension) and xmodmap.

    From the Arch Linux Wiki:
    "xmodmap is not directly related to XKB, it uses different (pre-XKB) ideas on how keycodes are processed within Xorg. Generally it is not recommended to use xmodmap, except maybe for the simplest tasks."

    If you just want to get a custom keyboard layout that is not offered by linux (you're using something like QGMLWY) or add some basic capslock navigation functionality, xmodmap is a good solution. You can write the commands for what you want even before installing linux, put them in a document on usb drive for, and simply paste them into the terminal or load them from a file after the installation. Using xmodmap may be a good intermediate stage if you want your custom layout immediately and plan on messing with xkb later. This obviously isn't a problem if you're using colemak (since linux already has it available.. you can use xmodmap though: https://colemak.com/Unix), but if you want capslock navigation immediately before messing with xkb, it is very easy to set up. For me, setting up basic navigation with xmodmap and colemak looks like this (NoSymbol is unnecessary; it just gets rid of any keysym that was there before.. i.e. if you had "aacute" for altgr it would erase that) :

    keycode 66 = Mode_switch (Mode_switch)*
    keysym e = e E Up NoSymbol NoSymbol NoSymbol
    keysym n = n N Down NoSymbol NoSymbol NoSymbol
    keysym h = h H Left NoSymbol NoSymbol NoSymbol
    keysym i = i I Right NoSymbol NoSymbol NoSymbol
    keysym o = o O Prior NoSymbol NoSymbol NoSymbol
    keysym k = k K Next NoSymbol NoSymbol NoSymbol
    keysym l = l L Home NoSymbol NoSymbol NoSymbol
    keysym u = u U End NoSymbol NoSymbol NoSymbol
    keysym y = y Y BackSpace NoSymbol NoSymbol NoSymbol
    keysym w = w W Escape NoSymbol NoSymbol NoSymbol
    keysym s = s S Shift_L NoSymbol NoSymbol NoSymbol
    keysym a = a A Alt_L

    *adding another Mode_switch allows you to use normal shift and still get up, down, left, etc. Even without this, using capslock+s will still give you shift up, down, left, etc., but using normal shift will just give you the capital letter.

    Xmodmap could also be considered an easy portable solution if you ever counter a situation where you have to use linux on another computer (probably unlikely) as you can easily reverse what you have done or simply restart. Entering these commands in this way is temporary and will be undone after restart. You can specify 6 levels with xmodmap:
    Level 1:
    1. normal
    2. shift
    Level 2: (obtained with a Mode_Switch key)
    3. whatever your mode switch key is (capslock)
    4. shift + above (This is now working for me; I'm not sure what I was doing wrong before)
    Level 3: (obtained with ISO_Level3_Shift)
    5. altgr (or key defined as ^)
    6. shift altgr
    You can define more layers after this without xmodmap complaining to you, but I don't know if you can actually get them to work. For example, ISO_Level5_Shift is valid, but it doesn't work and does very screwy things (I wouldn't recommend trying it; you might have to restart)

    Changing Your Mappings
    The basic format is as follows:

    keycode or keysym (code or sym) = 1 2 3 4 5 6
    !This is a comment

    To use this temporarily, you can put it in a file and load it from the terminal by going to the directory where it is saved and entering the command "xmodmap filename" To undo your changes, you will either have to restart or load another file that reverses the changes made. Another way to do this is to type the commands directly into the terminal like this:

    xmodmap -e "keycode 40 = s S" ; xmodmap -e "another command" ; etc.

    To have it load automatically, you can create .Xmodmap file in your /home/user directory. This will work for some DEs. Otherwise you will have to add something to your xinitrc (see arch wiki). I wouldn't recommend testing changes with a file that automatically loads. If you mess up something, it may be hard to change it back.

    Useful Terminal Commands
    xmodmap -pke gives you your current mappings
    xmodmap -pm gives you your current modifiers (you can have 4 keys for each modifier)
    xev will give you they keycodes for your keys
    xmodmap /path/to/dir to load a config file (exactly the same syntax as in terminal, jut no xmodmap -e; ! is comment)

    Something I've never used...
    xmodmap -e "<KEYCODE> <MODIFIER> = <behaviour> <behaviour_with_modifier>"
    Also for control you have to add (and maybe remove) to get a key working as control (i.e. mapsomething = Control L.. on next line: add control = Control_L... same for other things listed under -pm; add mod2 = ...)


    Stuff that WILL work:
    •Multimedia keys (ex: XF86AudioMute; see /usr/include/X11/XF86keysym.h)
    •Any of these will work: http://wiki.linuxquestions.org/wiki/Lis … by_Xmodmap
    •You can do an ISO_Level3_Lock (*see below for more info on locks)

    What WON'T work:
    •Keeping corresponding xkb symbols for any keysyms or keycodes remapped
    •I don't think you can make dead keys
    •I have not been able to map control, lock keys, or the windows key (super) to inside a caps layer. Control DOES work, but results in a glitch that makes the first level of that key also control.

    CapsLock Navigation
    You just define caps as a Mode_switch key (which goes under mod5) and then capslock will act as a modifier to access whatever you have defined on level 3. Shift works fine. Control is very buggy for me. I've tried adding it in multiple ways, and it works, but control will be randomly pressed when you are normally typing even without holding down CapsLock; this results in a whole bunch of unwanted "ctrl o"s, "ctrl t"s, "ctrl n"s, and pretty much makes things unusable. I'm not really sure why this happens, and most of the documentation I've read on xmodmap has been lacking. Again, it isn't the most elegant solution, but it's hypothetically an okay way to temporarily get some functionality.

    AltGr Layers and Unicode
    To specify that it is a unicode symbol, type U then the code.
    This won't work:

    keycode 23 = q Q Tab NoSymbol ⁂ ❄

    This will work:
    keycode 23 = q Q Tab NoSymbol U2042 U2744

    Also note that symbols like semicolon and brackets cannot be written like ";" or "[". "," is comma, ";" is semicolon, "[" is bracketleft, "\" is backslash, "$" is dollar, etc. See the link above for valid keysyms or use xev to find them.

    Locks**
    I just found out that you can also do locks. Can be nice if you're going to be using a layer for a while and don't want to hold a modifier. The only lock I've gotten working at this point is "ISO_Level3_Lock"
    Something that should be noted about it is that it will work flawlessly when mapped to a key like numlock. It will not work in a layer, but it will work if mapped to something like grave when done in a certain way:

    keycode 77 = ISO_Level3_Lock (you can do a lock key like this)

    keycode 49 = ISO_Level3_Lock NoSymbol NoSymbol NoSymbol ISO_Level3_Lock
    (this is for a normal key)
    If you don't do this, you can turn it on but not off (.. which may result in you having to restart your computer). This is because, once you turn it on, pressing the key again will
    result in the level 3 output of that key. If not defined as the same thing, it won't switch back.

    Setting a lock to a level that doesn't have necessary keys for typing or navigation, which would essentially serve as a keyboard lock (especially if you have nothing defined for that layer except for the lock key). Right now, I don't necessarily see how this fact would really benefit anyone. It certainly doesn't serve as a replacement to a screenlocker, but I can only imagine the frustration of someone who stole my laptop after finding that none of the keys work. Assuming they did manage to get past the lock screen and figure out how to turn off this layer lock, I can only imagine how frustrated they would be to find that I'm using colemak... Colemak, a surefire way to mess with anyone who steals your things. Hopefully no one's things get stolen though.

    There is also a Shift_Lock, but I couldn't get it to do anything. I don't know if there is a lock for level 2 (Mode_switch), but Mode_lock (or Lock) does not work (not a valid name) nor does ISO_Level2_Lock.

    Glitches
    I have come across a lot of glitches. If you're going to experiment with heavily with stuff not listed here be prepared to have to restart.
    There seem to be glitches between levels and their shifted states.  For example, if shift in an extend layer is held for a while and the shifted version of the shift key in the extend layers is Z (keysym s = s S Shift_L Z) it will type ZZZZ. I assume this has something to do with repeating. There will be no such glitch if you don't have anything defined on the next level, and even if you do, it's still usable (takes long enough for the ZZs to pop up to use shift for what you need). I don't really see the point in defining something for the shifted state of shift though.
    You can also have two shifts on a level, but it doesn't seem that you can use both of them at the same time to shift two levels up.


    To Test
    Whether you can embed Mode_Switch or ISO_Level3_Shift in a higher level. I might have tested this, but I do not remember. I doubt it will work.

    **Note, you can do a lot of other things by using more than just Xmodmap. If you like remapping look into the following (I use about half of these happily):
    xbindkeys, sxhkd, xchainkeys, and actkbd for binding stuff

    dual key functionality (release vs held down):
    xcape (and space2ctrl and keydouble) for modifiers to something on release (i.e. Escape or BackSpace on control release)
    Don't be mislead by these. None of them work to turn a normal key (i.e. space) into a modifier (i.e. control). Typing will be a disaster.

    at home modifier- the best software currently on linux for using normal keys (i.e. s, space, etc.) as modifiers; has a fast type feature that prevents some accidental keypresses, but I have not found it to be totally useable

    faking mouse/keyboard input ; controlling stuff:
    xvkbd, xdo, xdotool, xsendkey, xsendkeycode, xautomation (xte), wmctrl

    random other stuff:
    pyuserinput
    etc.

    Last edited by angelic_sedition (08-Feb-2014 08:24:49)
    Offline
    • 0
    • Reputation: 0
    • From: Malmö, Sweden
    • Registered: 10-Sep-2012
    • Posts: 122

    Nice and usefull stuff!

    angelic_sedition said:

    From the Arch Linux Wiki:
    "xmodmap is not directly related to XKB, it uses different (pre-XKB) ideas on how keycodes are processed within Xorg. Generally it is not recommended to use xmodmap, except maybe for the simplest tasks."

    I'm gonna backstab you a bit and say that I think xkb is much easier and neater to deal with. You can learn how it works simply by looking at your xkb folder (/usr/share/X11/xkb/symbols for me). The colemak part is in the "us" file.

    I also see you are into extended layers and such. If so you might want to look at the neo layout and it's correspending mappings in xkb (for me in the "de" file).

    Posted without the aid of a rodent.

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

    Nice and usefull stuff!

    angelic_sedition said:

    From the Arch Linux Wiki:
    "xmodmap is not directly related to XKB, it uses different (pre-XKB) ideas on how keycodes are processed within Xorg. Generally it is not recommended to use xmodmap, except maybe for the simplest tasks."

    I'm gonna backstab you a bit and say that I think xkb is much easier and neater to deal with. You can learn how it works simply by looking at your xkb folder (/usr/share/X11/xkb/symbols for me). The colemak part is in the "us" file.

    I also see you are into extended layers and such. If so you might want to look at the neo layout and it's corresponding mappings in xkb (for me in the "de" file).

    I might draw some inspiration from layers 3 and 4 of neo.. very interesting layout.

    Yes, I will agree that there is a clear limit to its usefulness. Xmodmap is kind of a half-baked way of doing things. I've been an on and off linux a lot, and when I installed it on my laptop a couple months ago, I had just started switching away from QWERTY. I wasn't using a supported layout and was just in the middle of switching, so it was kind of jarring to go back to QWERTY. Xmodmap was the first thing I found, and it was pretty easy to implement.

    It does help if you're lazy though. I was testing out a bunch of distros at one point, and it was a lot easier to just load the file I already had created instead of messing around with xkb each time. I think it makes a good temporary/nonpermanent solution. The other thing is that it seems DreymaR has not found a way to get control/alt/shift working with the capslock layer in xkb, but alt and shift work readily with xmodmap. Other than that, xkb is definitely a better way to go in the long run. I'm pretty much done using xmodmap now except for to make capslock a modifier.

    davkol said:

    I haven't done much research on the topic yet, but I somehow get the impression that xmodmap will be depricated by the switch to Wayland, which uses libxkbcommon, seemingly compatible with X11's xkb.


    I'm honestly not very in touch with the whole X11/Mir/Wayland situation. I guess we'll see how it plays out.

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

    Thanks, this is interesting and useful info!

    Vaskozl: Uninformed backstab if you ask me. XKB isn't simpler than xmodmap unless you're wired differently from almost anyone else I know of. The virtual modifier stuff gives me bad dreams. What xmodmap is, is too primitive – but as long as you know that it seems you can do useful stuff with it quite handily!

    Any particular tips from the Neo layout files? I remember looking at the layout but can't remember anything special. Inform and tempt, please?

    Is using the Mode_Switch for the Extend layer the same as using lvl5? This looks promising – I guess I have work to do! ;)

    Are you sure the NoSymbol actually erases previous mappings? In XKB it acts as a transparent mask, leaving previous mappings undisturbed. I use it to map only from lvl5 upwards in my Extend layer mappings.

    Last edited by DreymaR (21-Oct-2013 09:34:55)

    *** 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
    DreymaR said:

    Is using the Mode_Switch for the Extend layer the same as using lvl5? This looks promising – I guess I have work to do! ;)

    Are you sure the NoSymbol actually erases previous mappings? In XKB it acts as a transparent mask, leaving previous mappings undisturbed. I use it to map only from lvl5 upwards in my Extend layer mappings.

    I'm not sure if Mode_Switch is the same as level 5 for xkb.. I have to doubt it due to their differences though.

    You can test it, but I'm pretty sure NoSymbol overwrites the mappings (temporarily). For example, if I were to put in NoSymbol for the altgr layer of a (which is á for colemak by default I think) instead of altgr+a generating "á," no symbol would be generated.

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

    I've found it out. Mode_switch is the old xmodmap AltGr, ISO_level3_switch is the new xkb AltGr! The truth is just too weird sometimes! :)

    So xmodmap can't handle level5 at all it seems, and I lose. I don't want to sacrifice level3, and I don't want to do everything in xmodmap – which might work because then I could've mapped both lvl3 and Mode it seems – but I'd lose the modularity and I'd be doing things the deprecated way which might be gone soon so I think not.

    Not specifying the entry makes it blank too, so I lose my lvl3-4 mapping of the S key unless I put it in the xmodmap command I guess.

    Still, thanks for your work and interesting discussion. I too am curious about the next step (Mir/Wayland etc). I'm pretty sure they'll keep most of the xkb file format though since there's such a lot of work done on that for all the locales.

    Last edited by DreymaR (24-Oct-2013 08:22:31)

    *** 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: 03-Jul-2009
    • Posts: 189
    angelic_sedition said:

    From the Arch Linux Wiki:
    "[...] Generally it is not recommended to use xmodmap, except maybe for the simplest tasks."

    My experience says the opposite: for more complex stuff, Xmodmap saved my day while XKB gave me only headaches. Nowadays, I use XKB only to map symbol keys, but for all modifiers, I keep an Xmodmap script.

    Dvorak typist here.  Please take my comments with a grain of salt.

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

    I've found it out. Mode_switch is the old xmodmap AltGr, ISO_level3_switch is the new xkb AltGr! The truth is just too weird sometimes! :)

    Hmmm I'm not sure exactly what you mean since ISO_level3_switch is a mod5 key (like capslock when mapped to mode_switch) and shouldn't affect altgr mappings.

    spremino said:
    angelic_sedition said:

    From the Arch Linux Wiki:
    "[...] Generally it is not recommended to use xmodmap, except maybe for the simplest tasks."

    My experience says the opposite: for more complex stuff, Xmodmap saved my day while XKB gave me only headaches. Nowadays, I use XKB only to map symbol keys, but for all modifiers, I keep an Xmodmap script.

    I think it's a lot easier than simple stuff, but xkb definitely has more functionality.

    Right now I'm still using xmodmap for my caps layer (shift and alt is nice), but I still can't get control working without serious problems. I've tried just about everything now, and I'm pretty sure that it just doesn't work.

    First I just tried clearing control and then mapping t to control like "keysym t = t T Control_L" Doing that works great until you start typing faster than 20wpm. If you type at a normal speed, it will start firing off control randomly when you press t (resulting in a bunch of new windows, tabs, opening of stuff, etc.) even if you don't hit caps. I tried doing it with keycodes instead and also tried  "keysym t = t T NoSymbol Control_L." That didn't work.

    I also tried using a different modifier key and adding it to control (ex: Meta_R). Same result. Then I tried something a bit more interesting: mapping a symbol (ex: Zacute) to Control_L and then setting to "t T Zacute." This was the worst idea of all. Suddenly a bunch of my keys no longer even worked... I also tried doing what I did with Meta_R with symbols:

    keysym t = t T Zacute
    add control = Zacute

    At this point I really had no expectations that this would work. It didn't. At least it didn't go as badly as the previous attempt.

    Maybe I'm wrong, but I've pretty much concluded that it's not possible to avoid this glitch. I've tried it with other letters, and it seems that doing this will cause them to fire off control even when pressed normally (I've also tested it on multiple distros, but I don't think that really matters at all). Now if you never used t to type, it wouldn't be a problem.

    Maybe one possibility would be to do this for one of the middle keys instead of a symbol if you're using a wide mod? it might defeat the purpose if that key hard to reach though. My only other thought would be to move control to q, z, or x (q would probably be best because of infrequent use and not used with modifiers.. but it still might cause problems) and change alt and shift accordingly.

    Anyway, I think I'm going to move on and try to figure if it's possible to get modifiers working with xkb. This is kind of an annoyance to me since it works so well with pkl.

    Offline
    • 0
    • Reputation: 0
    • Registered: 03-Jul-2009
    • Posts: 189
    angelic_sedition said:

    First I just tried clearing control and then mapping t to control like "keysym t = t T Control_L"

    Why do you guys keep trying to do such weird stuff? Use separate keys for modifiers. If you do otherwise then don't complain when the system gets confused. If you want more modifiers then get yourself a Japanese keyboard. If you want more accessible modifiers then get yourself an ergonomic keyboard. Keep it simple.

    Cheers.

    Dvorak typist here.  Please take my comments with a grain of salt.

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

    Why? Because I have a very nice solution for PKL on Windows and I've become enamoured of it. Reaching arrow keys and modifiers from the home position (without twisting!) allows a comfort and utility that's highly enjoyable and useful.

    To me, keeping it simple is *not* about getting new hardware. To the contrary, I try to avoid that solution as it won't be consistent and I consider it an added complexity rather than a simplification. And if you feel that Japanese keyboard modifiers are easy to use on all systems, I think I'll have to disagree.

    This isn't about complaining. It's about trying to overcome the system confusion. I know that a success would be very much worth the effort. In the meantime, it's a challenge and a learning opportunity.

    Last edited by DreymaR (01-Nov-2013 16:12:30)

    *** 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
    spremino said:
    angelic_sedition said:

    First I just tried clearing control and then mapping t to control like "keysym t = t T Control_L"

    Why do you guys keep trying to do such weird stuff? Use separate keys for modifiers. If you do otherwise then don't complain when the system gets confused. If you want more modifiers then get yourself a Japanese keyboard. If you want more accessible modifiers then get yourself an ergonomic keyboard. Keep it simple.

    Cheers.

    Hey it's not weird, and xmodmap doesn't cost any money. Shift and Alt work fine too. The point for me is to be able to do basic text navigation and highlight/copy/cut/paste even when I'm in a program that doesn't allow for this easily with the keyboard. I'm using a lot more programs that are vi-like now, so it matters a bit less, but it still comes in handy. I'd rather use the home row as much as possible, since I type very often.

    I'd love myself a new keyboard. Something with a thumbcluster of modifiers might be great, but I don't have money that I'm willing to invest in something like that right now.

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

    I just added some stuff on lock keys, the levels, etc.

    I found out some interesting stuff the other day while implementing a tab layer. I figure that if I use a symbol more, it should be closer to the home row. I'm trying to eliminate/lessen movement away from the home row (it has been pretty successful so far). I don't really mind using a caps layer and chorded stuff with modifiers that don't need hand repositioning aren't really a problem for me.

    Since I wasn't able to get more levels working with xmodmap, I scrapped my altgr layer for a tab layer instead that gets rid of the need to reach up to the number row. Again, Alt_L (or Meta_L) will also work in this layer (Ex: get this from embedded alt and numbers in tab layer: ±²³´µ¶¸¹). Sadly, I had no luck getting the windows key in there (which could have been nice for my window manager). A win lock key would also be cool.. Xmodmap lets you define more than 6 layers, but I don't know if you can actually get any more working.

    I've also done some other weird things like remapped enter to apostrophe (for wide mod) and caps+space to enter... I also unmapped backspace so that I would stop using it. My right pinkie has been hurting a lot recently, so I'm hoping that this will help.

    That's all I've got right now.

    Last edited by angelic_sedition (20-Nov-2013 16:29:17)
    Offline
    • 0
    • Reputation: 0
    • Registered: 03-Jul-2009
    • Posts: 189

    Angelic_sedition, have you considered mapping a key as Compose? I find Compose sequences much more intuitive than random AltGr keys.

    Dvorak typist here.  Please take my comments with a grain of salt.

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

    Well right now, I don't even have any symbols with altgr. I never used them much any. I have tried a compose key in the past, but I never really used it much either. The unicode symbols I do use more often work fine on an altgr layer, and I have no trouble remembering them. I might use a compose key at some point if I do start using more unicode characters, but I wouldn't make right alt a compose key and would still probably use altgr.

    For me, I don't really see a point in having one (since I usually just use English characters), but maybe I am missing something. What do you use it for? Do you have anything particularly interesting defined?

    Anyway, since you brought it up, I'm going to go ahead and try to get Multi_key working in the 2nd level like I do with everything....

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

    Compose can be nice, but I don't use it much since it's not standard in Windows I suppose. (I know, you can install some app but I didn't.)

    My AltGr mappings mimic the Compose schemes as far as practical: The cedilla dead_key is on the <COMMA> key for instance. (I found diaeresis on <"> impractical though as diaeresis is common, so I moved that to <AltGr>+<;> instead.) Gets me where I need to be.

    In Linux there's special settings to map keys to Multi_key so I didn't see a need to add my own. I usually choose RWin or Menu (since I do have an Extend-mapped Menu key).

    Last edited by DreymaR (21-Nov-2013 10:54:26)

    *** 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: 03-Jul-2009
    • Posts: 189

    Oh, DreymaR, you need to type both on Linux and Windows... I tried to do that, too, but gave up because I couldn't find a portable way to have both the two Alt keys and AltGr. Otherwise, I would have used AltGr for dead keys like you have done.

    Dvorak typist here.  Please take my comments with a grain of salt.

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

    I'm not sure I get what you're saying there. On Linux I have both AltGr and Compose, but I mainly use AltGr (with my Colemak[eD] mappings). On PKL there's no Compose but everything else works nicely.

    Do you mean that you wanted both RAlt and AltGr? Obviously there aren't keys for that unless you'd like to use RWin or something (which would be tricky on some hardware). That's entirely doable in Linux but toughish to implement. I'm used to AltGr and only one normal Alt key so I have no need for a proper RAlt.

    Last edited by DreymaR (25-Nov-2013 10:06:48)

    *** 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: 03-Jul-2009
    • Posts: 189
    DreymaR said:

    Do you mean that you wanted both RAlt and AltGr?

    Yes, I do.

    My issue was that I failed to find a solution:
    -  to have both two Alt, and AltGr;
    -  that worked on both Windows and Linux.

    DreymaR said:

    Obviously there aren't keys for that unless you'd like to use RWin or something (which would be tricky on some hardware). That's entirely doable in Linux but toughish to implement.

    Actually, I think it would be trickier in Windows, because Windows doesn't understand an AltGr key in addition to LAlt and RAlt. You can either have:
    - LAlt + AltGr;
    - or LAlt and RAlt while using Ctrl + Alt as AltGr (or so says Wikipedia: https://en.wikipedia.org/wiki/AltGr_key … substitute);
    but the latter cannot be emulated in Linux (or I didn't try hard enough). In Windows, maybe you could map two keys to LAlt (one via the registry) and a third key to AltGr, but I don't use Windows any more, hence I haven't investigated further.

    DreymaR said:

    I'm used to AltGr and only one normal Alt key so I have no need for a proper RAlt.

    I religiously type chords with both hands, hence my need for Alt on both sides of the space bar.

    Last edited by spremino (30-Nov-2013 22:17:10)

    Dvorak typist here.  Please take my comments with a grain of salt.

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

    - Under Windows, you cannot map two physical keys to one logical key (unless you use PKL or similar). It's a matter of a C variable not being able to hold two values, hence one virtual key cannot be two keycodes.

    - As you say, you can get around the RAlt ambiguity by using the Ctrl+LAlt shortcut for AltGr, but that only works in Windows (Linux defines these keys differently).

    - You could have LAlt, RAlt and AltGr all under Windows using PKL (or similar), by mapping LAlt and RAlt physically and your AltGr key to something you don't need (katakana key, Brazilian extra key or what-have-you) and have PKL/AHK remap that to Ctrl+LAlt (^*{LAlt} unless I'm mistaken).

    - Under Linux, you can map two different physical keys to RAlt and AltGr, or whatever you like. You can even have several physical keys produce the same logical key press IIRC, unlike Windows. If modifiers are your concern, it seems that XModmap is easiest to succeed with as per the above discussions.

    Last edited by DreymaR (02-Dec-2013 09:26:58)

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

    I tested out using VoidSymbol instead of NoSymbol to try to stop xmodmap from replacing all previous mappings to a keycode or keysym to no avail a while ago. Thought I just might add that it doesn't work. I'm not sure if there's a way to stop this behaviour. I'm not sure if it affects other layers besides the altgr one, but I assume it does. Even if it didn't, I'm not sure it would be worth it to use xmodmap for all altgr and xkb for all higher levels just for alt, shift, and possibly an extra two levels.

    Also, I tried getting control on the caps layer with xdotool and xbindkeys today without success. I kind of wish that there was more remapping software for linux.

    Edit: Tried some stuff with xdo and sxhkd. Useless.

    Last edited by angelic_sedition (23-Jan-2014 01:09:52)
    Offline
    • 0