From eda7630b9ea3a35599aa63afeeac2bd870ff6c85 Mon Sep 17 00:00:00 2001 From: kokopi-dev Date: Sun, 7 Dec 2025 02:21:41 +0900 Subject: [PATCH] add:wallpaper init script --- mango/local-bin/init-wallpapers | 33 +++++++++++++++++++++++++++++++++ mango/mango/autostart.sh | 8 ++------ 2 files changed, 35 insertions(+), 6 deletions(-) create mode 100755 mango/local-bin/init-wallpapers diff --git a/mango/local-bin/init-wallpapers b/mango/local-bin/init-wallpapers new file mode 100755 index 0000000..974f89d --- /dev/null +++ b/mango/local-bin/init-wallpapers @@ -0,0 +1,33 @@ +#!/bin/bash +### wallpaper names: +## standard-1.png +## wide-1.png +while ! swww query &>/dev/null; do + sleep 0.1 +done +swww clear 000000 +sleep 0.1 + +output=$(wlr-randr) + +monitor_count=$(echo "$output" | grep -c "Enabled: yes") + +# init standard +swww img ~/pictures/bgs/standard-1.png --transition-type fade --transition-duration 1 --outputs "eDP-1" & disown + +# framework laptop will only ever have 1 external plugged in (for now) +if [ "$monitor_count" -gt 1 ]; then + # external monitor detected + external_monitor=$(echo "$output" | grep -E "^[A-Za-z0-9]+-[0-9]+" | awk '{print $1}' | grep -v "eDP-1") + resolution=$(echo "$output" | sed -n "/^${external_monitor} /,/^[A-Za-z0-9]*-[0-9]/p" | grep "current" | grep -oE '[0-9]+x[0-9]+' | head -1) + echo $resolution + echo $external_monitor + if [ -n "$resolution" ]; then + if [ "$resolution" = "1920x1080" ]; then + swww img ~/pictures/bgs/standard-1.png --transition-type fade --transition-duration 1 --outputs "$external_monitor" & disown + else + echo "Monitor type: Non-standard (not 1920x1080)" + swww img ~/pictures/bgs/wide-1.png --transition-type fade --transition-duration 1 --outputs "$external_monitor" & disown + fi + fi +fi diff --git a/mango/mango/autostart.sh b/mango/mango/autostart.sh index ce7c8b3..7527ddb 100755 --- a/mango/mango/autostart.sh +++ b/mango/mango/autostart.sh @@ -2,12 +2,8 @@ set +e swww-daemon & disown -while ! swww query &>/dev/null; do - sleep 0.1 -done -swww clear 000000 -sleep 0.1 -swww img ~/pictures/flower.jpg --transition-type fade --transition-duration 1 & + +init-wallpapers export WAYLAND_DISPLAY=${WAYLAND_DISPLAY:-wayland-1} export XDG_CURRENT_DESKTOP=wlroots