Make special characters available on US keyboard an Wayland
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: The World Wide Mind
--
Chapters
00:00 Make Special Characters Available On Us Keyboard An Wayland
00:54 Answer 1 Score 0
02:02 Accepted Answer Score 15
04:09 Thank you
--
Full question
https://superuser.com/questions/1160777/...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#linux #keyboardlayout #wayland
#avk47
ACCEPTED ANSWER
Score 15
Wayland uses XKB, but how to specify your layout varies based on your compositor (you can't use setxkbmap
or xkbcomp
as in Xorg). You'll probably want the altgr-intl
variant of the standard us
layout (US international layout) and possibly some options: Compose (aka Multi_key), perhaps on a Menu key? AltGr on the right Alt key? (The intl
variant is similar but includes deadkeys on level 1; altgr-intl
puts deadkeys on level 3, so they're out of the way but still accessible.)
Under this layout and variant, most of the symbols you've listed are available handily under the AltGr or Compose keys:
AltGr+q = ä AltGr+Shift+a = Ä Compose+",a = ä Compose+",A = Ä
AltGr+p = ö AltGr+Shift+p = Ö Compose+",o = ö Compose+",O = Ö
AltGr+y = ü AltGr+Shift+y = Ü Compose+",u = ü Compose+",U = Ü
AltGr+s = ß Compose+s,s = ß
For Weston, you'd add settings to $HOME/.config/weston.ini
:
[keyboard]
keymap_rules=evdev
keymap_layout=us
keymap_variant=altgr-intl
keymap_options=compose:menu,level3:ralt_switch
For sway (an i3-alike), you need to set environment variables before execution, either chained together on the commandline or in a helper script:
#!/bin/sh
export XKB_DEFAULT_LAYOUT=us
export XKB_DEFAULT_VARIANT=altgr-intl
export XKB_DEFAULT_OPTIONS=compose:menu,level3:ralt_switch
sway
Under GNOME, you'll have to consult your favorite gsettings
or dconf
frontend. You can specify XKB options in /org/gnome/desktop/input-sources/xkb-options
and specific layouts in /org/gnome/desktop/input-sources/sources
. (These may have changed since the post; check your existing settings.)
gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'us+altgr-intl')]"
gsettings set org.gnome.desktop.input-sources xkb-options "['compose:menu','lv3:ralt_switch']"
KDE uses its own graphical control panel; you'll find it in System Settings > Hardware > Input Devices > Keyboard. The Layouts tab will allow you to configure the altgr-intl
variant (it's listed as "English (international AltGr dead keys)"), and the XKB options are listed on the Advanced tab.
On current KDE Frameworks 5, this control panel stores settings in $HOME/.config/kxkbrc
.
If your system uses systemd's localectl
you might try setting that to what you'd want, and GNOME/KDE might be able to pick it up from there. That may only set things for Xorg at present, but I like having it as a fallback, and I hope Wayland compositors will use it in future releases to pick up systemwide preferences.
sudo localectl set-x11-keymap us pc105 altgr-intl compose:menu,level3:ralt_switch
(format: [layout] [model] [variant] [options])
ANSWER 2
Score 0
One possibility might be to change your default keyboard from English (US) to English (International). I do this on all the computers I have sufficient control over, and it lets me use some punctuation as "dead key" accents to get common non-English characters.
On Windows, this converts the right Alt key into AltGr, and combining this with certain keystrokes gets me related non-English characters, such as AltGr+s for sharp-s, AltGr+t for the Icelandic thorn, AltGr+d for the Icelandic edh, and others.
For "dead-key", most punctuation doubles as accents - to get e-acute, type ' then e; o-acute ' then o, a-grave ` then a, u-umlaut " then u, and so on. To get the punctuation, either press a character that it doesn't combine with as an accent, or press space - an apostrophe is ' then space; a double-quote/inch mark is " then space, and so on. It's a little bit of an adjustment, but a lot easier than memorizing alt-codes (on Windows) or continually switching between layouts.
(I've since done this in 'out-of-the-box' Linux Mint; modulo some minor differences in where some of the AltGr characters are located, ithas the same effect - but it's noy Wayland).