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.
- 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/"
- sessions:
plasma
- desktops:
kde
$ kreadconfig5 --group Icons --key Theme
- sessions:
xfce
- desktops:
xfce
$ xfconf-query -c xsettings -p /Net/IconThemeName
- sessions:
cinnamon
,cinnamon2d
- desktops:
x-cinnamon
$ dconf read /org/cinnamon/desktop/interface/icon-theme | sed -E "s/^'(.+)'$/\1/"
- sessions:
mate
- desktops:
mate
$ dconf read /org/mate/desktop/interface/icon-theme | sed -E "s/^'(.+)'$/\1/"
- 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
- sessions:
deepin
- desktops:
deepin
$ dconf read /com/deepin/dde/appearance/icon-theme | sed -E "s/^'(.+)'$/\1/"
- sessions:
enlightenment
- desktops:
enlightenment
$ eet -d $HOME/.e/e/config/e.cfg | grep '"icon_theme"' | sed -E 's/^.+:\s*"(.+)".+$/\1/'