-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwallpaper-daemon.sh
More file actions
executable file
·36 lines (27 loc) · 1.02 KB
/
wallpaper-daemon.sh
File metadata and controls
executable file
·36 lines (27 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# This script manages the wallpaper
# Can be set to choose a wallpaper from a folder
# Images must be .png format
# Interacts with Hyprpaper & pywal
# How to use:
# ./wallpaper-daemon.sh [path-to-wallpaper.png] [-pywal args]
IMGPATH=$1
#DEFPATH='$HOME/.config/hypr/active.png'
# If statement checks if given directory and file is valid
# Prints an error message if invalid
if [ -f $IMGPATH ]; then
echo "Setting image as: $IMGPATH"
# Sets the image as the wallpaper with hyprpaper
hyprctl hyprpaper reload ,"$IMGPATH"
# Applies the images colorscheme using pywal
wal -q $2 -i $IMGPATH
# Copies the currect wallpaper to a directory to be used later
# Sets the image as the default so it persists on reboot
cp $IMGPATH $HOME/.config/hypr/active.png
# Restarts waybar with the correct colorscheme
pgrep waybar >/dev/null 2>&1 && killall waybar
(&> /dev/null waybar &)
else
echo "Invalid file or directory"
echo "(Hint: use only the .png format for the wallpaper)"
fi