fix: swaybg

This commit is contained in:
2025-10-03 04:01:15 +02:00
parent 6e4c3be564
commit 01c6e70dab
4 changed files with 46 additions and 17 deletions

View File

@@ -7,11 +7,17 @@ else
fi
[ -z "$image" ] && exit 1
[ ! -f "$image" ] && exit 1
ext=${image##*.}
current_dir="$HOME/.config/wallpaper-chooser/current"
image_copied="$current_dir/wallpaper.$ext"
mkdir -p "$current_dir" || (
notify-send "Error" "Could not create directory $current_dir"
exit 1
)
temp_img=$(mktemp --suffix=."$ext") || exit 1
cp "$image" "$temp_img" || exit 1
rm -f "$current_dir"/wallpaper.*
@@ -32,12 +38,13 @@ elif [ "$XDG_CURRENT_DESKTOP" = "niri" ]; then
killall swaybg
killall swww
cache_dir="$HOME/.local/share/swaybg"
mkdir -p "$cache_dir" || (
blur_dir="$HOME/.local/share/swaybg"
mkdir -p "$blur_dir" || (
notify-send "Error" "Could not create cache directory"
exit 1
)
blurred_image="$cache_dir/blurred.$ext"
rm -rf "${blur_dir:?}"/*
blurred_image="$blur_dir/blurred.$ext"
# blur
magick "$image_copied" -blur 0x16 "$blurred_image" || (
@@ -45,10 +52,10 @@ elif [ "$XDG_CURRENT_DESKTOP" = "niri" ]; then
exit 1
)
(setsid swaybg -i "$blurred_image" -m fill > /dev/null 2> /dev/null &)&
(setsid swaybg -i "$blurred_image" -m fill)&
disown
Q
(setsid swww img "$image_copied" --transition-type fade --transition-duration 2 > /dev/null 2> /dev/null &)&
(setsid swww img "$image_copied" --transition-type fade --transition-duration 2)&
disown
notify-send "Wallpaper Changed" "$image"

View File

@@ -49,15 +49,14 @@ output "eDP-2" {
/************************Layout************************/
layout {
// gaps in & out
gaps 2
gaps 0
center-focused-column "never"
preset-column-widths {
proportion 0.33333
proportion 0.3
proportion 0.5
proportion 0.66667
proportion 0.7
}
preset-window-heights {
@@ -87,6 +86,13 @@ layout {
color "#0007"
}
struts {
top 2
right 2
bottom 3
left 2
}
background-color "#1e1e2e"
}
@@ -116,7 +122,7 @@ spawn-sh-at-startup "config-switch niri"
spawn-at-startup "waybar"
// Wallpaper
spawn-sh-at-startup "swaybg -i $(find $HOME/.cache/swaybg -type f) -m fill"
spawn-sh-at-startup "swaybg -i $(find $HOME/.local/share/swaybg -type f) -m fill"
spawn-sh-at-startup "swww-daemon"
// Not necessary maybe ...
@@ -128,6 +134,7 @@ spawn-at-startup "nm-applet"
spawn-sh-at-startup "gnome-keyring-daemon --start --components=secrets"
spawn-at-startup "/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1"
spawn-at-startup "mako"
spawn-at-startup "xwayland-satellite"
// idle
spawn-sh-at-startup "swayidle -w timeout 300 'hyprlock &' timeout 600 'niri msg action power-off-monitors' before-sleep 'hyprlock &'"
@@ -168,6 +175,7 @@ environment {
// Others
XCURSOR_SIZE "24"
ELECTRON_OZONE_PLATFORM_HINT "wayland"
DISPLAY ":0"
}
/************************Rules************************/
@@ -364,6 +372,7 @@ binds {
Mod+Shift+Comma { consume-window-into-column; }
Mod+Shift+Period { expel-window-from-column; }
Mod+Shift+M { toggle-column-tabbed-display; }
Mod+R { switch-preset-column-width; }
Mod+Shift+R { switch-preset-window-height; }

View File

@@ -49,15 +49,14 @@ output "eDP-2" {
/************************Layout************************/
layout {
// gaps in & out
gaps 2
gaps 0
center-focused-column "never"
preset-column-widths {
proportion 0.33333
proportion 0.3
proportion 0.5
proportion 0.66667
proportion 0.7
}
preset-window-heights {
@@ -87,6 +86,13 @@ layout {
color "#0007"
}
struts {
top 2
right 2
bottom 3
left 2
}
background-color "#1e1e2e"
}
@@ -116,7 +122,7 @@ spawn-sh-at-startup "config-switch niri"
spawn-at-startup "waybar"
// Wallpaper
spawn-sh-at-startup "swaybg -i $(find $HOME/.cache/swaybg -type f) -m fill"
spawn-sh-at-startup "swaybg -i $(find $HOME/.local/share/swaybg -type f) -m fill"
spawn-sh-at-startup "swww-daemon"
// Not necessary maybe ...
@@ -128,6 +134,7 @@ spawn-at-startup "nm-applet"
spawn-sh-at-startup "gnome-keyring-daemon --start --components=secrets"
spawn-at-startup "/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1"
spawn-at-startup "mako"
spawn-at-startup "xwayland-satellite"
// idle
spawn-sh-at-startup "swayidle -w timeout 300 'hyprlock &' timeout 600 'niri msg action power-off-monitors' before-sleep 'hyprlock &'"
@@ -168,6 +175,7 @@ environment {
// Others
XCURSOR_SIZE "24"
ELECTRON_OZONE_PLATFORM_HINT "wayland"
DISPLAY ":0"
}
/************************Rules************************/
@@ -364,6 +372,7 @@ binds {
Mod+Shift+Comma { consume-window-into-column; }
Mod+Shift+Period { expel-window-from-column; }
Mod+Shift+M { toggle-column-tabbed-display; }
Mod+R { switch-preset-column-width; }
Mod+Shift+R { switch-preset-window-height; }

View File

@@ -57,8 +57,12 @@
"clock": {
"format": "{:%H:%M | %e %b}",
"tooltip-format": "<big>{:%Y %B}</big>\n<tt>{calendar}</tt>",
"today-format": "<b>{}</b>"
"today-format": "<b>{}</b>",
"on-click": "niri msg action center-column",
"on-scroll-up": "niri msg action set-column-width +10%",
"on-scroll-down": "niri msg action set-column-width -10%"
},
// System monitors
"group/monitors": {
"modules": ["network#speed", "custom/publicip", "temperature", "memory", "cpu", "battery", "backlight", "wireplumber"],