summaryrefslogtreecommitdiffstats
path: root/set-background.sh
blob: e465e7e85e960877f4a37ec182fbe0aabf729b9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
#----------------------------------------------------
# Version:      0.2.0
# Author:       Florian "Bluewind" Pritz <flo@xssn.at>
#
# Licensed under WTFPL v2
#   (see COPYING for full license text)
#    
#----------------------------------------------------
# Usage: set-background.sh <image-file>
# Sets background using feh and creates 
# symlink for slim
#----------------------------------------------------

if [ "" = $DISPLAY ]; then
	export DISPLAY=:0.0
fi

if [ "$1" = "" ] || [ "$1" = "-h" ]; then 
	notify-send -t 10000 "Background" "Usage: set-background &lt;file&gt;";
	exit 1
fi

cd "$(dirname "$1")"

FILE="$(pwd)/$(basename "$1")"

if [ -f "$FILE" ]; then
	echo "feh --bg-center '${FILE}'" > "$HOME/.fehbg";
	#rm "$HOME/backgrounds/current_bg";
	#ln -sf "${FILE}" "$HOME/backgrounds/current_bg";
	source $HOME/.fehbg
else
	notify-send -t 10000 "Background" "Error: File \"${FILE}\" doesn't exist";
	exit 1  
fi