From 01c6e70dabf77ce0b80bee38a1ee1b3b4cdf712c Mon Sep 17 00:00:00 2001 From: Uyanide Date: Fri, 3 Oct 2025 04:01:15 +0200 Subject: [PATCH] fix: swaybg --- .scripts/change-wallpaper | 19 +++++++++++++------ niri/config.kdl | 19 ++++++++++++++----- niri/config.kdl.template | 19 ++++++++++++++----- waybar-niri/config.jsonc | 6 +++++- 4 files changed, 46 insertions(+), 17 deletions(-) diff --git a/.scripts/change-wallpaper b/.scripts/change-wallpaper index f1bbe8d..3aaf983 100755 --- a/.scripts/change-wallpaper +++ b/.scripts/change-wallpaper @@ -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" diff --git a/niri/config.kdl b/niri/config.kdl index 9095449..4718249 100644 --- a/niri/config.kdl +++ b/niri/config.kdl @@ -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; } diff --git a/niri/config.kdl.template b/niri/config.kdl.template index c0a789e..3c80812 100644 --- a/niri/config.kdl.template +++ b/niri/config.kdl.template @@ -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; } diff --git a/waybar-niri/config.jsonc b/waybar-niri/config.jsonc index fdef577..44e6b2b 100644 --- a/waybar-niri/config.jsonc +++ b/waybar-niri/config.jsonc @@ -57,8 +57,12 @@ "clock": { "format": "{:%H:%M | %e %b}", "tooltip-format": "{:%Y %B}\n{calendar}", - "today-format": "{}" + "today-format": "{}", + "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"],