Bash – Change Xfce Theme from bash script

bashthemexfce

I have a convertible notebook, and am writing a bash script to change from standard desktop to tablet mode. I am running XFCE.

Currently, the script is switching reading the orientation from a built-in accelerator on and off, but I want it to also switch the XFCE theme programmatically.

Apparently, xfce4-settings-manager does not have any command line options to switch the theme, and gtk-theme-switcher2 does not apply options for the scrollbar – which is one of the things that are larger with the theme that I want to switch to.

Is there any way to do that from command line?

Best Answer

Try xfconf-query like this

xfconf-query -c xsettings -p /Net/ThemeName -s "Greybird"

Where you can replace Greybird with the name of your theme. With quotes if it's not a single word, so e.g. "Ambiance-XFCE-LXDE-Yellow" must be also in quotes.

Now if what you want is to change only some parts of your current theme, not switching to a different theme altogether, then this won't help. In that case I would suggest making multiple copies of your theme, naming them "My Neat Theme 1" "My neat Theme 2" and so on; make the modifications on each one, for each particular need and finally just switch between those themes using xfconf-query.

Related Question