refactor(hypr): use script to set wallpapers

This commit is contained in:
Price Hiller 2023-08-06 12:27:35 -05:00
parent 5fe55e7d38
commit 3109adb3df
Signed by: Price
SSH Key Fingerprint: SHA256:Y4S9ZzYphRn1W1kbJerJFO6GGsfu9O70VaBSxJO7dF8
3 changed files with 40 additions and 5 deletions

View File

@ -13,3 +13,4 @@ exec-once = blueman-applet
exec-once = xwaylandvideobridge
exec-once = clight
exec-once = clight-gui --tray
exec = ~/.config/hypr/scripts/init-wallpapers.bash

View File

@ -0,0 +1,39 @@
#!/usr/bin/env bash
log() {
printf "%s\n" "${*}"
systemd-cat -t init-wallpapers -p info echo "${*}"
}
set-wallpapers() {
### Set default wallpaper ###
# Monitors to not set a default for, to be set later down the script
local excluded_monitors=("eDP-1")
local monitor
while read -r monitor; do
local set_mon_wallpaper=true
for excluded_mon in "${excluded_monitors[@]}"; do
if [[ "${excluded_mon}" == "${monitor}" ]]; then
log "Not setting default wallpaper for '${monitor}' as it is excluded"
set_mon_wallpaper=false
break
fi
done
if "${set_mon_wallpaper}"; then
log "Set default wallpaper for monitor: '${monitor}'"
swww img -t none "${XDG_DATA_HOME}/wallpapers/Nebula.jpg" -o "${monitor}" &
fi
done < <(hyprctl monitors -j | jq -r '.[].name')
### Set any non defaults ###
swww img -t none ~/.local/share/wallpapers/Industrial-Shaded.png -o eDP-1
}
main() {
swww init
set-wallpapers
}
main

View File

@ -1,8 +1,3 @@
monitor = , preferred, auto, 1
bindl=,switch:off:Lid Switch,exec,hyprctl keyword monitor "eDP-1, preferred, auto, 1"
bindl=,switch:on:Lid Switch,exec,hyprctl keyword monitor "eDP-1, disable"
exec = swww init; swww img -t none ~/.local/share/wallpapers/Nebula.jpg -o DP-1
exec = swww init; swww img -t none ~/.local/share/wallpapers/Nebula.jpg -o DP-2
exec = swww init; swww img -t none ~/.local/share/wallpapers/Nebula.jpg -o DP-3
exec = swww init; swww img -t none ~/.local/share/wallpapers/Industrial-Shaded.png -o eDP-1