Skip to content

Instantly share code, notes, and snippets.

@Darkhogg
Created October 5, 2023 22:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Darkhogg/96453f6221cc90cd2ab8d201d7ab3bd1 to your computer and use it in GitHub Desktop.
Save Darkhogg/96453f6221cc90cd2ab8d201d7ab3bd1 to your computer and use it in GitHub Desktop.
Get Icon Theme in every Desktop

Get Icon Theme in Every Desktop

If you've ever tried to manually look for the current icon theme, you've probably come to the (correct) conclusion that it's simply impossible to do it in a portable way: each desktop environment in existence stores that information in a different place, and it's none give out that info in a common way.

In order to find out the current icon theme then, we first need to find out the current desktop environment and only then we can get the current icon theme in a desktop-dependent way. To do that, we can use the following environemnt variables:

  • XDG_SESSION_DESKTOP: contains the name of the current session name.
  • XDG_CURRENT_DESKTOP: contains a :-separated list of current desktop names.

The difference between the two escapes my current knowledge, but I've compiled the values I've found for each desktop anyway. What follows is a list of desktop environments in no particular order, the values for the two variables, and the simplest way in which you can check for the current icon theme.

Note: All of the listed values are in lowercase, as I did not record their casing when initially listing them all, sorry.

GNOME

  • sessions: gnome-xorg, gnome-wayland, gnome-classic-xorg, gnome-classic-wayland
  • desktops: gnome, gnome-classic
$ dconf read /org/gnome/desktop/interface/icon-theme | sed -E "s/^'(.+)'$/\1/"

KDE Plasma

  • sessions: plasma
  • desktops: kde
$ kreadconfig5 --group Icons --key Theme

XFCE

  • sessions: xfce
  • desktops: xfce
$ xfconf-query -c xsettings -p /Net/IconThemeName

Cinnamon

  • sessions: cinnamon, cinnamon2d
  • desktops: x-cinnamon
$ dconf read /org/cinnamon/desktop/interface/icon-theme | sed -E "s/^'(.+)'$/\1/"

Mate

  • sessions: mate
  • desktops: mate
$ dconf read /org/mate/desktop/interface/icon-theme | sed -E "s/^'(.+)'$/\1/"

Budgie

  • sessions: budgie-desktop
  • desktops: budgie
$ dconf read /org/gnome/desktop/interface/icon-theme | sed -E "s/^'(.+)'$/\1/"

Note: Not a typo, Budgie simply uses the Gnome dconf key

Deepin

  • sessions: deepin
  • desktops: deepin
$ dconf read /com/deepin/dde/appearance/icon-theme | sed -E "s/^'(.+)'$/\1/"

Enlightenment

  • sessions: enlightenment
  • desktops: enlightenment
$ eet -d $HOME/.e/e/config/e.cfg | grep '"icon_theme"' | sed -E 's/^.+:\s*"(.+)".+$/\1/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment