Improved env detection
This commit is contained in:
parent
b80abd7b58
commit
8451245fc7
|
@ -1,7 +1,10 @@
|
||||||
#!/usr/bin/bash -x
|
#!/usr/bin/bash -x
|
||||||
|
|
||||||
# Check that SWAYSOCK is in the env before doing anything
|
# Check that SWAYSOCK is in the env before doing anything
|
||||||
[ -z "$SWAYSOCK" ] && echo '$SWAYSOCK Not set in env. Exiting.'; exit 1
|
if [[ ! -v SWAYSOCK ]]; then
|
||||||
|
echo '$SWAYSOCK Not set in env. Exiting.'
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# Path to genbg.gp
|
# Path to genbg.gp
|
||||||
genbg="/home/thurstylark/.config/sway/$(uname -n)/genbg.gp"
|
genbg="/home/thurstylark/.config/sway/$(uname -n)/genbg.gp"
|
||||||
|
@ -18,7 +21,7 @@ outh=$(swaymsg -r -t get_outputs | jq -r '.[0].current_mode.height')
|
||||||
bgstash="$(mktemp tl-sway-bg.XXXX)"
|
bgstash="$(mktemp tl-sway-bg.XXXX)"
|
||||||
|
|
||||||
# Clean up any old files
|
# Clean up any old files
|
||||||
rm ${tempfile%.*}.*
|
rm ${bgstash%.*}.*
|
||||||
|
|
||||||
# Generate the file in question
|
# Generate the file in question
|
||||||
gnuplot -c "$genbg" "$outw" "$outh" > "$bgstash"
|
gnuplot -c "$genbg" "$outw" "$outh" > "$bgstash"
|
||||||
|
|
Loading…
Reference in New Issue