diff --git a/.scripts/change-wallpaper b/.scripts/change-wallpaper index 18d840e..919bfe6 100755 --- a/.scripts/change-wallpaper +++ b/.scripts/change-wallpaper @@ -10,7 +10,7 @@ fi [ ! -f "$image" ] && exit 1 ext=${image##*.} -current_dir="$HOME/.config/wallpaper-chooser/current" +current_dir="$HOME/.local/share/wallpaper/current" image_copied="$current_dir/wallpaper.$ext" mkdir -p "$current_dir" || ( @@ -37,7 +37,7 @@ elif [ "$XDG_CURRENT_DESKTOP" = "niri" ]; then killall swaybg killall swww - blur_dir="$HOME/.local/share/swaybg" + blur_dir="$HOME/.local/share/wallpaper/blurred" mkdir -p "$blur_dir" || ( echo "Could not create cache directory" exit 1 diff --git a/.scripts/niri-autoblur b/.scripts/niri-autoblur index f9b6ad3..53a4fc7 100755 --- a/.scripts/niri-autoblur +++ b/.scripts/niri-autoblur @@ -1,23 +1,64 @@ #!/usr/bin/env bash -normal=$(find ~/.config/wallpaper-chooser/current -type f | head -n 1) -blurred=$(find ~/.local/share/swaybg -type f | head -n 1) +function update() { + normal=$(find ~/.local/share/wallpaper/current -type f | head -n 1) + blurred=$(find ~/.local/share/wallpaper/blurred -type f | head -n 1) -[ -n "$normal" ] || exit 1 -[ -n "$blurred" ] || exit 1 + [ -n "$normal" ] && [ -n "$blurred" ] +} -while true; do - last=$target +function apply() { + swww img "$1" --transition-type fade --transition-duration 0.5 > /dev/null 2> /dev/null +} +function isdesktop() { mapfile -t focused_lines < <(niri msg focused-window 2>/dev/null) - if [ "${#focused_lines[@]}" -gt 1 ]; then - target="$blurred" + [ "${#focused_lines[@]}" -le 1 ] +} + +# single shot +[ -n "$1" ] && { + update || exit 1 + + if [ "$1" = "normal" ]; then + target=$normal + elif [ "$1" = "blurred" ]; then + target=$blurred + elif [ "$1" = "auto" ]; then + if isdesktop; then + target=$normal + else + target=$blurred + fi else - target="$normal" + echo "Usage: $0 [normal|blurred|auto]" + exit 1 fi - [ "$target" = "$last" ] || swww img "$target" --transition-type fade --transition-duration 0.5 > /dev/null 2> /dev/null + apply "$target" + + exit 0 +} + +while true; do + # wait until wallpapers are ready + update || { + last="" # force apply when ready + sleep 0.5 + continue + } + + if isdesktop; then + target="$normal" + else + target="$blurred" + fi + + [ "$target" = "$last" ] || { + apply "$target" + last=$target + } sleep 0.5 done diff --git a/hypr/hyprpaper.conf b/hypr/hyprpaper.conf index a871222..6bbb104 100644 --- a/hypr/hyprpaper.conf +++ b/hypr/hyprpaper.conf @@ -1,2 +1,2 @@ -preload = /home/kolkas/.config/wallpaper-chooser/current/wallpaper.png -wallpaper = , /home/kolkas/.config/wallpaper-chooser/current/wallpaper.png +preload = /home/kolkas/.local/share/wallpaper/current/wallpaper.jpg +wallpaper = , /home/kolkas/.local/share/wallpaper/current/wallpaper.jpg diff --git a/niri/config.kdl b/niri/config.kdl index 91a43c2..b654b32 100644 --- a/niri/config.kdl +++ b/niri/config.kdl @@ -122,8 +122,9 @@ spawn-sh-at-startup "config-switch niri" spawn-at-startup "waybar" // Wallpaper -spawn-sh-at-startup "swaybg -i $(find $HOME/.local/share/swaybg -type f) -m fill" -spawn-sh-at-startup "swww-daemon" +spawn-sh-at-startup "swaybg -i $(find $HOME/.local/wallpaper/blurred -type f) -m fill" +spawn-at-startup "swww-daemon" +spawn-at-startup "niri-autoblur" // Not necessary maybe ... spawn-at-startup "fcitx5" diff --git a/niri/config.kdl.template b/niri/config.kdl.template index 807ce44..c59236f 100644 --- a/niri/config.kdl.template +++ b/niri/config.kdl.template @@ -122,7 +122,7 @@ spawn-sh-at-startup "config-switch niri" spawn-at-startup "waybar" // Wallpaper -spawn-sh-at-startup "swaybg -i $(find $HOME/.local/share/swaybg -type f) -m fill" +spawn-sh-at-startup "swaybg -i $(find $HOME/.local/wallpaper/blurred -type f) -m fill" spawn-at-startup "swww-daemon" spawn-at-startup "niri-autoblur" diff --git a/waybar/style.css b/waybar/style.css index 40cb9b2..4fbce30 100644 --- a/waybar/style.css +++ b/waybar/style.css @@ -1,6 +1,6 @@ @import 'mocha.css'; -@define-color flavor #f5c2e7; +@define-color flavor #89b4fa; /* @define-color archlinux #1793d1; */ @define-color archlinux @sapphire; diff --git a/wlogout/icons/hibernate.svg b/wlogout/icons/hibernate.svg index 5626c72..4d5010f 100644 --- a/wlogout/icons/hibernate.svg +++ b/wlogout/icons/hibernate.svg @@ -1,7 +1,7 @@ - + Svg Vector Icons : http://www.onlinewebfonts.com/icon diff --git a/wlogout/icons/lock.svg b/wlogout/icons/lock.svg index 4b629fd..a7832ba 100644 --- a/wlogout/icons/lock.svg +++ b/wlogout/icons/lock.svg @@ -1,7 +1,7 @@ - + Svg Vector Icons : http://www.onlinewebfonts.com/icon diff --git a/wlogout/icons/logout.svg b/wlogout/icons/logout.svg index 3e0cc80..4fac745 100644 --- a/wlogout/icons/logout.svg +++ b/wlogout/icons/logout.svg @@ -1,7 +1,7 @@ - + Svg Vector Icons : http://www.onlinewebfonts.com/icon diff --git a/wlogout/icons/reboot.svg b/wlogout/icons/reboot.svg index c05f000..d8e6844 100644 --- a/wlogout/icons/reboot.svg +++ b/wlogout/icons/reboot.svg @@ -1,7 +1,7 @@ - + Svg Vector Icons : http://www.onlinewebfonts.com/icon diff --git a/wlogout/icons/shutdown.svg b/wlogout/icons/shutdown.svg index 6693b35..abb804d 100644 --- a/wlogout/icons/shutdown.svg +++ b/wlogout/icons/shutdown.svg @@ -1,7 +1,7 @@ - + Svg Vector Icons : http://www.onlinewebfonts.com/icon diff --git a/wlogout/icons/suspend.svg b/wlogout/icons/suspend.svg index 08214b4..5ee54b1 100644 --- a/wlogout/icons/suspend.svg +++ b/wlogout/icons/suspend.svg @@ -1,7 +1,7 @@ - + Svg Vector Icons : http://www.onlinewebfonts.com/icon diff --git a/wlogout/style.css b/wlogout/style.css index 408f348..6f4c952 100644 --- a/wlogout/style.css +++ b/wlogout/style.css @@ -16,7 +16,7 @@ button { border: none; border-width: 0px; border-radius: 0px; - border-color: #f5c2e7; + border-color: #89b4fa; box-shadow: none; text-shadow: none; text-decoration-color: #cdd6f4;