dotfiles/config/autorandr/postswitch

27 lines
627 B
Plaintext
Raw Normal View History

2018-10-06 12:03:44 +00:00
#!/usr/bin/env bash
2018-10-08 21:52:53 +00:00
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
# From https://stackoverflow.com/a/246128
2018-10-06 12:03:44 +00:00
# Relaunch the bars
# i3-msg exec ~/.config/polybar/launch.sh
# TODO Make something better with that
i3-msg exec ~/.config/lemonbar/launch.sh
# Resize background
2018-10-08 21:52:53 +00:00
BGDIR="$HOME/.cache/background"
mkdir -p "$BGDIR"
list="$DIR/bg"
url="$(cat "$list" | sed -e 's/#.*$//' -e 's/ \+$//' -e '/^$/d' | sort -R | head -1)"
hash="$(printf "$url" | md5sum | cut -f1 -d' ')"
filepath="$BGDIR/$hash"
if [ ! -e "$filepath" ]; then
wget -c "$url" -O "$filepath"
fi
2019-04-25 20:54:51 +00:00
feh --no-fehbg --bg-fill "$filepath"
2018-10-06 12:03:44 +00:00