Independent tech desk · no vendor sponsorshipPractical answers, not release notes
Numix Desk for the Linux desktop, open source and the machines we use every day

ThemingWhat To Do If X Failed

The Mouse Cursor Stays Default in Some Applications: Why, and the Fix per Toolkit

One table of the source of truth per application family and the setting that overrides it

Acer computer mouse on paper
Photo: Bhullargraphic / Wikimedia Commons · CC BY-SA 4.0
On this page
  1. GTK reads its own settings
  2. Qt falls back differently
  3. When X resources beat the desktop
  4. Why one application ignores settings
  5. Xwayland and mixed sessions
  6. What remains unproven
  7. Conclusion
  8. Sources

A desktop-wide category is not the only source of truth for cursor symbols.

Linux allows users to apply a cursor theme at the desktop level, But applying a cursor theme to display it on all graphical windows requires more configuration due to toolkit-specific behavior. For native applications, the first stop in finding a working cursor symbol is the toolkit the application is built on.

GTK reads its own settings

To set a cursor symbol in GTK 3 applications, check ~/.config/gtk-3.0/settings.ini, and the lines beginning with gtk-cursor-theme-name= and gtk-cursor-theme-size=. For GTK 2, check ~/.gtkrc-2.0. If the theme name is present, it can override a desktop-wide setting. Setting either gtk-cursor-theme-name or gtk-cursor-theme-size in these files can make the built-in cursor icons used in GTK 3 or GTK 2 applications take on the named or sized theme.

Qt falls back differently

Qt applications inherit cursor icons from their host desktop environment, X resources from ~/.kde/share/config/kdeglobals or ~/.Xresources, or the default, system-installed cursors, in that order. Each of these may give a different priority to Xresources and toolkit settings. The path surveyed for cursor icons, in Qt, must contain the cursor theme files it is set to use. This includes the slots: /usr/share/icons, /usr/local/share/icons, and ~/.local/share/icons. XCURSOR_PATH can be exported to help Qt discover installed symbols.

When X resources beat the desktop

Before most graphical applications are launched, they run X resources defined in ~/.Xresources. Firefox et al will read this every time they start unless they have their own symbol file specified in their own config. Suppose ~/.Xresources contains Xcursor.theme: <theme>. In that case, all graphical applications including those currently running on the X display will immediately begin to use the theme specified, whether or not their own configuration has made a statement about cursor themes.

Accordingly, exporting it from the desktop environment configs like settings.conf may not suffice for Qt applications. In such cases, it is recommended to add this information in ~/.xresources or ~/.Xresources.

Xcursor.theme is not the only X resource that may appear here. Firefox on Linux may use its own scale. Adobe Photoshop may use a different system to arrive at the scaled cursor.

Why one application ignores settings

XCURSOR_THEME=Adwaita was already exported in a user’s profile, and the same value was imported into ~/.kde/share/config/kdeglobals, yet Firefox was still not using the Adwaita cursor. The Arch Wiki forum suggests cloning Adwaita Desktop icons into ~/.themes/Adwaita. But it does not provide the inferred reason. Adding gtk-cursor-theme-name=Adwaita to ~/.config/gtk-3.0/settings.ini did apply the named cursor to Firefox.

Xwayland and mixed sessions

Xwayland can derive its cursor theme from XCURSOR_THEME, and that variable is fed with the value from the GTK setting. To make this inherited variable visible to all applications that are started by the display manager, like X11 splash screens, log jammed popup windows, and even AppLaunchcheck, it is recommended to export the variable from the display manager's configuration, like the profile or.xinitrc configuration.

~/.icons/default/index.theme or /usr/share/icons/default/index.theme can sometimes be fed the cursor symbol parameter. But this method is known to work inconsistently across distributions.

What remains unproven

We have not established how Electron apps or Wine games choose their cursor symbol, as the documentation has been silent. Applications that do not inherit cursor context from the desktop environment do not change their cursor natively.

How the Window rules system assigns cursor context for startup windows like login screens has also not been established.

Conclusion

Cursor context in Linux is toolkit specific. To apply a themed mouse cursor to all graphical windows, users must configure each of their toolkits, set xresources, set xwindowstartup settings, and ensure that their display manager has applied the same default. The flicker of mouse theme inconsistency arises due to these artifacts of composability and may be resolved by replicating cursor settings across the applications, not taking any one setting as definitive.

Sources

More from the desk