Home / Alt manpages / gtk-query-settings(1)

  • gtk-query-settings(1)
  • User command
  • linux

Inspect GTK 3 Settings with gtk-query-settings

gtk-query-settings dumps every GTK 3 property a running desktop session can see, from double-click timing to the active icon theme. This walks through reading the full list, filtering it to one property, and saving a snapshot for later comparison, using libgtk-3-bin version 3.24.41-4ubuntu1.3 on this machine. Allow about ten minutes. You need a shell and access to the display whose GTK settings you want to inspect.

It is read-only. It does not edit GTK configuration, change a theme or restart an application, and reaching for sudo the moment a display error appears is the wrong move: the command normally needs the right graphical session, not root privileges.

1. Confirm the installed command

Check which executable your shell will run and record the package version:

$ command -v gtk-query-settings
/usr/bin/gtk-query-settings
$ dpkg-query -W -f='${Package} ${Version}\n' libgtk-3-bin
libgtk-3-bin 3.24.41-4ubuntu1.3

The local manual gives the complete interface as gtk-query-settings [PATTERN]. There is no switch for changing a value, selecting a profile or writing a configuration file: the optional argument is a filter, not an assignment.

Checkpoint

If the command is missing, install or repair libgtk-3-bin through your normal package-management process. That is an administrative change and sits outside this read-only inspection.

2. Run it inside the target graphical session

With a working desktop display, run the command without a pattern:

$ gtk-query-settings
              gtk-double-click-time: 400
          gtk-double-click-distance: 5
                   gtk-cursor-blink: TRUE
              gtk-cursor-blink-time: 1200
              gtk-cursor-blink-timeout: 10
                   gtk-split-cursor: TRUE
            gtk-cursor-aspect-ratio: 0.040000
                     gtk-theme-name: "Yaru"
                gtk-icon-theme-name: "Yaru"
                     gtk-font-name: "Sans 10"

The exact list and values come from the GTK settings object for that display, so they vary with desktop environment, theme, session and GTK build. Each line is a property name, a colon, and its current value: a quoted string, a boolean, a number, or NULL for something unset. Do not treat the example values above as universal defaults.

On a headless shell, a remote session without display forwarding, or a terminal outside the desktop session, GTK may print cannot open display: and return status 1. Check the display environment and session ownership before assuming the tool is broken:

$ printf 'DISPLAY=%s\n' "${DISPLAY-}"
DISPLAY=:0
$ printf 'XDG_SESSION_TYPE=%s\n' "${XDG_SESSION_TYPE-}"
XDG_SESSION_TYPE=x11
$ gtk-query-settings >/tmp/gtk-settings.txt
$ printf 'exit status: %s\n' "$?"
exit status: 0

Your DISPLAY value may differ, and a Wayland desktop can still expose one through the GTK stack. Run the command as the user who owns the graphical session: guessing a display value or copying an authentication cookie from another account creates a security problem, not a fix.

3. Filter for a property

Pass one pattern when the full listing is more noise than signal. The command matches the pattern against property names, so this shows the font-related properties:

$ gtk-query-settings font
                      gtk-font-name: "Sans 10"
           gtk-fontconfig-timestamp: 0

A more specific pattern gives one property:

$ gtk-query-settings gtk-font-name
                      gtk-font-name: "Sans 10"

The filter is not a shell wildcard. A pattern that matches nothing can produce no output while still returning status 0:

$ gtk-query-settings definitely-not-a-real-setting
$ printf 'exit status: %s\n' "$?"
exit status: 0

So an empty result means "nothing matched" only once you have confirmed the command had display access and completed successfully. It does not mean every GTK setting is unset.

4. Avoid shell expansion when experimenting

Do not pass an unquoted * or a pattern with shell metacharacters. Your shell expands those before gtk-query-settings ever sees them, and a stray filename in the working directory can end up as the argument. Quote a literal pattern instead:

$ gtk-query-settings 'gtk-font'
                      gtk-font-name: "Sans 10"
           gtk-fontconfig-timestamp: 0

For normal diagnosis, a short literal such as font, cursor or theme keeps the command readable and stops you confusing a shell glob with the program's own filter.

5. Save and compare a settings snapshot

Redirect the output when you are investigating a machine or comparing two sessions. The destination is ordinary user data, so pick a path you can write to and will not overwrite a capture you still need:

$ snapshot="/tmp/gtk-settings-$(date +%Y%m%d-%H%M%S).txt"
$ gtk-query-settings >"$snapshot"
$ status=$?
$ if [ "$status" -eq 0 ]; then
>     wc -l <"$snapshot"
>     grep -E 'gtk-(font|theme|icon-theme)-' "$snapshot"
> else
>     printf 'gtk-query-settings failed with status %s\n' "$status" >&2
>     rm -f -- "$snapshot"
> fi

The rm in the failure branch only removes the temporary snapshot it just created; it is not a repair command. Keep a successful snapshot for the comparison you need, and check its contents before you delete a capture that documents a fault.

6. Read the result as a snapshot, not persistent configuration

gtk-query-settings reports what is available to the GTK process it starts. GTK 3's GtkSettings documentation describes session-wide values, desktop XSettings managers and fallback settings.ini files under locations such as /etc/gtk-3.0 and the XDG configuration directories, and an application can override a setting for itself on top of all of that. So this command is evidence about the current session, not proof that one file holds every effective value for every GTK application.

  • Use it for focused questions. Which theme name is visible, what font string is reported, whether animations are on, what pointer timings a session exposes.
  • Chase outliers at the application level. If one application differs from the rest, check its own options and startup environment rather than the session-wide dump.
  • Do not edit settings.ini on a hunch. An unexpected reported value is not proof a config file is wrong, and rewriting one will not touch an application that is already running.
  • Match the GTK version. This executable is GTK 3.24.41 from the package version above; the upstream documentation covers library version 3.24. Do not copy a property name from a different GTK 3 release, or from GTK 4.

Done means

  • Package confirmed. libgtk-3-bin and the gtk-query-settings executable are the versions you expect.
  • Ran as the right user. The command executed as the graphical-session user with display access, not through sudo.
  • Pattern quoted. Any filter was a literal, quoted string rather than an unquoted shell pattern.
  • Empty results checked properly. A filtered result with no output was checked alongside the exit status before you called it "unset".
  • Snapshot handled deliberately. Any saved output went to a chosen path and was never mistaken for persistent configuration.