1
0
mirror of https://github.com/tiyn/dotfiles.git synced 2025-10-09 19:11:15 +02:00

background/lock: added lock bg script and updated classic one

This commit is contained in:
2023-10-24 18:58:55 +02:00
parent 923f64a486
commit b2e73bc5a1
2 changed files with 14 additions and 8 deletions

13
.local/bin/tools/setlock Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/sh
# Based on a script by lukesmithxyz, checkout github.com/lukesmithxyz/voidrice
bgloc="${XDG_DATA_HOME:-$HOME/.local/share}/lock"
trueloc="$(readlink -f "$1")" &&
case "$(file --mime-type -b "$trueloc")" in
image/* ) ln -f "$(readlink -f "$1")" "$bgloc" && notify-send -i "$bgloc" "Changing lock background..." ;;
inode/directory ) ln -f "$(find "$trueloc" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$bgloc" && notify-send -i "$bgloc" "Random lock background chosen." ;;
*) notify-send "🖼️ Error" "Not a valid image or directory." ; exit 1;;
esac