Since the early 3.x versions I'm using the GNOME desktop environment. I like the lean environment, while still having the possibility to adapt things to my needs (by regular setup, with dconf-editor or with extensions). But I'm aware that sometimes the GNOME developers are making our users' life difficult when functionality is changed a bit too much or extensions suddenly are not compatible anymore. At the time of writing I'm on GNOME 46.

GNOME (not anymore) on Xorg

Being used to X (Xorg) since many years, I kept using GNOME on Xorg (until recently). For example, I had personalized key mappings within an Xmodmap file (preferring a US keyboard but still wanting to easily type German Umlauts and other non-ASCII characters):

keycode  30 = u U udiaeresis Udiaeresis
keycode  32 = o O odiaeresis Odiaeresis
keycode  38 = a A adiaeresis Adiaeresis
keycode  39 = s S ssharp
...
!! Alt_L:
keycode  64  = Mode_switch
!! Control_R:
keycode 105 = Multi_key

Similarly, I'm using an Xresources file to configure e.g. the XTerm terminal to my needs (I always found some limitations with gnome-terminal that kept me from using it).

One of my setup steps thus always was to enable the line “WaylandEnable=false” in /etc/gdm/custom.conf. Furthermore, within my user account I had a little autostart script to load the Xresources and Xmodmap:

