♻️ refactor(hypr): changed wallpaper selection code
This commit is contained in:
parent
862ae6225e
commit
d7b60abfa1
6 changed files with 30 additions and 26 deletions
|
@ -59,7 +59,7 @@ bind=SUPER, space, exec, wleave
|
||||||
bind=SUPER,Insert,exec, ~/.config/hypr/scripts/color_picker
|
bind=SUPER,Insert,exec, ~/.config/hypr/scripts/color_picker
|
||||||
|
|
||||||
# Wallpaper
|
# Wallpaper
|
||||||
bind=SUPERSHIFT,w,exec, ~/.config/hypr/scripts/rofi/wallpaper_selection
|
bind=SUPERSHIFT,w,exec, ~/.config/hypr/scripts/wallpaper select
|
||||||
|
|
||||||
# Keybindings Cheatsheet
|
# Keybindings Cheatsheet
|
||||||
bind=SUPER,i,exec, ~/.config/hypr/scripts/rofi/keybindings
|
bind=SUPER,i,exec, ~/.config/hypr/scripts/rofi/keybindings
|
||||||
|
|
|
@ -10,6 +10,10 @@ pypr &
|
||||||
# Notification Daemon
|
# Notification Daemon
|
||||||
swaync &
|
swaync &
|
||||||
|
|
||||||
|
# Wallpaper Backend
|
||||||
|
swww init &
|
||||||
|
./wallpaper random
|
||||||
|
|
||||||
# Bar
|
# Bar
|
||||||
waybar &
|
waybar &
|
||||||
|
|
||||||
|
@ -22,9 +26,6 @@ udiskie &
|
||||||
# Notify about devices connecting and disconnecting
|
# Notify about devices connecting and disconnecting
|
||||||
devify &
|
devify &
|
||||||
|
|
||||||
# Wallpaper
|
|
||||||
$scripts/random_wallpaper &
|
|
||||||
|
|
||||||
# Idle daemon to screen lock
|
# Idle daemon to screen lock
|
||||||
/home/matt/.config/sway/idle.sh &
|
/home/matt/.config/sway/idle.sh &
|
||||||
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
#!/usr/bin/bash
|
|
||||||
|
|
||||||
function load_wp() {
|
|
||||||
IMAGE=$(fd -e png -e jpg --base-directory "$HOME/.config/hypr/themes/luna/walls/" --type f . | shuf -n 1)
|
|
||||||
swww img --transition-type wipe --transition-pos top-right --transition-duration 3.8 --transition-step 255 $HOME/.config/hypr/themes/luna/walls/"$IMAGE"
|
|
||||||
}
|
|
||||||
|
|
||||||
swww init
|
|
||||||
|
|
||||||
load_wp
|
|
|
@ -1,11 +0,0 @@
|
||||||
#!/usr/bin/bash
|
|
||||||
|
|
||||||
function load_wp() {
|
|
||||||
# IMAGE=$(fd -e png -e jpg --base-directory "$HOME/.config/hypr/themes/luna/walls/" --type f . | shuf -n 1)
|
|
||||||
IMAGE=$(rofi -show file-browser-extended -theme ~/.config/rofi/style.rasi -file-browser-stdout -file-browser-dir $HOME/.config/hypr/themes/luna/walls/)
|
|
||||||
swww img --transition-type wipe --transition-pos top-right --transition-duration 3.8 --transition-step 255 "$IMAGE"
|
|
||||||
}
|
|
||||||
|
|
||||||
swww init
|
|
||||||
|
|
||||||
load_wp
|
|
24
.config/hypr/scripts/wallpaper
Executable file
24
.config/hypr/scripts/wallpaper
Executable file
|
@ -0,0 +1,24 @@
|
||||||
|
#!/usr/bin/bash
|
||||||
|
|
||||||
|
mode=$1
|
||||||
|
|
||||||
|
if [ -z "$mode" ]; then
|
||||||
|
echo "Usage: $0 [select|random]"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$mode" == "select" ]; then
|
||||||
|
IMAGE=$(rofi -show file-browser-extended -theme ~/.config/rofi/style.rasi -file-browser-stdout -file-browser-dir $HOME/.config/hypr/themes/luna/walls/)
|
||||||
|
|
||||||
|
if [ -z "$IMAGE" ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
elif [ "$mode" == "random" ]; then
|
||||||
|
RANDOM_IMAGE=$(fd -e png -e jpg --base-directory "$HOME/.config/hypr/themes/luna/walls/" --type f . | shuf -n 1)
|
||||||
|
IMAGE="$HOME/.config/hypr/themes/luna/walls/$RANDOM_IMAGE"
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
swww img --transition-type wipe --transition-pos top-right --transition-duration 3.8 --transition-step 255 "$IMAGE"
|
||||||
|
notify-send "Wallpaper Changed" "Wallpaper changed to $IMAGE"
|
|
@ -3,7 +3,7 @@ Description=Change wallpaper with swww as backend
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
ExecStart=/home/matt/.config/hypr/scripts/random_wallpaper
|
ExecStart=/home/matt/.config/hypr/scripts/wallpaper random
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=default.target
|
WantedBy=default.target
|
||||||
|
|
Loading…
Add table
Reference in a new issue