From b2e73bc5a1c090d6d5944ff2b1fc3d91895a3252 Mon Sep 17 00:00:00 2001 From: tiyn Date: Tue, 24 Oct 2023 18:58:55 +0200 Subject: [PATCH] background/lock: added lock bg script and updated classic one --- .local/bin/tools/setbg | 9 +-------- .local/bin/tools/setlock | 13 +++++++++++++ 2 files changed, 14 insertions(+), 8 deletions(-) create mode 100755 .local/bin/tools/setlock diff --git a/.local/bin/tools/setbg b/.local/bin/tools/setbg index 6c5a45d..49f3958 100755 --- a/.local/bin/tools/setbg +++ b/.local/bin/tools/setbg @@ -1,13 +1,6 @@ #!/bin/sh -# In LARBS, ~/.config/wall.png is the location of the system wallpaper. This -# script, if given an argument, moves it there. This script without an -# argument sets ~/.config/wall.png as the wallpaper, which is required on login -# if you don't want a black screen. -# -# You may also give a directory name to select a random image from that -# directory as a wallpaper. Be careful that the directory only has images. -# by lukesmithxyz, checkout github.com/lukesmithxyz/voidrice +# Based on a script by lukesmithxyz, checkout github.com/lukesmithxyz/voidrice bgloc="${XDG_DATA_HOME:-$HOME/.local/share}/bg" diff --git a/.local/bin/tools/setlock b/.local/bin/tools/setlock new file mode 100755 index 0000000..ca46a85 --- /dev/null +++ b/.local/bin/tools/setlock @@ -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