better wallpaper restoring

This commit is contained in:
EdenQwQ 2025-10-06 17:17:28 +08:00
parent 91496e3691
commit 77007dab23
2 changed files with 15 additions and 4 deletions

View file

@ -29,16 +29,26 @@ let
swww kill
swww-daemon --namespace "background" &
swww-daemon --namespace "backdrop" &
swww restore --namespace "background"
swww restore --namespace "backdrop"
# swww restore --namespace "background"
# swww restore --namespace "backdrop"
clash-meta -d ~/.config/clash &
wlsunset -s 00:00 -S 00:00 -t 5000 -T 5001 &
''
+ (
builtins.attrNames config.monitors
|> map (monitor: [
"swww img --namespace background -o ${monitor} \"/home/${user}/Pictures/Wallpapers/generated/$(cat ~/.cache/swww/${monitor}-file)\""
"swww img --namespace backdrop -o ${monitor} \"/home/${user}/Pictures/Wallpapers/generated/$(cat ~/.cache/swww/${monitor}-blurred-file)\""
])
|> builtins.concatLists
|> builtins.concatStringsSep "\n"
)
+ "\n"
+ (
if config.desktopShell == "caelestia" then
# bash
''
caelestia wallpaper -f "$HOME/Pictures/Wallpapers/generated/$(cat ~/.cache/swww/${config.lib.monitors.mainMonitorName}-file)"
caelestia wallpaper -f "/home/${user}/Pictures/Wallpapers/generated/$(cat ~/.cache/swww/${config.lib.monitors.mainMonitorName}-file)"
caelestia scheme set -n dynamic -m dark
''
else

View file

@ -3,10 +3,11 @@
wallpapers_dir="$HOME/Pictures/Wallpapers/generated"
wall=$(ls $wallpapers_dir | grep -v '\-blurred\.jpg$' | tofi)
if [ -z $wall ]; then
exit
exit 1
fi
output=$(niri msg -j focused-output | jq -r .name)
swww img -o $output $wallpapers_dir/$wall --transition-type random --transition-duration 1 --namespace background
blurwall=$(echo $wall | sed 's/\.jpg$/-blurred.jpg/')
swww img -o $output $wallpapers_dir/$blurwall --transition-type fade --namespace backdrop
echo $wall > $HOME/.cache/swww/"$output"-file
echo $blurwall > $HOME/.cache/swww/"$output"-blurred-file