diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-12-24 13:54:03 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-12-24 13:54:03 +0900 |
| commit | 28e8bdf7f8286bd431b7f3b709e79f3827b31469 (patch) | |
| tree | 85b44eff6da4d8443198fb6e04dfb6ee55244588 /debian/.local/bin/setlock | |
| parent | 8470ff001befcfd0f626dea69a9e76d43aee0511 (diff) | |
updates
Diffstat (limited to 'debian/.local/bin/setlock')
| -rwxr-xr-x | debian/.local/bin/setlock | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/debian/.local/bin/setlock b/debian/.local/bin/setlock new file mode 100755 index 0000000..611ae5e --- /dev/null +++ b/debian/.local/bin/setlock @@ -0,0 +1,23 @@ +#!/bin/sh + +lockloc="${XDG_DATA_HOME:-${HOME}/.local/share}/wallpapers/lock" + +# Give -s as parameter to make notifications silent. +while getopts "s" o; do + case "${o}" in + s) silent='1' ;; + *) ;; + esac +done + +shift $((OPTIND - 1)) + +trueloc="$(readlink -f "$1")" && + case "$(file --mime-type -b "$trueloc")" in + image/*) ln -sf "$trueloc" "$lockloc" && [ -z "$silent" ] && notify-send -i "$lockloc" "Changing lock screen..." ;; + inode/directory) ln -sf "$(find -L "$trueloc" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$lockloc" && [ -z "$silent" ] && notify-send -i "$lockloc" "Random Lock Screen chosen." ;; + *) + [ -z "$silent" ] && notify-send "🖼️ Error" "Not a valid image or directory." + exit 1 + ;; + esac |
