How should applications written in C access the cursor theme under Wayland?
21:37 27 Jun 2022

When writing an application in wayland, libwayland provides a way to load a cursor theme: via wl_cursor_theme_load.

When NULL is passed in the "default" theme is used, which will use a theme the user doesn't expect, given they have set their theme using their desktop environment or custom configuration.

There doesn't seem to be an API call to access the theme currently set by the user.

Checking this page it seems there are multiple ways to set the cursor theme.

Some ways to get the theme I've found include:

  • The command:
    gsettings get org.gnome.desktop.interface cursor-theme
  • DBUS requiest for org.gnome.desktop.interface, cursor-theme.
  • The environment variable XCURSOR_THEME.
  • Reading from the XDG specification ~/.icons/default/index.theme / /usr/share/icons/default/index.theme.

When writing an application (in C for e.g.), how should I access the current user theme that works across different desktop environments under Wayland?

mouse-cursor wayland