tSet the wallpaper in a smart way - scripts - various script and utils
 (HTM) git clone git://z3bra.org/scripts
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
 (DIR) commit 383e73b7402c4f8b24795eca7a4fd66e937f66e9
 (DIR) parent 170a835303fea397221489ced2ddb663d7a94f87
 (HTM) Author: z3bra <willy@mailoo.org>
       Date:   Sat, 14 Jun 2014 12:12:38 +0200
       
       Set the wallpaper in a smart way
       
       Diffstat:
         A setwall                             |      18 ++++++++++++++++++
       
       1 file changed, 18 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/setwall b/setwall
       t@@ -0,0 +1,18 @@
       +#!/bin/sh
       +
       +bgdir="$HOME/usr/img/bg"
       +wall="$bgdir/default.jpg"
       +
       +test -z "$1" && return
       +
       +# get screen dir
       +IFS='x ' read sw sh <<< `xrandr | awk '/*/ {print $1}'`
       +
       +# get image dimensions (needs two lines because of IFS, no idea why)
       +IFS=' ' isize=`identify $1 | awk '{print $3}'`
       +IFS='x ' read iw ih <<< `echo $isize`
       +
       +test $iw -lt $sw && mode='tile' || mode='fill'
       +
       +test -L $1 && wall=$1 || ln -sf $1 $wall
       +hsetroot -${mode} $wall