Linux Mint Xfce Icons Style Change Daily (Every few hours)

Style your desktop
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Post Reply
User avatar
290LC
Level 1
Level 1
Posts: 1
Joined: Thu Jan 11, 2024 2:42 pm
Location: UK, London

Linux Mint Xfce Icons Style Change Daily (Every few hours)

Post by 290LC »

Hi, this post is about automating a cyclical switchover of desktop icon appearance. Basically, in Linux Mint Xfce, I want my desktop icons style to change ever so often during the day.

This sort of thing isn't really available online through whatever means (e.g. programs or setups) but I saw this post and am interested in implementing it (focus on the replies from smurphos [can't reply to that thread or him directly because I just joined the forum], the script looks quite good): viewtopic.php?t=299808.

Can someone check this out and then walk me through executing it with a description if you can (preference if you're that kind enough), or a video if you're able (top preference if you are the kindest)? I would really appreciate it and I really think it would be really very useful within the community in general, it's a great idea that they executed on the post.

🙏🏿
Last edited by SMG on Thu Jan 11, 2024 4:12 pm, edited 1 time in total.
Reason: Moved from Beginner Questions (which are to be quick and easy to answer) to Themes, Icons, & Wallpapers because this is a request for a customization of icon changes.
🙏🏿
michael-hi
Level 4
Level 4
Posts: 302
Joined: Sun Mar 19, 2017 2:31 pm

Re: Linux Mint Xfce Icons Style Change Daily (Every few hours)

Post by michael-hi »

Hello 290LC

The thread you linked to relates only to Cinnamon, but you may also be interested in this thread which contains variants of that original script by smurphos (for Cinnamon and Xfce) so as to make it change the desktop wallpaper at set times of the day. In fact, I still use it on my own laptop.
viewtopic.php?p=2153971

However, to instead make it change the Xfce icon theme as you request, you could try the following:

Code: Select all

#!/bin/sh
# 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 ICON_CHOICE & NEXT_TIME
  if [ "$CURRENT_TIME" -ge 0000 ] && [ "$CURRENT_TIME" -lt 0200 ]; then
    ICON_CHOICE=Mint-Y-Red
    NEXT_TIME=0200
  elif [ "$CURRENT_TIME" -ge 0200 ] && [ "$CURRENT_TIME" -lt 0600 ]; then
    ICON_CHOICE=Mint-Y-Purple
    NEXT_TIME=0600
  elif [ "$CURRENT_TIME" -ge 0600 ] && [ "$CURRENT_TIME" -lt 1000 ]; then
    ICON_CHOICE=Mint-Y-Aqua
    NEXT_TIME=1000
  elif [ "$CURRENT_TIME" -ge 1000 ] && [ "$CURRENT_TIME" -lt 1400 ]; then
    ICON_CHOICE=Mint-Y-Navy
    NEXT_TIME=1400
  elif [ "$CURRENT_TIME" -ge 1400 ] && [ "$CURRENT_TIME" -lt 1800 ]; then
    ICON_CHOICE=Mint-Y-Sand
    NEXT_TIME=1800
  elif [ "$CURRENT_TIME" -ge 1800 ] && [ "$CURRENT_TIME" -lt 2200 ]; then
    ICON_CHOICE=Mint-Y-Orange
    NEXT_TIME=2200
  elif [ "$CURRENT_TIME" -ge 2200 ] && [ "$CURRENT_TIME" -le 2359 ]; then
    ICON_CHOICE=Mint-Y-Red
    NEXT_TIME=0000
  fi
# Set the chosen icon theme
  xfconf-query -c xsettings -p /Net/IconThemeName -s "$ICON_CHOICE"
# Sleep
  sleep 60
done
Copy the above script into a text editor and, obviously, change the actual times and icon themes to suit. Then save it as timeofday_icontheme.sh or similar. Then right-click on its file icon, select Properties and on the Permissions tab tick the box to allow the file to run as a program.

To test the script, open a terminal in the folder containing the file and enter ./timeofday_icontheme.sh
To make it automatically run at every login you could place it directly in your home folder and then go to the Application Autostart tab of Session and Startup in the Settings menu. Click Add and put suitable brief descriptions in the first two boxes and then ./timeofday_icontheme.sh in the Command box.

I note though that the script in the thread you linked to changes the Appearance theme as well as the icon theme. You could perhaps extend the above example so as to add the Appearance theme and/or the Window manager theme as well, eg with this alternative version:

Code: Select all

#!/bin/sh
# 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, ICON_CHOICE, WINDOW_CHOICE & NEXT_TIME
  if [ "$CURRENT_TIME" -ge 0000 ] && [ "$CURRENT_TIME" -lt 0200 ]; then
    THEME_CHOICE=Mint-Y-Dark-Red
    ICON_CHOICE=Mint-Y-Red
    WINDOW_CHOICE=Mint-Y-Dark-Red
    NEXT_TIME=0200
  elif [ "$CURRENT_TIME" -ge 0200 ] && [ "$CURRENT_TIME" -lt 0600 ]; then
    THEME_CHOICE=Mint-Y-Dark-Purple
    ICON_CHOICE=Mint-Y-Purple
    WINDOW_CHOICE=Mint-Y-Dark-Purple
    NEXT_TIME=0600
  elif [ "$CURRENT_TIME" -ge 0600 ] && [ "$CURRENT_TIME" -lt 1000 ]; then
    THEME_CHOICE=Mint-Y-Dark-Aqua
    ICON_CHOICE=Mint-Y-Aqua
    WINDOW_CHOICE=Mint-Y-Dark-Aqua
    NEXT_TIME=1000
  elif [ "$CURRENT_TIME" -ge 1000 ] && [ "$CURRENT_TIME" -lt 1400 ]; then
    THEME_CHOICE=Mint-Y-Dark
    ICON_CHOICE=Mint-Y-Navy
    WINDOW_CHOICE=Mint-Y-Dark
    NEXT_TIME=1400
  elif [ "$CURRENT_TIME" -ge 1400 ] && [ "$CURRENT_TIME" -lt 1800 ]; then
    THEME_CHOICE=Mint-Y-Dark-Sand
    ICON_CHOICE=Mint-Y-Sand
    WINDOW_CHOICE=Mint-Y-Dark-Sand
    NEXT_TIME=1800
  elif [ "$CURRENT_TIME" -ge 1800 ] && [ "$CURRENT_TIME" -lt 2200 ]; then
    THEME_CHOICE=Mint-Y-Dark-Orange
    ICON_CHOICE=Mint-Y-Orange
    WINDOW_CHOICE=Mint-Y-Dark-Orange
    NEXT_TIME=2200
  elif [ "$CURRENT_TIME" -ge 2200 ] && [ "$CURRENT_TIME" -le 2359 ]; then
    THEME_CHOICE=Mint-Y-Dark-Red
    ICON_CHOICE=Mint-Y-Red
    WINDOW_CHOICE=Mint-Y-Dark-Red
    NEXT_TIME=0000
  fi
# Set the themes chosen above
  xfconf-query -c xsettings -p /Net/ThemeName -s "$THEME_CHOICE"
  xfconf-query -c xsettings -p /Net/IconThemeName -s "$ICON_CHOICE"
  xfconf-query -c xfwm4 -p /general/theme -s "$WINDOW_CHOICE"
# Sleep
  sleep 60
done
Perhaps save it as timeofday_themes.sh or similar. I've only briefly tested the two above examples, but hopefully one of them will work for you without any unforeseen problems. In the sections containing the times, note that the first Current Time must always be 0000 and the last Current time 2359, with the final Next Time as 0000.

Also note that in the current version of Xfce the Appearance settings window has an option to "Set matching Xfwm4 theme if there is one". I have assumed this is Off because I don't know if it also works for scripted theme changes. If it does, there might not be any need to set a window theme in the script...

I will respectfully decline the suggestion to produce a video...lol :lol:

PS. There is also the possibility of adding the Xfce4 Timer Plugin to the panel. This has the option of running commands at set times, so it might be possible to make it run a command such as xfconf-query -c xsettings -p /Net/IconThemeName -s Mint-Y-Pink
I haven't tried it though.
https://docs.xfce.org/panel-plugins/xfc ... ugin/start
Post Reply

Return to “Themes, Icons & Wallpaper”