dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit d52043bb1b2b654231a2e5712143332dde255593
parent 3cc2776ea2ce3a65b7212a7c2cf3ef424c648d18
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Sat, 15 Dec 2018 12:03:25 +0100

Fix wallpaper

Diffstat:
Mlinks/.config/i3/config | 1+
Mlinks/bin/wallpaper.sh | 20++++++++------------
2 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/links/.config/i3/config b/links/.config/i3/config @@ -60,6 +60,7 @@ bindsym Control+Shift+s exec --no-startup-id mpc -h localhost stop && pkill -RTM bindsym $mod+Shift+d exec --no-startup-id bash /home/ad/code/dotfiles/bin/xrandr-auto.sh bindsym XF86Display exec --no-startup-id bash /home/ad/code/dotfiles/bin/xrandr-auto.sh bindsym $mod+Shift+a exec --no-startup-id bash /home/ad/bin/wallpaper.sh && xrandr --auto +bindsym XF86Launch1 exec --no-startup-id bash /home/ad/bin/wallpaper.sh && xrandr --auto # screen lock bindsym $mod+z exec /home/ad/bin/zzz diff --git a/links/bin/wallpaper.sh b/links/bin/wallpaper.sh @@ -4,21 +4,17 @@ #hsetroot -fill ~/wallpapers/polygon-art-17498.jpg #hsetroot -fill ~/photos/wallpapers/current_wallpapers/overdeepenings-Edit-Edit.jpg -statusfile=~/.wallpaper +function get_random_wallpaper { + wallpapers=($1/*.{jpg,JPG,jpeg,JPEG,png,PNG,tif,TIF,tiff,TIFF}) + printf "%s\n" "${wallpapers[RANDOM % ${#wallpapers[@]}]}" + #echo $wallpapers +} function set_wallpaper { feh --bg-scale "$1" - echo "$1" > $statusfile -} - -function get_wallpapers_in_dir { - wallpapers=$(find $1/*.{jpg,JPG,jpeg,JPEG,png,PNG,tif,TIF,tiff,TIFF} -type f) - echo $wallpapers + #echo "$1" > $statusfile # written to ~/.fehbg } dir="$HOME/photos/wallpapers/google_earth/" -current_wallpaper=$(cat $statusfile) -get_wallpapers_in_dir "$dir" -#wallpaper=$(get_next_wallpaper_in_dir "$dir") -#wallpaper=get_next_wallpaper_in_dir "$dir" -set_wallpaper $wallpaper +wallpaper=$(get_random_wallpaper "$dir") +set_wallpaper "$wallpaper"