User Tools

Site Tools


blog:change_windows_desktop_background_for_day_and_night_ubuntu_gnu:linux

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
blog:change_windows_desktop_background_for_day_and_night_ubuntu_gnu:linux [2010-12-30 08:55] – created brbblog:change_windows_desktop_background_for_day_and_night_ubuntu_gnu:linux [2010-12-30 09:09] (current) brb
Line 11: Line 11:
  
 Notes: Notes:
-directly use a jpg file as a windows wallpaper (the settings dialog creates a bmp file behind your back!). +  * Configuration is by changing the times in the case, and the image file names in the gconf...  
-  * Configuration is by changing the set ... variable at the top of the file +  * Test by calling the script 
-  * Test by calling the batchfile +  * Use f.lux to change the color temperatur of your display to suit the time of day -> http://www.stereopsis.com/flux/ 
-  * To automate the wallpaper switch: +  * To automate the wallpaper switch on startup and during the day 
-    * make a link in the windows autostart folder +    * Add the xdbus.sh script to your startup scripts, so that the xdbus variables are available. 
-    * add an hourly task to the task manager (or even cleaner, two tasks at the switch times (7:00 and 20:00)+    * add a cron task (see below)
  
 +<file bash changedesktop.sh>
 +#!/bin/bash                                                                                                       
 +# Change desktop background image depending on the time of day                                                    
 +# Configuration: Change hourse in the case statements, and the images to load as background                       
 +#                                                                                                                 
 +# load variables for gconftool. These have to be written to Xdbus during login                                    
 +. $HOME/.config/Xdbus                                                                                             
 +                                                                                                                  
 +HOUR=$(date +%H)                                                                                                  
 +gconftool=/usr/bin/gconftool                                                                                      
 +case "$HOUR" in                                                                                                   
 +    06|07)                                                                                                        
 +        $gconftool -t string -s /desktop/gnome/background/picture_filename ~/Bilder/DSC_0373.JPG                  
 +        ;;                                                                                                        
 +    08|09|10|11|12|13|14|15|16)                                                                                   
 +        $gconftool -t string -s /desktop/gnome/background/picture_filename ~/Bilder/DSC_1025.JPG                  
 +        ;;                                                                                                        
 +    17|18|19 )                                                                                                    
 +        $gconftool -t string -s /desktop/gnome/background/picture_filename ~/Bilder/DSC_0959.JPG                  
 +        ;;                                                                                                        
 +    *)                                                                                                            
 +        $gconftool -t string -s /desktop/gnome/background/picture_filename ~/Bilder/DSC_0776.JPG                  
 +        ;;                                                                                                        
 +esac                                                                                                              
 + 
 +</file>
  
-{{tag>}}+Note: gconftool needs some environment variables of the user to run. These can be saved during login for later use 
 + 
 +<file bash xdbus.sh> 
 +#!/bin/sh                                                                                                          
 +# Export the dbus session address on startup so it can be used by cron                                             
 +# use in cron /home/brb/.config/Xdbus;                                                                             
 +xdbus=$HOME/.config/Xdbus                                                                                          
 +touch $xdbus                                                                                                       
 +chmod 600 $xdbus                                                                                                   
 +env | grep DBUS_SESSION_BUS_ADDRESS > $xdbus                                                                       
 +echo 'export DBUS_SESSION_BUS_ADDRESS' >> $xdbus                                                                   
 +# Export XAUTHORITY value on startup so it can be used by cron                                                     
 +env | grep XAUTHORITY >> $xdbus                                                                                    
 +echo 'export XAUTHORITY' >> $xdbus          
 +</file> 
 + 
 +Add changedesktop to crontab, using ''crontab -e'' 
 + 
 +<file> 
 +# m h  dom mon dow   command                                                                
 +@reboot   /home/brb/bin/changedesktop.sh                                                    
 +0 * * * * /home/brb/bin/changedesktop.sh                                                    
 +</file> 
 +{{tag>ubuntu linux desktop background}}
  
 ~~LINKBACK~~ ~~LINKBACK~~
 ~~DISCUSSION~~ ~~DISCUSSION~~
  
blog/change_windows_desktop_background_for_day_and_night_ubuntu_gnu/linux.1293695713.txt.gz · Last modified: 2010-12-30 08:55 by brb