summaryrefslogtreecommitdiffstats
path: root/set-background.sh
blob: ea48e0589436b7a173f7c0d5ef56d17ff9253348 (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
37
#!/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-tile '${FILE}'" > "$HOME/.fehbg";
	echo "habak -mS '${FILE}'" > "$HOME/.bg";
	#rm "$HOME/backgrounds/current_bg";
	#ln -sf "${FILE}" "$HOME/backgrounds/current_bg";
	source $HOME/.bg
else
	notify-send -t 10000 "Background" "Error: File \"${FILE}\" doesn't exist";
	exit 1  
fi