GNOME shell changes

Date: 2023/06/16 (initial publish), 2023/06/25 (last update)

Source: en/note-00044.md

Previous Post Top Next Post

TOC

This is how I resolved GNOME shell configuration trouble and came up as Debian Workstation (usability) (v2023) – Keyboard shortcut customization (GNOME Settings – custom shortcut)

Keyboad shortcuts stopped working

Since 2022, tricks written in my old キーボード入力モード選択 and its English translated description Debian Workstation (usability) (old)) – Keyboard shortcut customization (GNOME Settings) stopped working for me.

This breakage seemed to have happened with changes made in 2022.

My initial reaction to brokage of trick method was this may be caused by changes of javascript codes in gnome-shell.

GNOME post-40 releases have major changes from previous ones.

package bullseye (2021) bookworm (2023)
gnome-shell 3.38.6-1~deb11u1 43.4-1

Where in gnome-shell package can I find its javascript codes?

Older documentation such as “GNOME shell: Javascript Source Documentation (extensions development)” written in 2012 talks about javascript codes in /usr/share/gnome-shell/js/ui. But I don’t see them on my system.

Then I found “Where are gnome-shell’s UI javascript files on Ubuntu 20.04” written in 2020.

Now the whole javascript codes are packed into /usr/lib/gnome-shell/libgnome-shell.so. The javascript codes can be found in the original source tree or retrieved from installed /usr/lib/gnome-shell/libgnome-shell.so using gresource command.

Let’s check the original source tree under js

$ cd path/to/gnome-shell-43.4/js/ui
$ rg getInputSourceManager
status/keyboard.js
793:function getInputSourceManager() {
864:        this._inputSourceManager = getInputSourceManager();

keyboard.js
202:        let inputSourceManager = InputSourceManager.getInputSourceManager();
2172:        this._inputSourceManager = InputSourceManager.getInputSourceManager();
2240:            const inputSourceManager = InputSourceManager.getInputSourceManager();

Checking code around these lines for both versions used in bookworm (2023) and buster (2021), I don’t see much changes.

Getting start with “Looking Glass”

Looking Glass is GNOME Shell’s integrated debugger and inspector tool. It’s basic usage goes:

Tricks for the “Looking Glass” prompt

Testing under “Looking Glass”

I tested the following javascript snippet and its variants from “Looking Glass” prompt.

imports.ui.status.keyboard.getInputSourceManager().inputSources[0].activate()

This switched Input method to the first one. Using inputSources[1] instead swiched Input method to the second one. So this javascript code itself is still valid one.

So, problem is not javascript but its call via gdbus executed on the bash prompt.

$ gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval "imports.ui.status.keyboard.getInputSourceManager().inputSources[0].activate()"
(false, '')

This false looks suspicious.

Let me check if this calling was syntax correct by introspection:

$ gdbus introspect --session --dest org.gnome.Shell --object-path /org/gnome/Shell
node /org/gnome/Shell {
  ...
  interface org.gnome.Shell {
    methods:
      Eval(in  s script,
           out b success,
           out s result);
      ...
  };
  ...
};

So the calling syntax looks OK.

Root cause: gdbus error

Searching on “gdbus error” within 1 year lead me to the following articles.

It looks like now shellDBus restricts callers to block gdbus calls.

Workaround: Unsafe Mode Menu

I decided to install Unsafe Mode Menu and it worked!

This workaround was good enough to update Debian Workstation (usability) (v2023) – Keyboard shortcut customization (GNOME Settings – custom shortcut).

Note on code tracing

String match to find associated code points

I tried to find interesting code points from associated menu strings by running rg or rg -i command over source code trees.

So I need to search multiple packages to understand how GNOME desktop works and not all UI frontend codes such as ones in gnome-control-center are written in javascript.

I suppose I need to revisit this problem after learning GNOME.

What is a11y

Although many file names and directory names in the GNOME source code use intuitive names, a11y was a bit intriguing. a11y stands for ACCESSIBILITY.

Previous Post Top Next Post