diff --git a/.config/lf/lfrc b/.config/lf/lfrc index 5f438fc..3c039c9 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -119,3 +119,6 @@ cmd zip ${{ zip -r $1.zip $1 rm -rf $1 }} + +cmd setbg "$1" +map b $setbg $f diff --git a/.local/bin/setbg b/.local/bin/setbg new file mode 100755 index 0000000..d98e71c --- /dev/null +++ b/.local/bin/setbg @@ -0,0 +1,30 @@ +#!/bin/sh +# generates colorscheme, recompiles dwl and asks to logout, if not it sets the wallpaper to remind you. +wallpaper="$1" +dwlsrc_dir="$HOME/.local/src/dwl/" + +setwp() { + pkill wbg; setsid wbg "$wallpaper" >/dev/null 2>&1 & +} + +if [ -f "$wallpaper" ]; then + hellwal -q -i "$1" +else + echo "error: invalid path" + exit 1 +fi + +if [ -d "$dwlsrc_dir" ]; then + cd "$dwlsrc_dir" + bwroot make clean install >/dev/null 2>&1 + notify-send "setbg" "successfully compiled dwl!" + + case $(printf "%s\n" "Yes" "No" | fuzzel -d -p "Log out now?") in + "Yes") kill "$(pidof dwl)" ;; + "No") setwp ;; + *) notify-send "setbg" "don't forget to log out!"; exit ;; + esac +else + notify-send "setbg" "dwl directory not found" + exit +fi