save and switch xfce (and other) themes
switching gtk themes is easy enough, but what about your window manager theme? fonts? icon set? cursor?! when you’re given the ability to customize so much it can be easy to get lost. thankfully, xfce has a wealth of commands related to setting the theme that make it possible to save a theme and load it at any time.
this can help with using light/dark themes interchangeably, distinguish between work/school time and personal time on the same computer, etc… (honestly, it reminds me a lot of having different wallpapers for different focus modes on ios)
this script allows you to change the theme manually with a simple command and argument. just put the script in your bash path and name it ‘theme’ or something similar, then enter ‘theme theme-name’. it can also be tweaked to be automated. for an example of a time-based theme switcher, see here.
it works by having a function to change various desktop environment settings, then other functions for each theme to set the variables that are fed into that function. it includes a lot of options because i’m picky and wanted to provide robust examples; and xfce offers even more options than the ones i’m using, but this could be as simple as setting a gtk theme and wallpaper. after the example are basic pointers for how to find the commands for the settings you want to save.
set-theme () {
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorDVI-I-1/workspace0/last-image -s "$wallpaper1"
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorHDMI-0/workspace0/last-image -s "$wallpaper2"
xfconf-query -c xsettings -p /Net/IconThemeName -s "$icons"
xfconf-query -c xsettings -p /Net/ThemeName -s "$gtk"
xfconf-query -c xfwm4 -p /general/theme -s "$xfwm"
xfconf-query -c xfwm4 -p /general/title_font -s "$windowtitlefont"
xfconf-query -c xsettings -p /Gtk/FontName -s "$systemfont"
xfconf-query -c xsettings -p /Gtk/MonospaceFontName -s "$monofont"
sed -i "/FontName/c\FontName=$terminalfont" $HOME/.config/xfce4/terminal/terminalrc
sed -i "/ColorForeground/c\ColorForeground=$terminalfontcolor" $HOME/.config/xfce4/terminal/terminalrc
sed -i "/ColorCursor/c\ColorCursor=$terminalfontcolor" $HOME/.config/xfce4/terminal/terminalrc
sed -i "/ColorBackground/c\ColorBackground=$terminalbg" $HOME/.config/xfce4/terminal/terminalrc
xfconf-query -c xfce4-panel -p /panels/panel-1/background-rgba -t double -s $red -t double -s $green -t double -s $blue -t double -s $alpha
xfconf-query --channel xfce4-panel --property /panels/dark-mode --set "$panellightdark"
gsettings set org.gnome.desktop.interface color-scheme "$gnomelightdark"
xfconf-query -c xfce4-notifyd -p /theme -s $notifications
xfconf-query -c xsettings -p /Gtk/CursorThemeName -s $cursor
sed -i "/@theme/c\@theme \"$rofi\"" $HOME/.config/rofi/config.rasi
}
oomox-gruvbox () {
wallpaper1="$HOME/Pictures/wallpaper/macos-macos-monterey-black_(copy_1)_fav_(downscaled-dark-dark.jpg"
wallpaper2="$HOME/Pictures/wallpaper/macos-macos-monterey-black_(copy_1)_fav_(downscaled-dark-dark.jpg"
icons="Papirus-Dark-Grey"
gtk="oomox-materia-gruvbox-2"
xfwm="oomox-adaptive-colors-wm-uniform"
windowtitlefont="Input Sans Condensed, Condensed 8"
systemfont="Input Sans Condensed, Condensed 10"
monofont="iA Writer Mono S Regular 10"
terminalfont="iA Writer Mono S Regular 11"
terminalfontcolor="#d035c6bea52e"
terminalcursor="#ffffffffffff"
terminalbg="#1d1d20202121"
panellightdark="true" # dark mode true
red="0.000000" green="0.000000" blue="0.000000" alpha="0.000000" #panel solid color - transparent
gnomelightdark="prefer-dark"
notifications="Retro"
cursor="Simp1e-Gruvbox-Dark"
rofi="$HOME/.local/share/rofi/themes/rounded-gruvbox-mine.rasi"
}
oomox-gray-light () {
wallpaper1="$HOME/Pictures/wallpaper/tumblr_ph418c_1280-horizontal-light.jpg"
wallpaper2="$HOME/Pictures/wallpaper/tumblr_ph418c_1280-horizontal-light.jpg"
icons="Papirus-Dark-Grey"
gtk="oomox-materia-gray-light"
xfwm="oomox-adaptive-colors-wm-uniform"
windowtitlefont="Input Sans Condensed, Condensed 8"
systemfont="Input Sans Condensed, Condensed 10"
monofont="iA Writer Mono S Regular 10"
terminalfont="iA Writer Mono S Regular 11"
terminalfontcolor="#1d1d20202121"
terminalcursor="#000000000000"
terminalbg="#e73fe73fe73f"
panellightdark="false" # dark mode false
red="0.000000" green="0.000000" blue="0.000000" alpha="0.000000" #panel solid color - transparent
gnomelightdark="prefer-light"
notifications="Bright"
cursor="Default"
rofi="$HOME/.local/share/rofi/themes/rounded-light-gray-mine.rasi"
}
nashville96-gruvbox () {
wallpaper1="$HOME/Pictures/wallpaper/minecraft-water-fav-horizontal-dark-medium.png"
wallpaper2="$HOME/Pictures/wallpaper/minecraft-water-fav-horizontal-dark-medium.png"
icons="SE98"
gtk="Nashville96-Gruvbox"
xfwm="Nashville96-Gruvbox"
windowtitlefont="Tahoma Regular 8"
systemfont="Tahoma Regular 10"
monofont="Terminus (TTF) 14"
terminalfont="Terminus (TTF) 14"
terminalfontcolor="#d035c6bea52e"
terminalcursor="#ffffffffffff"
terminalbg="#1d1d20202121"
panellightdark="true" # dark mode true
red="0.166667" green="0.166667" blue="0.166667" alpha="1.000000" #panel solid color - #282828
gnomelightdark="prefer-dark"
notifications="Retro"
cursor="Simp1e-Gruvbox-Dark"
rofi="$HOME/.local/share/rofi/themes/rounded-gruvbox-mine.rasi"
}
if [ "$#" -lt 1 ] # no argument
then
echo "possible arguments: 'list', 'shuffle', or theme name"
exit
elif [ "$1" == "list" ]; then
echo "list of available themes:"
echo "oomox-gruvbox"
echo "oomox-gray-light"
echo "nashville96-gruvbox"
exit
elif [ "$1" == "shuffle" ]; then # probably won't work well unless you have a lot of themes
$(shuf -e oomox-gruvbox oomox-gray-light nashville96-gruvbox | head -1)
elif [ "$1" == "oomox-gruvbox" ]; then
oomox-gruvbox
elif [ "$1" == "oomox-gray-light" ]; then
oomox-gray-light
elif [ "$1" == "nashville96-gruvbox" ]; then
nashville96-gruvbox
else # invalid arguments
echo "possible arguments: 'list', 'shuffle', or theme name"
exit
fi
set-theme
exit
saving theme elements
you can find the name for things in the Settings Editor app.
alternatively you can use the command line. this command watches the desktop environment for changes. basically, leave it running in a terminal as you change things via gui and it will tell you what certain settings are called (but not what you’re changing them to, for that look again in Settings Editor).
xfconf-query --channel xfce4-desktop --monitor
then change the wallpaper (to anything, we’re not committing yet) via the GUI. the terminal will output something like:
set: /backdrop/screen0/monitoreDP-1/workspace0/last-image
exclude set:
and paste that after -p
. then pick the wallpaper you want and paste its file path after -s
.
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitoreDP-1/workspace0/last-image -s /home/athena/Pictures/wallpaper/tumblr_771e305667d404e897917187d86a6f52_1eae66d3_2048.jpg
**
commands for changing settings look like this (all of the – flags can be abbreviated to just a dash and their first letter, like -c):
xfconf-query --channel xfce4-desktop --property /backdrop/screen0/monitorDVI-I-1/workspace0/last-image --set "/home/athena/Pictures/wallpaper/macos-wp11070508-imac-4k-wallpapers_3 (copy 1).png"
gtk theme
set via gui in the Appearance app. they’re stored in ~/.themes
or usr/share/themes
.
xfconf-query -c xsettings -p /Net/ThemeName -s "ChromeOS-Dark-UltraViolet"
xfwm window manager theme
set via gui in the Window Manager app. they’re also stored in ~/.themes
or usr/share/themes
(xfwm and gtk use different subdictories in a theme directory).
xfconf-query -c xfwm4 -p /general/theme -s "ChromeOS-Dark-UltraViolet"
window title font: xfconf-query -c xfwm4 -p /general/title_font -s "Input Sans Condensed, Condensed 8"
xfdesktop wallpaper
you can set the wallpaper by right clicking on the desktop or otherwise launching the Desktop app. some photo viewers and file managers also have the ability to set the xfce desktop wallpaper. wallpapers are stored wherever you decide to keep them or in usr/share/backgrounds
and usr/share/wallpapers
.
icon set
set via gui with the Appearance app. they’re stored in ~/.icons
or /usr/share/icons
.
xfconf-query -c xsettings -p /Net/IconThemeName -s "Solarized-Material-Violet"
xfconf-query -c xsettings -p /Net/IconThemeName -s "Papirus-Dark-Grey"
cursor theme
you can change the cursor theme via the Mouse and Touchpad gui app. they’re stored in …????? … xfconf-query -c xsettings -p /Gtk/CursorThemeName -s Simp1e-Gruvbox-Dark
/Gtk/CursorThemeName
xfce panel
to find panel IDs: xfconf-query -c xfce4-panel -p /panels
list possible settings: xfconf-query --channel 'xfce4-panel' --list | grep panel-1
or xfconf-query --channel 'xfce4-panel' --property '/panels/panel-1' --list
list current settings: xfconf-query -c xfce4-panel -p /panels/panel-1 -lv
set something: xfconf-query -c xfce4-panel -p /panels/panel-1/autohide -s true
xfconf-query --channel xfce4-panel --property /panels/dark-mode --set true
set panel color to solid gray (find rgba values in settings editor): xfconf-query -c xfce4-panel -p /panels/panel-1/background-rgba -t double -s 0.166667 -t double -s 0.166667 -t double -s 0.166667 -t double -s 1.000000
system fonts
they can be installed by clicking on them or by moving them to where they’re meant to be stored: ~/.fonts
, /usr/share/fonts
xfconf-query -c xsettings -p /Gtk/FontName -s "Input Sans Condensed, Condensed 10"
xfconf-query -c xsettings -p /Gtk/MonospaceFontName -s "Terminus (TTF) 12"
xfce notifyd
you can see what themes you have available for notifyd in the Notfications app. usually gtk themes don’t support it but it comes with a few different defaults. they’re stored in the same place as gtk and xfwm themes.
xfconf-query --channel 'xfce4-notifyd' --list
xfconf-query --channel 'xfce4-notifyd' --monitor
xfconf-query -c xfce4-notifyd -p /theme -s "ChromeOS-Dark-UltraViolet"
xfce4-terminal
the terminal preferences are stored in ~/.config/xfce4/terminal/terminalrc
. you should probably make a backup before using this script just in case, since it finds and replaces text within the config file.
terminal theme presets are .theme files and can be found in '/home/athena/.config/xfce4/terminal/colorschemes'
(make it if you don’t have one). they’re relatively easy to make if you have a template, and it’s also easy to create one via gui preferences and then copy it to text. (or this)
you can use sed -i
to search and replace lines containing a string in a text file. in this case, the xfce terminal config. you can use this same method for anything that has a text-based config (which is most things…), for example the application launcher rofi which i use instead of the default xfce/mint menus/launchers.
sed -i '/FontName/c\FontName=Terminus (TTF) 11' $HOME/.config/xfce4/terminal/terminalrc
sed -i '/@theme/c\@theme /home/athena/.local/share/rofi/themes/rounded-nord-dark.rasi' /home/athena/.config/rofi/config.rasi
sed -i '/@theme/c\@theme "/home/athena/.local/share/rofi/themes/rounded-gruvbox-mine.rasi"' /home/athena/.config/rofi/config.rasi
settings relating to appearance/theme:
FontName=
BackgroundDarkness=
BackgroundImageFile=
BackgroundImageShading=
BackgroundImageStyle=
ColorForeground= (font color)
ColorBackground= (bg color)
ColorCursor= ColorPalette=
TabActivityColor=
non-xfce elements
if you use any gnome
apps, you’ll probably want this: gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
sct
changes the screen color tempurature for the user only, the computer still sees normal colors. pick a number between 6500 (default, blueish) and 1000 (red). (it also goes up to 10000 but why would you want to make it bluer)