The script also restarts Audacious (music player), which I usually have running, and applies a light/dark theme to that, as well. This is the only way I've found to change the Audacious skin with a script.
Am I using any commands that I shouldn't be or am I doing something incorrectly?
It works most of the time, but the crash is unexpected and I can't figure it out.
Thanks.
Code: Select all
#!/bin/bash
# Get current theme
theme=$(gsettings get org.cinnamon.theme name)
#echo "Current theme is $theme"
if [ $theme = "'Mint-Y-Aqua'" ]; then
#echo "Setting evening theme..."
# Set light coloured panel icon for timer applet
# (This has to be done manually for this applet since it doesn't switch its symbolic icon)
cp ~/timer_cinnamon_applet_stylesheet_light.css ~/.local/share/cinnamon/applets/cinnamon-timer@jake1164/3.4/stylesheet.css
sleep 1.3
# Controls:
gsettings set org.cinnamon.desktop.interface gtk-theme "Mint-Y-Dark-Aqua"
# This was missing for a long while, some applications wouldn't switch - but this fixed it.
# Found it via the "Dark Mode" panel applet.
gsettings set org.gnome.desktop.interface color-scheme prefer-dark
# Mouse pointer:
settings set org.cinnamon.desktop.interface cursor-theme 'DMZ-Black'
# Desktop: (this changes the bottom bar, primarily)
gsettings set org.cinnamon.theme name "Mint-Y-Dark-Aqua"
sleep 1.3
# Wallpaper:
gsettings set org.cinnamon.desktop.background picture-uri 'file:///usr/share/backgrounds/linuxmint-ulyssa/echerkasski_countryside.jpg'
sleep 1.3
# Switch Xed editor theme to get light/dark Preview popups ('Preview' is when selecting a file and pressing Spacebar)
# (From https://forums.linuxmint.com/viewtopic.php?t=356810 and https://askubuntu.com/questions/305225/how-to-clean-gedits-and-other-editors-findreplace-history and https://askubuntu.com/questions/487206/dconf-change-a-string-key, used gsettings list-recursively org.x.editor to get the list of all the keys for Xed)
gsettings set org.x.editor.preferences.editor scheme "cobalt"
sleep 1.3
# Change Audacious media player theme and restart it to apply the change (from https://redmine.audacious-media-player.org/boards/1/topics/3001?r=3004)
playback_status=$(audtool --playback-status)
#echo $playback_status
audtool config-set skins:skin "/usr/share/audacious/Skins/Default"
sleep 1.3
// Restart Audacious
audtool --playback-pause
audtool --shutdown
sleep 1.3
if [ $playback_status = "playing" ]; then
audacious -p & # Start Audacious playing since it was playing when it was stopped
else
audacious &
fi
sleep 1.3
else
#echo "Setting daytime theme"
# (This has to be done manually for this applet since it doesn't switch its symbolic icon)
cp ~/timer_cinnamon_applet_stylesheet_dark.css ~/.local/share/cinnamon/applets/cinnamon-timer@jake1164/3.4/stylesheet.css
sleep 1.3
# Controls:
gsettings set org.cinnamon.desktop.interface gtk-theme "Mint-Y-Aqua"
# Have to set this when switching to light mode, or else prefer-dark won't work when switching to dark mode.
gsettings set org.gnome.desktop.interface color-scheme prefer-light
# Mouse pointer:
settings set org.cinnamon.desktop.interface cursor-theme 'DMZ-Black'
# Desktop: (this changes the bottom bar, primarily)
gsettings set org.cinnamon.theme name "Mint-Y-Aqua"
sleep 1.3
# Wallpaper:
gsettings set org.cinnamon.desktop.background picture-uri 'file:///usr/share/backgrounds/linuxmint-ulyana/aandrews_tree.jpg'
sleep 1.3
# Switch Xed editor theme to get light/dark Preview popups ('Preview' is when selecting a file and pressing Spacebar)
# (From https://forums.linuxmint.com/viewtopic.php?t=356810 and https://askubuntu.com/questions/305225/how-to-clean-gedits-and-other-editors-findreplace-history and https://askubuntu.com/questions/487206/dconf-change-a-string-key, used gsettings list-recursively org.x.editor to get the list of all the keys for Xed)
gsettings set org.x.editor.preferences.editor scheme "classic"
sleep 1.3
# Change Audacious media player theme and restart it to apply the change (from https://redmine.audacious-media-player.org/boards/1/topics/3001?r=3004)
playback_status=$(audtool --playback-status)
#echo $playback_status
audtool config-set skins:skin "/usr/share/audacious/Skins/Classic"
sleep 1.3
audtool --playback-pause
audtool --shutdown
sleep 1.3
if [ $playback_status = "playing" ]; then
audacious -p & # Start Audacious playing since it was playing when it was stopped
else
audacious &
fi
sleep 1.3
fi