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

View File

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

View File

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

View File

@@ -57,8 +57,12 @@
"clock": { "clock": {
"format": "{:%H:%M | %e %b}", "format": "{:%H:%M | %e %b}",
"tooltip-format": "<big>{:%Y %B}</big>\n<tt>{calendar}</tt>", "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 // System monitors
"group/monitors": { "group/monitors": {
"modules": ["network#speed", "custom/publicip", "temperature", "memory", "cpu", "battery", "backlight", "wireplumber"], "modules": ["network#speed", "custom/publicip", "temperature", "memory", "cpu", "battery", "backlight", "wireplumber"],