2019-09-13 10:51:43 +02:00
|
|
|
#!/bin/sh
|
2020-03-27 17:31:53 +01:00
|
|
|
|
2024-05-18 05:01:46 +02:00
|
|
|
# Adapted from a script by lukesmithxyz, checkout github.com/lukesmithxyz/voidrice
|
2020-03-27 17:31:53 +01:00
|
|
|
|
2025-02-17 04:19:49 +01:00
|
|
|
wall_desk=${WALLPAPER_DESKTOP:-$XDG_DATA_HOME/bg}
|
|
|
|
wall_lock=${WALLPAPER_LOCK:-$XDG_DATA_HOME/lock}
|
2024-05-19 06:35:47 +02:00
|
|
|
|
2024-05-18 05:01:46 +02:00
|
|
|
case "$1" in
|
2024-05-19 07:24:45 +02:00
|
|
|
desktop) trueloc="$(readlink -f "$2")" &&
|
2024-05-18 05:01:46 +02:00
|
|
|
case "$(file --mime-type -b "$trueloc")" in
|
2024-05-19 06:35:47 +02:00
|
|
|
image/* ) ln -f "$(readlink -f "$2")" "$wall_desk" && notify-send -i "$wall_desk" "Desktop wallpaper has been changed." ;;
|
|
|
|
inode/directory ) ln -f "$(find "$trueloc" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$wall_desk" && notify-send -i "$wall_desk" "Random desktop wallpaper chosen." ;;
|
2024-05-18 05:01:46 +02:00
|
|
|
*) notify-send "🖼️ Error" "Not a valid image or directory." ; exit 1;;
|
|
|
|
esac
|
2025-02-24 23:37:59 +01:00
|
|
|
xwallpaper --stretch "$wall_desk" ;;
|
2024-05-19 07:24:45 +02:00
|
|
|
lock) trueloc="$(readlink -f "$2")" &&
|
2024-05-18 05:01:46 +02:00
|
|
|
case "$(file --mime-type -b "$trueloc")" in
|
2024-05-19 06:35:47 +02:00
|
|
|
image/* ) ln -f "$(readlink -f "$2")" "$wall_lock" && notify-send -i "$wall_lock" "Lock screen wallpaper has been changed." ;;
|
|
|
|
inode/directory ) ln -f "$(find "$trueloc" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$wall_lock" && notify-send -i "$wall_lock" "Random lock screen wallpaper chosen." ;;
|
2024-05-18 05:01:46 +02:00
|
|
|
*) notify-send "🖼️ Error" "Not a valid image or directory." ; exit 1;;
|
|
|
|
esac ;;
|
2025-02-24 23:42:16 +01:00
|
|
|
both) wallpaper desktop "$2" &&
|
|
|
|
wallpaper lock "$2";;
|
2024-05-18 05:01:46 +02:00
|
|
|
*) cat << EOF
|
|
|
|
wallpaper: cli script to set and reset the wallpaper of the desktop and lock
|
|
|
|
screen.
|
2020-03-27 17:31:53 +01:00
|
|
|
|
2024-05-18 05:01:46 +02:00
|
|
|
Allowed options:
|
|
|
|
desktop [PATH] Set the wallpaper of the desktop to the specified path.
|
|
|
|
If no path is given reset it.
|
|
|
|
lock [PATH] Set the wallpaper of the lock screen to the specified path.
|
|
|
|
If no path is given reset it.
|
2025-02-24 23:42:16 +01:00
|
|
|
both [PATH] Set wallpaper for both lock screen and dektop to a
|
|
|
|
specified path.
|
|
|
|
If no path is given reset it.
|
2024-05-18 05:01:46 +02:00
|
|
|
all else Print this message
|
2020-03-27 17:31:53 +01:00
|
|
|
|
2024-05-18 05:01:46 +02:00
|
|
|
EOF
|
2022-09-08 02:15:11 +02:00
|
|
|
esac
|