• You are not logged in.

    Colemak "special characters" (AltrGr+[\]) for Linux/X11

    • Started by ghen
    • 6 Replies:
    • Reputation: 23
    • From: Belgium
    • Registered: 26-Feb-2008
    • Posts: 482

    https://colemak.com/Multilingual states that the "special characters" section of the layout is "MS Windows/Mac only", but here's a way to have them on X11, too.

    You need to pick an unused dead key (eg. "dead_semivoiced_sound") and assign it to the magic AltGr+[\] key:
    * xmodmap -e "keycode 51 = backslash bar backslash bar dead_semivoiced_sound"
    * or modify the Colemak xkb file and replace the first "asciitilde" on the <BKSL> key by "dead_semivoiced_sound".

    Then you need to create an .XCompose file in your homedir to create custom dead key sequences:

    # ~/.XCompose
    # This file defines custom Compose sequence for Unicode characters 
    
    # Import default rules from the system Compose file:
    # include "/usr/X11R7/lib/X11/locale/en_US.UTF-8/Compose"
    include "%L"
    
    # Colemak special characters
    # from https://colemak.com/Multilingual
    <dead_semivoiced_sound> <c>             : "©"   copyright       # COPYRIGHT SIGN
    <dead_semivoiced_sound> <r>             : "®"   registered      # REGISTERED SIGN
    <dead_semivoiced_sound> <t>             : "™"   U2122           # TRADE MARK SIGN
    <dead_semivoiced_sound> <d>             : "°"   degree          # DEGREE SIGN
    <dead_semivoiced_sound> <m>             : "µ"   mu              # MICRO SIGN
    <dead_semivoiced_sound> <n>             : "№"   numerosign      # NUMERO SIGN
    <dead_semivoiced_sound> <p>             : "¶"   paragraph       # PILCROW SIGN
    <dead_semivoiced_sound> <s>             : "§"   section         # SECTION SIGN
    <dead_semivoiced_sound> <period>        : "…"   ellipsis        # HORIZONTAL ELLIPSIS
    <dead_semivoiced_sound> <plus>          : "±"   plusminus       # PLUS-MINUS SIGN
    <dead_semivoiced_sound> <equal>         : "≠"   U2260           # NOT EQUAL TO
    <dead_semivoiced_sound> <less>          : "≤"   U2264           # LESS-THAN OR EQUAL TO
    <dead_semivoiced_sound> <greater>       : "≥"   U2265           # GREATER-THAN OR EQUAL TO
    <dead_semivoiced_sound> <asciitilde>    : "≈"   U2248           # ALMOST EQUAL TO
    <dead_semivoiced_sound> <percent>       : "‰"   U2030           # PER MILLE SIGN
    <dead_semivoiced_sound> <bar>           : "¦"   brokenbar       # BROKEN BAR

    You can pick any other unused dead key (locate keysymdef.h on your system for a list), and you can of course assign it to any key you want (I find AltGr+[\] a bit hard to reach).

    Note that on X11, all this is in fact quite unnecessary as you can type all these symbols (and many more!) using standard Compose key sequences, but this way you type them "the Colemak way" and equivalent on different platforms.

    Last edited by ghen (14-Jan-2019 11:19:57)
    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,360

    Thanks, that looks neat!

    I do wish that Colemak would follow suit and use the intuitive positions for dead keys such as AltGr+' for the acute, AltGr+` for grave, AltGr+; for diaeresis etc.; I think Linux users are used to those?

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

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

    Okay, I tried putting this in my home dir (Ubuntu 12.04):

    # ~/.XCompose
    # This file defines custom Compose sequence for Unicode characters 
    
    # First, include either the default English or the current locale file
    include "/usr/share/X11/locale/en_US.UTF-8/Compose"
    # include "%L"
    
    # Compose sequences put together by DreymaR, 2012
    # Usage: Add these to the Compose file for your locale/encoding
    #        or maybe better, to an ~/.XCompose file
    
    # Super-/subscripts by dead acute/grave
    # NOTE: Compose traditionally has dead_circumflex for superscripts
    #       but no dead key for subscripts
    # TODO: There are lots of MODIFIER LETTER SMALLs and such...
    <dead_acute> <2>            : "²" U00B2 # SUPERSCRIPT TWO
    <dead_acute> <KP_2>            : "²" U00B2 # SUPERSCRIPT TWO
    <dead_acute> <3>            : "³" U00B3 # SUPERSCRIPT THREE
    <dead_acute> <KP_3>            : "³" U00B3 # SUPERSCRIPT THREE
    <dead_acute> <1>            : "¹" U00B9 # SUPERSCRIPT ONE
    <dead_acute> <KP_1>            : "¹" U00B9 # SUPERSCRIPT ONE
    <dead_acute> <0>            : "⁰" U2070 # SUPERSCRIPT ZERO
    <dead_acute> <KP_0>            : "⁰" U2070 # SUPERSCRIPT ZERO
    <dead_acute> <4>            : "⁴" U2074 # SUPERSCRIPT FOUR
    <dead_acute> <KP_4>            : "⁴" U2074 # SUPERSCRIPT FOUR
    <dead_acute> <5>            : "⁵" U2075 # SUPERSCRIPT FIVE
    <dead_acute> <KP_5>            : "⁵" U2075 # SUPERSCRIPT FIVE
    <dead_acute> <6>            : "⁶" U2076 # SUPERSCRIPT SIX
    <dead_acute> <KP_6>            : "⁶" U2076 # SUPERSCRIPT SIX
    <dead_acute> <7>            : "⁷" U2077 # SUPERSCRIPT SEVEN
    <dead_acute> <KP_7>            : "⁷" U2077 # SUPERSCRIPT SEVEN
    <dead_acute> <8>            : "⁸" U2078 # SUPERSCRIPT EIGHT
    <dead_acute> <KP_8>            : "⁸" U2078 # SUPERSCRIPT EIGHT
    <dead_acute> <9>            : "⁹" U2079 # SUPERSCRIPT NINE
    <dead_acute> <KP_9>            : "⁹" U2079 # SUPERSCRIPT NINE
    <dead_acute> <plus>            : "⁺" U207A # SUPERSCRIPT PLUS SIGN
    <dead_acute> <KP_Add>            : "⁺" U207A # SUPERSCRIPT PLUS SIGN
    <dead_acute> <U2212>            : "⁻" U207B # SUPERSCRIPT MINUS
    <dead_acute> <equal>            : "⁼" U207C # SUPERSCRIPT EQUALS SIGN
    <dead_acute> <KP_Equal>            : "⁼" U207C # SUPERSCRIPT EQUALS SIGN
    <dead_acute> <parenleft>        : "⁽" U207D # SUPERSCRIPT LEFT PARENTHESIS
    <dead_acute> <parenright>        : "⁾" U207E # SUPERSCRIPT RIGHT PARENTHESIS
    #<dead_circumflex> <dead_acute> <a>    : "ª" U00AA # FEMININE ORDINAL INDICATOR
    #<dead_circumflex> <dead_acute> <o>    : "º" U00BA # MASCULINE ORDINAL INDICATOR
    #<dead_circumflex> <dead_acute> <i>    : "ⁱ" U2071 # SUPERSCRIPT LATIN SMALL LETTER I
    #<dead_circumflex> <dead_acute> <n>    : "ⁿ" U207F # SUPERSCRIPT LATIN SMALL LETTER N
    #<dead_circumflex> <dead_acute> <S>    : "℠" U2120 # SERVICE MARK
    #<dead_circumflex> <dead_acute> <T>    : "™" U2122 # TRADE MARK SIGN
    <dead_grave> <0>            : "₀" U2080 # SUBSCRIPT ZERO
    <dead_grave> <KP_0>            : "₀" U2080 # SUBSCRIPT ZERO
    <dead_grave> <1>            : "₁" U2081 # SUBSCRIPT ONE
    <dead_grave> <KP_1>            : "₁" U2081 # SUBSCRIPT ONE
    <dead_grave> <2>            : "₂" U2082 # SUBSCRIPT TWO
    <dead_grave> <KP_2>            : "₂" U2082 # SUBSCRIPT TWO
    <dead_grave> <3>            : "₃" U2083 # SUBSCRIPT THREE
    <dead_grave> <KP_3>            : "₃" U2083 # SUBSCRIPT THREE
    <dead_grave> <4>            : "₄" U2084 # SUBSCRIPT FOUR
    <dead_grave> <KP_4>            : "₄" U2084 # SUBSCRIPT FOUR
    <dead_grave> <5>            : "₅" U2085 # SUBSCRIPT FIVE
    <dead_grave> <KP_5>            : "₅" U2085 # SUBSCRIPT FIVE
    <dead_grave> <6>            : "₆" U2086 # SUBSCRIPT SIX
    <dead_grave> <KP_6>            : "₆" U2086 # SUBSCRIPT SIX
    <dead_grave> <7>            : "₇" U2087 # SUBSCRIPT SEVEN
    <dead_grave> <KP_7>            : "₇" U2087 # SUBSCRIPT SEVEN
    <dead_grave> <8>            : "₈" U2088 # SUBSCRIPT EIGHT
    <dead_grave> <KP_8>            : "₈" U2088 # SUBSCRIPT EIGHT
    <dead_grave> <9>            : "₉" U2089 # SUBSCRIPT NINE
    <dead_grave> <KP_9>            : "₉" U2089 # SUBSCRIPT NINE
    <dead_grave> <plus>            : "₊" U208A # SUBSCRIPT PLUS SIGN
    <dead_grave> <KP_Add>            : "₊" U208A # SUBSCRIPT PLUS SIGN
    <dead_grave> <U2212>            : "₋" U208B # SUBSCRIPT MINUS
    <dead_grave> <equal>            : "₌" U208C # SUBSCRIPT EQUALS SIGN
    <dead_grave> <KP_Equal>            : "₌" U208C # SUBSCRIPT EQUALS SIGN
    <dead_grave> <parenleft>        : "₍" U208D # SUBSCRIPT LEFT PARENTHESIS
    <dead_grave> <parenright>        : "₎" U208E # SUBSCRIPT RIGHT PARENTHESIS
    
    # Fractions by dead stroke (eights) and macron (sixths/fifths)
    <dead_stroke> <1>            : "⅛"    U215B # VULGAR FRACTION ONE EIGHTH
    <dead_stroke> <2>            : "\274"    onequarter
    <dead_stroke> <3>            : "⅜"    U215C # VULGAR FRACTION THREE EIGHTHS
    <dead_stroke> <4>            : "\275"    onehalf
    <dead_stroke> <5>            : "⅝"    U215D # VULGAR FRACTION FIVE EIGHTHS
    <dead_stroke> <6>            : "\276"    threequarters
    <dead_stroke> <7>            : "⅞"    U215E # VULGAR FRACTION SEVEN EIGHTHS
    <dead_macron> <1>            : "⅙"    U2159 # VULGAR FRACTION ONE SIXTH
    <dead_macron> <2>            : "⅓"    U2153 # VULGAR FRACTION ONE THIRD
    <dead_macron> <3>            : "\275"    onehalf
    <dead_macron> <4>            : "⅔"    U2154 # VULGAR FRACTION TWO THIRDS
    <dead_macron> <5>            : "⅚"    U215A # VULGAR FRACTION FIVE SIXTHS
    <dead_macron> <6>            : "⅕"    U2155 # VULGAR FRACTION ONE FIFTH
    <dead_macron> <7>            : "⅖"    U2156 # VULGAR FRACTION TWO FIFTHS
    <dead_macron> <8>            : "⅗"    U2157 # VULGAR FRACTION THREE FIFTHS
    <dead_macron> <9>            : "⅘"    U2158 # VULGAR FRACTION FOUR FIFTHS
    
    # Stroke dead key
    <dead_stroke> <O>            : "Ø" U00D8 # LATIN CAPITAL LETTER O WITH STROKE
    <dead_stroke> <o>            : "ø" U00F8 # LATIN SMALL LETTER O WITH STROKE
    <dead_stroke> <d>            : "đ" dstroke
    <dead_stroke> <D>            : "Đ" Dstroke
    <dead_stroke> <H>            : "Ħ" U0126 # LATIN CAPITAL LETTER H WITH STROKE
    <dead_stroke> <h>            : "ħ" U0127 # LATIN SMALL LETTER H WITH STROKE
    <dead_stroke> <L>            : "Ł" U0141 # LATIN CAPITAL LETTER L WITH STROKE
    <dead_stroke> <l>            : "ł" U0142 # LATIN SMALL LETTER L WITH STROKE
    <dead_stroke> <T>            : "Ŧ" U0166 # LATIN CAPITAL LETTER T WITH STROKE
    <dead_stroke> <t>            : "ŧ" U0167 # LATIN SMALL LETTER T WITH STROKE
    <dead_stroke> <b>            : "ƀ" U0180 # LATIN SMALL LETTER B WITH STROKE
    <dead_stroke> <I>            : "Ɨ" U0197 # LATIN CAPITAL LETTER I WITH STROKE
    <dead_stroke> <i>            : "ɨ" U0268 # LATIN SMALL LETTER I WITH STROKE
    <dead_stroke> <Z>            : "Ƶ" U01B5 # LATIN CAPITAL LETTER Z WITH STROKE
    <dead_stroke> <z>            : "ƶ" U01B6 # LATIN SMALL LETTER Z WITH STROKE
    <dead_stroke> <G>            : "Ǥ" U01E4 # LATIN CAPITAL LETTER G WITH STROKE
    <dead_stroke> <g>            : "ǥ" U01E5 # LATIN SMALL LETTER G WITH STROKE
    <dead_acute> <dead_stroke> <O>        : "Ǿ" U01FE # LATIN CAPITAL LETTER O WITH STROKE AND ACUTE
    <dead_acute> <dead_stroke> <o>        : "ǿ" U01FF # LATIN SMALL LETTER O WITH STROKE AND ACUTE
    <dead_acute> <Ø>            : "Ǿ" U01FE # LATIN CAPITAL LETTER O WITH STROKE AND ACUTE
    <dead_acute> <ø>            : "ǿ" U01FF # LATIN SMALL LETTER O WITH STROKE AND ACUTE
    <dead_stroke> <U0294>            : "ʡ" U02A1 # LATIN LETTER GLOTTAL STOP WITH STROKE
    <dead_stroke> <Cyrillic_GHE>        : "Ғ" U0492 # CYRILLIC CAPITAL LETTER GHE WITH STROKE
    <dead_stroke> <Cyrillic_GHE>        : "Ғ" U0492 # CYRILLIC CAPITAL LETTER GHE WITH STROKE
    <dead_stroke> <Cyrillic_ghe>        : "ғ" U0493 # CYRILLIC SMALL LETTER GHE WITH STROKE
    <dead_stroke> <Cyrillic_ghe>        : "ғ" U0493 # CYRILLIC SMALL LETTER GHE WITH STROKE
    <dead_stroke> <Cyrillic_KA>        : "Ҟ" U049E # CYRILLIC CAPITAL LETTER KA WITH STROKE
    <dead_stroke> <Cyrillic_KA>        : "Ҟ" U049E # CYRILLIC CAPITAL LETTER KA WITH STROKE
    <dead_stroke> <Cyrillic_ka>        : "ҟ" U049F # CYRILLIC SMALL LETTER KA WITH STROKE
    <dead_stroke> <Cyrillic_ka>        : "ҟ" U049F # CYRILLIC SMALL LETTER KA WITH STROKE
    <dead_stroke> <U04ae>            : "Ұ" U04B0 # CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE
    <dead_stroke> <U04ae>            : "Ұ" U04B0 # CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE
    <dead_stroke> <U04af>            : "ұ" U04B1 # CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE
    <dead_stroke> <U04af>            : "ұ" U04B1 # CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE
    <dead_stroke> <leftarrow>        : "↚" U219A # LEFTWARDS ARROW WITH STROKE
    <dead_stroke> <rightarrow>        : "↛" U219B # RIGHTWARDS ARROW WITH STROKE
    <dead_stroke> <U2194>            : "↮" U21AE # LEFT RIGHT ARROW WITH STROKE
    <dead_stroke> <U2203>            : "∄" U2204 # THERE DOES NOT EXIST
    <dead_stroke> <U2208>            : "∉" U2209 # NOT AN ELEMENT OF
    <dead_stroke> <U220b>            : "∌" U220C # DOES NOT CONTAIN AS MEMBER
    <dead_stroke> <U2223>             : "∤" U2224 # DOES NOT DIVIDE
    <dead_stroke> <U2225>             : "∦" U2226 # NOT PARALLEL TO
    <dead_stroke> <U223c>             : "≁" U2241 # NOT TILDE
    <dead_stroke> <U2243>            : "≄" U2244 # NOT ASYMPTOTICALLY EQUAL TO
    <dead_stroke> <approximate>        : "≇" U2247 # NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO
    <dead_stroke> <U2248>            : "≉" U2249 # NOT ALMOST EQUAL TO
    <dead_stroke> <equal>            : "≠" U2260 # NOT EQUAL TO
    <dead_stroke> <KP_Equal>        : "≠" U2260 # NOT EQUAL TO
    <dead_stroke> <identical>        : "≢" U2262 # NOT IDENTICAL TO
    <dead_stroke> <U224d>            : "≭" U226D # NOT EQUIVALENT TO
    <dead_stroke> <less>            : "≮" U226E # NOT LESS-THAN
    <dead_stroke> <leftcaret>        : "≮" U226E # NOT LESS-THAN
    <dead_stroke> <greater>            : "≯" U226F # NOT GREATER-THAN
    <dead_stroke> <rightcaret>        : "≯" U226F # NOT GREATER-THAN
    <dead_stroke> <lessthanequal>        : "≰" U2270 # NEITHER LESS-THAN NOR EQUAL TO
    <dead_stroke> <greaterthanequal>    : "≱" U2271 # NEITHER GREATER-THAN NOR EQUAL TO
    <dead_stroke> <U2272>            : "≴" U2274 # NEITHER LESS-THAN NOR EQUIVALENT TO
    <dead_stroke> <U2273>            : "≵" U2275 # NEITHER GREATER-THAN NOR EQUIVALENT TO
    <dead_stroke> <U2276>            : "≸" U2278 # NEITHER LESS-THAN NOR GREATER-THAN
    <dead_stroke> <U2277>            : "≹" U2279 # NEITHER GREATER-THAN NOR LESS-THAN
    <dead_stroke> <U227a>            : "⊀" U2280 # DOES NOT PRECEDE
    <dead_stroke> <U227b>            : "⊁" U2281 # DOES NOT SUCCEED
    <dead_stroke> <includedin>        : "⊄" U2284 # NOT A SUBSET OF
    <dead_stroke> <leftshoe>        : "⊄" U2284 # NOT A SUBSET OF
    <dead_stroke> <includes>        : "⊅" U2285 # NOT A SUPERSET OF
    <dead_stroke> <rightshoe>        : "⊅" U2285 # NOT A SUPERSET OF
    <dead_stroke> <U2286>            : "⊈" U2288 # NEITHER A SUBSET OF NOR EQUAL TO
    <dead_stroke> <U2287>            : "⊉" U2289 # NEITHER A SUPERSET OF NOR EQUAL TO
    <dead_stroke> <righttack>        : "⊬" U22AC # DOES NOT PROVE
    <dead_stroke> <U22a8>            : "⊭" U22AD # NOT TRUE
    <dead_stroke> <U22a9>            : "⊮" U22AE # DOES NOT FORCE
    <dead_stroke> <U22ab>            : "⊯" U22AF # NEGATED DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE
    <dead_stroke> <U227c>            : "⋠" U22E0 # DOES NOT PRECEDE OR EQUAL
    <dead_stroke> <U227d>            : "⋡" U22E1 # DOES NOT SUCCEED OR EQUAL
    <dead_stroke> <U2291>            : "⋢" U22E2 # NOT SQUARE IMAGE OF OR EQUAL TO
    <dead_stroke> <U2292>            : "⋣" U22E3 # NOT SQUARE ORIGINAL OF OR EQUAL TO
    <dead_stroke> <U22b2>            : "⋪" U22EA # NOT NORMAL SUBGROUP OF
    <dead_stroke> <U22b3>            : "⋫" U22EB # DOES NOT CONTAIN AS NORMAL SUBGROUP
    <dead_stroke> <U22b4>            : "⋬" U22EC # NOT NORMAL SUBGROUP OF OR EQUAL TO
    <dead_stroke> <U22b5>            : "⋭" U22ED # DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL
    
    # Musical and other signs (could end up elsewhere?)
    <dead_doubleacute> <!>            : "♭" U266d # MUSIC FLAT SIGN
    <dead_doubleacute> <@>            : "♮" U266e # MUSIC NATURAL SIGN
    <dead_doubleacute> <numbersign>        : "♯" U266f # MUSIC SHARP SIGN
    
    #<dead_doubleacute> <o>            : "№" numerosign # NUMERO SIGN
    #<dead_doubleacute> <Cyrillic_o>        : "№" numerosign # NUMERO SIGN
    
    <dead_doubleacute> <exclam>        : "⸘"   U2E18 # INVERTED INTERROBANG
    <dead_doubleacute> <question>        : "‽"   U203D # INTERROBANG
    
    <dead_doubleacute> <parenright>        : "☺"   U263A # WHITE SMILING FACE
    <dead_doubleacute> <parenleft>        : "☹"   U2639 # WHITE FROWNING FACE

    Didn't work it seems? Any idea why?

    Last edited by DreymaR (18-Dec-2012 22:45:01)

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

    Offline
    • 0
    • Reputation: 23
    • From: Belgium
    • Registered: 26-Feb-2008
    • Posts: 482

    I guess you're using Gnome.  GTK apps by default use their own input method, which doesn't honor the compose key at all.

    Setting GTK_IM_MODULE=xim in the environment should make this work.  First, try exporting that in a terminal window and run a GTK app from there.  If it works, you can add it to /etc/environment and reboot to make it work accoss the entire session (there may be better ways but this depends on how you start Gnome, from xinit or gdm or ...).

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

    Actually, now I remember: I tried setting GTK_IM_MODULE=xim (still on Ubuntu 12.04 vanilla). What happens then is that all dead keys become disabled. :(

    I did it by editing the /etc/environment, like you suggest. I tried typing 'export GTK_IM_MODULE=xim' and then 'leafpad' in a term window just now and the same thing happens then.

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

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

    How would I go about making this work with Ubuntu now?

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

    Offline
    • 0
    • Reputation: 23
    • From: Belgium
    • Registered: 26-Feb-2008
    • Posts: 482

    I have no experience with Ubuntu specifically, but this has been working for me for years on different platforms, specifically NetBSD and Arch Linux.

    One thing I fixed in the above documentation is the include of the standard Compose file for the current locale — its path may differ on different platforms, but include "%L" will include your system default one regardless.

    What DE are you using?  I use "light" window managers like i3 and xfc4e.  And do other (standard, not Colemak) Compose sequences work for you at all?

    Last edited by ghen (15-Jan-2019 09:38:53)
    Offline
    • 0