diff options
| author | Suleyman Farajli <suleyman@farajli.net> | 2025-10-26 22:23:31 +0400 |
|---|---|---|
| committer | Suleyman Farajli <suleyman@farajli.net> | 2025-10-26 22:23:31 +0400 |
| commit | cb78290f31886fb1f9a5e7c2a764dda55a459e50 (patch) | |
| tree | 72a2df0645405658d8590d4b8d7d87f1e099f596 /scripts/swall | |
| parent | f8d1bfbd0f27e0763cf75fcda58d010e346515ab (diff) | |
chore: split script installation into CLI and GUI sections
Diffstat (limited to 'scripts/swall')
| -rwxr-xr-x | scripts/swall | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/scripts/swall b/scripts/swall deleted file mode 100755 index 8e5ffb6..0000000 --- a/scripts/swall +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh - -. slib - -help() { -cat << EOF -${0}: Wrapper script to set wallpapers -options: - -d [File] Select a wallpaper or a directory - -c Remove the current wallpaper - -h Print this message and exit - -NOTE: default directory is ~/.config/wallpapers -EOF - -exit 0 -} - -check_program "xwallpaper" - -if [ "${#}" = 0 ]; then - #FIXME: use XDG_CONFIG - input="${HOME}/.config/wallpapers" -elif [ "${#}" != 1 ] && [ "${#}" != 2 ]; then - invalid_use -fi - -while getopts "hcd:" option; do - case "${option}" in - c) - #FIXME: use `run` function - killall picom - xwallpaper --clear - picom & - exit 0 - ;; - - d) input="${OPTARG}" ;; - - h) help ;; - - *) invalid_use -h ;; - - esac -done - -shift $((OPTIND - 1)) - -[ "${#}" != 0 ] && invalid_use - -if [ -n "${input}" ]; then - case $(file -L -b --mime-type "${input}") in - image/*) image="${input}" ;; - - inode/directory) waldir="${input}" ;; - - *) err "Couldn't read given file" ;; - esac -fi - -if [ -n "${waldir}" ]; then - image=$(find "${waldir}" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' 2>/dev/null \ - | shuf -n 1 ) -fi - -[ -z "${image}" ] && err "No image file found" - -run "xwallpaper --zoom ${image}" "${image}" |