#!/usr/bin/bash
if [ $# -gt 0 ]; then
  sleep $1 # wait for GNOME to settle
fi
if [ -e /etc/X11/xinit/Xmodmap ]; then
  xmodmap /etc/X11/xinit/Xmodmap
fi
if [ -e $HOME/.Xmodmap ]; then
  xmodmap $HOME/.Xmodmap
fi
if [ -e /etc/X11/xinit/Xresources ]; then
  xrdb -load /etc/X11/xinit/Xresources
fi
if [ -e $HOME/.Xresources ]; then
  xrdb -merge $HOME/.Xresources
fi

The sleep parameter here allows to wait a little, to allow for the system to settle before taking action.

Gnome-shell Crashing

Recently I have bought a new laptop (with the latest Intel Meteor Lake hardware, of course) and have been installing Arch Linux here as well. Somehow, “GNOME on Xorg” here is crashing, gnome-shell dumps core. This can be seen in the system journal:

May 19 14:51:41 *** systemd-coredump[1631]: [🡕] Process 1609 (gnome-shell) of user *** dumped core.
                                               Stack trace of thread 1609:
                                               #0  0x00007132d60a8e44 n/a (libc.so.6 + 0x94e44)
                                               #1  0x00007132d6050a30 raise (libc.so.6 + 0x3ca30)
                                               #2  0x00005f188ed2913d n/a (gnome-shell + 0x313d)
                                               #3  0x00007132d6050ae0 n/a (libc.so.6 + 0x3cae0)
                                               #4  0x00007132d6946ad8 g_log_structured_array (libglib-2.0.so.0 + 0x61ad8)
                                               ...

With that the screen turns black, either the GDM login screen or upon logging in as user. When running GDM in Wayland mode, but logging in as user with “GNOME on Xorg”, one can get back to the GDM login screen via a remote (root) login and performing: “killall -u <user>”.

Remedy seems to be to run just “GNOME” (on Wayland) now, which doesn't crash. That means to also find ways of getting e.g. my key mappings functional here again.

GNOME on Wayland

No More gnome-shell Restart

First of all, restarting gnome-shell with Super+F2 and “r” doesn't work anymore. Wayland uses gnome-shell as display manager, which cannot be restarted.

Environment Variables

Wayland also isn't starting a login shell under the hood. That means any ~/.profile (or ~/.login) will not be sourced. If there is any need to set personal environment variables, this can be done within any ~/.config/environment.d/*.conf files instead. Note that these files only support simple syntax, like:

VAR=value
VAR=$REF
VAR=${REF}
VAR=${REF:-default}      # default if $REF is empty
VAR=${REF:+alternative}  # alternative if $REF is not empty

Keyboard Setup

Then, keyboard control is available via regular GNOME setup and optionally also via the Tweaks program. The keyboard settings, under “Special Character Entry”, allow to define the key to use for entering “Alternate Characters” (the “Mode_switch” key for Xorg) and the key to use as “Compose” key (the “Multi_key” key for Xorg). Latter allows to enter special characters by pressing after each other the “Compose” key, a first character and a second character, to combine those two characters. For example, pressing “Compose”, “a” and “e” will produce “æ”. Pressing “Compose”, “1” and “2” will produce “½”, etc. Possible combinations normally can be found in the file /usr/share/X11/locale/en_US.UTF-8/Compose.

Now, to get back my Xmodmap key mappings for entering “Alternate Characters”, two files need to be provided, which then allow to select a customized input source (again via the keyboard settings). These files can be provided on a user basis (under ~/.config/xkb/) or system-wide (under /etc/xkb/).

My current mappings, for example, as /etc/xkb/symbols/campacasa:

xkb_symbols "campacasa" {
  include "us(basic)"
  name[Group1] = "English (US, Campacasa)";

  //            plain           shift           alt                     shift-alt

  key <TLDE> {[ grave,          asciitilde,     leftsinglequotemark,    leftdoublequotemark     ]};

  key <AE01> {[ 1,              exclam,         onesuperior,            exclamdown              ]};
  key <AE02> {[ 2,              at,             twosuperior                                     ]};
  key <AE03> {[ 3,              numbersign,     threesuperior                                   ]};
  key <AE05> {[ 5,              percent,        EuroSign                                        ]};
  key <AE08> {[ 8,              asterisk,       8,                      degree                  ]};
  key <AE11> {[ minus,          underscore,     endash,                 emdash                  ]};

  key <AD03> {[ e,              E,              ediaeresis,             Ediaeresis              ]};
  key <AD04> {[ r,              R,              registered                                      ]};
  key <AD05> {[ t,              T,              trademark                                       ]};
  //                                            ij ligature             IJ ligature
  key <AD06> {[ y,              Y,              U0133,                  U0132                   ]};
  key <AD07> {[ u,              U,              udiaeresis,             Udiaeresis              ]};
  key <AD08> {[ i,              I,              idiaeresis,             Idiaeresis              ]};
  key <AD09> {[ o,              O,              odiaeresis,             Odiaeresis              ]};
  key <AD10> {[ p,              P,              phonographcopyright                             ]};

  key <AC01> {[ a,              A,              adiaeresis,             Adiaeresis              ]};
  key <AC02> {[ s,              S,              ssharp                                          ]};
  key <AC06> {[ h,              H,              leftarrow                                       ]};
  key <AC07> {[ j,              J,              downarrow                                       ]};
  key <AC08> {[ k,              K,              uparrow                                         ]};
  key <AC09> {[ l,              L,              rightarrow                                      ]};

  key <AC11> {[ apostrophe,     quotedbl,       rightsinglequotemark,   rightdoublequotemark    ]};
  key <BKSL> {[ backslash,      bar,            backslash,              brokenbar               ]};

  key <AB02> {[ x,              X,              multiply                                        ]};
  key <AB03> {[ c,              C,              copyright                                       ]};
  key <AB07> {[ m,              M,              mu                                              ]};
  key <AB08> {[ comma,          less,           periodcentered,         guillemotleft           ]};
  key <AB09> {[ period,         greater,        ellipsis,               guillemotright          ]};
  key <AB10> {[ slash,          question,       division,               questiondown            ]};

  key <SPCE> {[ space,          space,          hairspace,              digitspace              ]};

  include "level3(lalt_switch)"
};

For the possible key codes, check the “basic” entry within /usr/share/X11/xkb/symbols/us (from Arch Linux package xkeyboard-config). For the possible mappings, check the names without “XK_” within /usr/include/X11/keysymdef.h (from Arch Linux package xorgproto).

The required related meta data, for example, as /opt/local/etc/xkb/rules/evdev.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xkbConfigRegistry SYSTEM "xkb.dtd">
<xkbConfigRegistry version="1.1">
  <layoutList>
    <layout>
      <configItem>
          <name>campacasa</name>
          <shortDescription>campacasa-us</shortDescription>
          <description>English (US, Campacasa)</description>
          <countryList>
            <iso3166Id>US</iso3166Id>
          </countryList>
          <languageList>
            <iso639Id>eng</iso639Id>
          </languageList>
      </configItem>
    </layout>
  </layoutList>
</xkbConfigRegistry>

The keyboard settings then should offer “English (US, Campacasa)” as choice for the “English (United States)” input source (one may need to logout and login again first). Note that in the above I'm defining Left-Alt as only “alternate character” key, to keep Right-Alt available for other functionality (just “ralt_switch” could also be used).

If all is syntactically correct, the keyboard settings should also allow to view the new keyboard layout. Note that the combinations with the “alternate character” key might not be shown when using lalt_switch in the above, while still functional.

Setting Up Multiple Compose Keys

When working with different keyboard layouts (e.g. laptop's own and external keyboard) multiple “Compose” keys can be defined by manually updating the related dconf-editor entry for it. Find following item:

/org/gnome/desktop/input-sources --> xkb-options

If, for example, the “Menu” key initially was defined as “Compose” key, the list value will contain:

[..., 'compose:menu']

Simply add another value, for example the “Print Screen” key:

[..., 'compose:menu', 'compose:prsc']

Both will be working as “Compose” key then. To find the exact naming convention for the possible keys, just change the “Compose” key definition in the keyboard settings and dconf-editor will show the changed value (which then can be adapted there again).

X11 Backend for Programs

Wayland disables the X11 backend for programs by default. One of my own programs is using the GtkSocket functionality, which will not work. This can be easily worked around by setting the environment variable GDK_BACKEND to x11 for this program.

To continue using XTerm with my desired configuration, I still need the autostart script to load (only) the Xresources as mentioned earlier on this page.

It's actually Xwayland taking care of this.


Built with Pelican · © 2024 Peter Kamphuis