Well done, that should help people find it.
[SOLVED] A way to schedule Cinnamon theme changes
Forum rules
Before you post please read how to get help
Before you post please read how to get help
Re: Looking for a hack to change appearance over time.

If your issue is solved, kindly indicate that by editing the first post in the topic, and adding [SOLVED] to the title. Thanks!
Re: Looking for a hack to change appearance over time.
Those links are helpful. I can see one mistake I made in setting up my systemd service. I will try again and report back.smurphos wrote: ↑Mon Aug 19, 2019 2:08 amI haven't got time right now, but I'll see if I can get the systemd service working my end and will update with instructions assuming I'm successful.
It was the answer starting as below that at a glance looked to be the correct approach.
This answer is based on askubuntu.com/a/661747/394818 (as also referred to in the comment by @sun-bear), askubuntu.com/q/616272/394818 and superuser.com/a/1269158/585953.
Using a system service:
Re: Looking for a hack to change appearance over time.
The example .service file in the second answer of the link you provided looks like it should work. I followed the directions: uncommented the user and environment lines and change the user value to my username. However I have not been able to get it to work. I can register and start the theme-by-time.service successfully, but I can’t get it to run the theme-by-time script on wake from sleep.smurphos wrote: ↑Sun Aug 18, 2019 2:41 pmAlso see https://unix.stackexchange.com/question ... emd-wakeup for running the script automatically on wakeup from suspend using a systemd service.
If I register and start the theme-by-time.service file using the systemctrl --user option the .service file will immediately call the script and change the theme, which is what it’s supposed to do. The --user mode doesn’t understand the references to suspend.target, etc. so it runs the script immediately.
So I made some progress, but I’m not sure where to go from here.
Re: Looking for a way to schedule Cinnamon theme changes
OK a slightly different approach that avoids the long sleeps and the need to worry about the effect of suspend / resume. As written the script wakes every 60 seconds to quickly check the CURRENT_TIME against the NEXT_TIME. If NEXT_TIME is in the future it will go back to sleep. If not it will apply the correct theme for the CURRENT_TIME, and then go back to sleep.
Code: Select all
#!/bin/dash
# Kill if already running
if pidof -o %PPID -x "${0##*/}"; then
exit 1
fi
# Start loop
while :
do
# What time is it?
CURRENT_TIME=$(date +%H%M)
if [ -n "$NEXT_TIME" ] && [ "$CURRENT_TIME" -lt "$NEXT_TIME" ]; then
sleep 60
continue
fi
# Depending on time set THEME_CHOICE & NEXT_TIME
if [ "$CURRENT_TIME" -ge 0000 ] && [ "$CURRENT_TIME" -lt 0200 ]; then
THEME_CHOICE=Mint-Y-Dark-Red
NEXT_TIME=0200
elif [ "$CURRENT_TIME" -ge 0200 ] && [ "$CURRENT_TIME" -lt 0600 ]; then
THEME_CHOICE=Mint-Y-Dark-Purple
NEXT_TIME=0600
elif [ "$CURRENT_TIME" -ge 0600 ] && [ "$CURRENT_TIME" -lt 1000 ]; then
THEME_CHOICE=Mint-Y-Dark-Aqua
NEXT_TIME=1000
elif [ "$CURRENT_TIME" -ge 1000 ] && [ "$CURRENT_TIME" -lt 1400 ]; then
THEME_CHOICE=Mint-Y-Dark
NEXT_TIME=1400
elif [ "$CURRENT_TIME" -ge 1400 ] && [ "$CURRENT_TIME" -lt 1800 ]; then
THEME_CHOICE=Mint-Y-Dark-Sand
NEXT_TIME=1800
elif [ "$CURRENT_TIME" -ge 1800 ] && [ "$CURRENT_TIME" -lt 2200 ]; then
THEME_CHOICE=Mint-Y-Dark-Orange
NEXT_TIME=2200
elif [ "$CURRENT_TIME" -ge 2200 ] && [ "$CURRENT_TIME" -le 2359 ]; then
THEME_CHOICE=Mint-Y-Dark-Red
NEXT_TIME=0000
fi
# Set the chosen theme
gsettings set org.cinnamon.desktop.interface gtk-theme "$THEME_CHOICE"
gsettings set org.cinnamon.desktop.interface icon-theme "$THEME_CHOICE"
gsettings set org.cinnamon.theme name "$THEME_CHOICE"
# Sleep
sleep 60
done
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
Re: Looking for a way to schedule Cinnamon theme changes
That script looks like a winner! It passes all of my tests.
Edit: For those who are interested, here are the installation instructions:
Copy and paste the code into a text file.
Save it as theme-by-time.sh
Put the file in ~/.local/bin/
Make the file executable.
with this terminal command:
Code: Select all
chmod +x ~/.local/bin/theme-by-time.sh
To make the script run at startup, go to System Preferences: Startup Items.
Click the + sign and fill in the blanks
Name: Theme by Time
Command: /home/[your username]/.local/bin/theme-by-time.sh
or, click on the browse button, navigate to ~/.local/bin/ and select the script
Description: changes theme colors during the day
Startup Delay: 0
To activate the script, log out, restart, or in file manager double click on theme-by-time.sh.
Notes:
Adding the startup item will create a theme-by-time desktop file in ~/.config/autostart/
If you want to change the schedule times, be sure to change all three places in the script where the time is specified. Do not change the 2359 end time or the 0000 start time.
Re: [SOLVED] A way to schedule Cinnamon theme changes
Hey guys,
Thanks for the script. It's working quite nicely.
Is it possible that the Linux Mint team integrates this into Cinnamon itself? Perhaps give us a screen where we can choose which themes we want to apply at what time? It would be a much better way of approaching to solving this issue, compared to a script. Much more user friendly.
By the way, I'm only using two themes, Adapta and Adapta-Nokto. One for the day, the other for the afterhours. They're really well integrated into cinnamon.
Thanks for the script. It's working quite nicely.

Is it possible that the Linux Mint team integrates this into Cinnamon itself? Perhaps give us a screen where we can choose which themes we want to apply at what time? It would be a much better way of approaching to solving this issue, compared to a script. Much more user friendly.
By the way, I'm only using two themes, Adapta and Adapta-Nokto. One for the day, the other for the afterhours. They're really well integrated into cinnamon.