5

Is it possible change desktop theme In each hour

Bruno Pereira
  • 72,895
  • 33
  • 199
  • 223
Tachyons
  • 17,221
  • 18
  • 74
  • 116
  • make a script that reads from a list of themes and changes the theme. have it run every $TIME by setting it up in cron. GTK theme: gconftool-2 --type=string -s /desktop/gnome/interface/gtk_theme Clearlooks Metacity: gconftool-2 --type=string -s /apps/metacity/general/theme Clearlooks Icons: gconftool-2 --type=string -s /desktop/gnome/interface/icon_theme gnome Wallpaper: gconftool-2 -t str --set /desktop/gnome/background/picture_filename "/usr/share/backgrounds/gnome.png" – zeitue Apr 09 '12 at 08:49
  • Good suggestion ,but I am not bash expert – Tachyons Apr 09 '12 at 09:15
  • Do you want to change the background image or the whole theme? – lumbric Apr 09 '12 at 09:53
  • Whole theme ,including gtk,windowo-border &icon theme – Tachyons Apr 09 '12 at 10:07

2 Answers2

2

here I wrote you some scripts to do random settings using gconf.

ChangeGTKTheme

#!/bin/bash
if [ "$1" == "random" ]; then
files=(~/.themes/*)
base=$(basename "${files[RANDOM % ${#files[@]}]}")
gconftool-2 --type=string -s /desktop/gnome/interface/gtk_theme $base
else
if [  "$1" == "" ];  then
    echo "Usage: $0 GTK_theme_name"
    echo "or $0 random  / for a random pick"
else
#GTK theme
gconftool-2 --type=string -s /desktop/gnome/interface/gtk_theme $1
 fi
fi

ChangeBackground

#!/bin/bash
if [ "$1" == "random" ]; then
files=(~/.backgrounds/*)
gconftool-2 -t str --set /desktop/gnome/background/picture_filename  "${files[RANDOM % ${#files[@]}]}"
else
if [  "$1" == "" ];  then
    echo "Usage: $0 path/to/background"
    echo "or $0 random  / for a random pick"
else
#Wallpaper
gconftool-2 -t str --set /desktop/gnome/background/picture_filename $1 
fi
fi

ChangeIcons

#!/bin/bash
if [ "$1" == "random" ]; then
files=(~/.icons/*)
base=$(basename "${files[RANDOM % ${#files[@]}]}")
gconftool-2 --type=string -s /desktop/gnome/interface/icon_theme  $base
else
if [  "$1" == "" ];  then
    echo "Usage: $0 icon_theme_name"
    echo "or $0 random  / for a random pick"
else
#Icons
gconftool-2 --type=string -s /desktop/gnome/interface/icon_theme $1
fi
fi

ChangeMetacityThemes

#!/bin/bash
if [ "$1" == "random" ]; then
files=(~/.themes/*)
base=$(basename "${files[RANDOM % ${#files[@]}]}")
gconftool-2 --type=string -s /apps/metacity/general/theme $base
else
if [  "$1" == "" ];  then
    echo "Usage: $0 metacity_theme_name"
    echo "or $0 random  / for a random pick"
else
#Metacity
gconftool-2 --type=string -s /apps/metacity/general/theme $1
fi
fi

Hope these help you.

zeitue
  • 2,176
  • 3
  • 24
  • 37
1

Instead of writing a bash script you could do this all with cron. And if you're not a bash expert I'm guessing you're not a cron expert either so download Gnome-Schedule from the Ubuntu Software Center. That's basically a GUI for working with cron. Then just setup a task to run every hour that includes the following commands (you'd need a separate task for each command but they could run at the same time.

GTK theme:

gconftool-2 --type=string -s /desktop/gnome/interface/gtk_theme PUT_THE_THEME_NAME_HERE

Metacity:

gconftool-2 --type=string -s /apps/metacity/general/theme PUT_THE_THEME_NAME_HERE

Icons:

gconftool-2 --type=string -s /desktop/gnome/interface/icon_theme PUT_THE_ICON_THEME_NAME_HERE

Wallpaper:

gconftool-2 -t str --set /desktop/gnome/background/picture_filename "PUT_THE_PATH_TO_THE_WALLPAPER_IMAGE_HERE"

Important Note You'd need to make a separate task for each time you want the theme to change AND for each different theme it's going to change to using this process. Thus you'd make a task that runs every day at 1:00 to change the theme to Theme1. Another process that runs everyday that runs everyday to change the theme to Theme2, etc. The best way to do this would be to write a script but this would be an easy workaround.

penreturns
  • 5,940
  • 4
  • 33
  • 44
theFisher86
  • 504
  • 6
  • 13