Add NeoWall wallpaper integration

This commit is contained in:
2026-05-04 22:12:40 -07:00
parent 4b552afb7a
commit 9a0612e608
6 changed files with 219 additions and 2 deletions

View File

@@ -2092,6 +2092,7 @@ bind(hyper .. " + backslash", exec("/home/imalison/dotfiles/dotfiles/lib/functio
bind(hyper .. " + SHIFT + backslash", workspacehistory("debug")) bind(hyper .. " + SHIFT + backslash", workspacehistory("debug"))
bind(hyper .. " + O", exec("rofi_paswitch")) bind(hyper .. " + O", exec("rofi_paswitch"))
bind(hyper .. " + comma", exec("rofi_wallpaper.sh")) bind(hyper .. " + comma", exec("rofi_wallpaper.sh"))
bind(hyper .. " + SHIFT + comma", exec("/home/imalison/dotfiles/dotfiles/lib/bin/neowall-wallpaper toggle"))
bind(hyper .. " + Y", exec("rofi_agentic_skill")) bind(hyper .. " + Y", exec("rofi_agentic_skill"))
bind(main_mod .. " + R", exec("hyprctl reload")) bind(main_mod .. " + R", exec("hyprctl reload"))

View File

@@ -0,0 +1,7 @@
default {
shader /run/current-system/sw/share/neowall/shaders/train_journey_optimized.glsl
shader_speed 0.7
shader_fps 30
mode fill
duration 0
}

View File

@@ -0,0 +1,7 @@
default {
shader /run/current-system/sw/share/neowall/shaders/matrix_rain.glsl
shader_speed 0.85
shader_fps 30
mode fill
duration 0
}

View File

@@ -4,12 +4,15 @@ set -euo pipefail
state_dir="${XDG_RUNTIME_DIR:-/tmp}/hypr-screensaver" state_dir="${XDG_RUNTIME_DIR:-/tmp}/hypr-screensaver"
pid_file="$state_dir/mpvpaper.pid" pid_file="$state_dir/mpvpaper.pid"
neowall_pid_file="$state_dir/neowall.pid"
event_log="$state_dir/events.log" event_log="$state_dir/events.log"
mkdir -p "$state_dir" mkdir -p "$state_dir"
title_prefix="hypr-screensaver:" title_prefix="hypr-screensaver:"
backend="${HYPR_SCREENSAVER_BACKEND:-mpvpaper}"
screensaver_dir="${HYPR_SCREENSAVER_DIR:-/var/lib/syncthing/sync/Screensaver}" screensaver_dir="${HYPR_SCREENSAVER_DIR:-/var/lib/syncthing/sync/Screensaver}"
screensaver_use_dir="${HYPR_SCREENSAVER_USE_DIR:-$screensaver_dir/use}" screensaver_use_dir="${HYPR_SCREENSAVER_USE_DIR:-$screensaver_dir/use}"
neowall_config="${HYPR_SCREENSAVER_NEOWALL_CONFIG:-${XDG_CONFIG_HOME:-$HOME/.config}/neowall/screensaver.vibe}"
usage() { usage() {
cat <<'EOF' cat <<'EOF'
@@ -44,6 +47,13 @@ with:
HYPR_SCREENSAVER_HDR_MODE=auto HYPR_SCREENSAVER_HDR_MODE=auto
HYPR_SCREENSAVER_HDR_MODE=sdr HYPR_SCREENSAVER_HDR_MODE=sdr
HYPR_SCREENSAVER_HDR_MODE=hdr HYPR_SCREENSAVER_HDR_MODE=hdr
Backend selection:
HYPR_SCREENSAVER_BACKEND=mpvpaper
HYPR_SCREENSAVER_BACKEND=neowall
The neowall backend is a wallpaper-layer experiment. It does not cover existing
windows like mpvpaper's overlay layer.
EOF EOF
} }
@@ -64,6 +74,11 @@ legacy_screensaver_window_pids() {
} }
is_running() { is_running() {
if [ "$backend" = "neowall" ]; then
neowall_is_running
return
fi
local pid local pid
if [ -f "$pid_file" ]; then if [ -f "$pid_file" ]; then
pid="$(<"$pid_file")" pid="$(<"$pid_file")"
@@ -76,6 +91,19 @@ is_running() {
return 1 return 1
} }
neowall_is_running() {
if [ -f "$neowall_pid_file" ]; then
local pid
pid="$(<"$neowall_pid_file")"
if kill -0 "$pid" 2>/dev/null; then
return 0
fi
rm -f "$neowall_pid_file"
fi
return 1
}
default_source() { default_source() {
local size width height local size width height
size="$( size="$(
@@ -174,7 +202,44 @@ run_mpvpaper() {
exec nix shell nixpkgs#mpvpaper --command mpvpaper "$@" exec nix shell nixpkgs#mpvpaper --command mpvpaper "$@"
} }
start() { run_neowall() {
if command -v neowall >/dev/null 2>&1; then
neowall "$@"
return
fi
nix shell nixpkgs#neowall --command neowall "$@"
}
start_neowall() {
local pid
if neowall_is_running; then
log_event "neowall start ignored: already running pid=$(<"$neowall_pid_file")"
exit 0
fi
if [ ! -r "$neowall_config" ]; then
printf 'NeoWall screensaver config not found: %s\n' "$neowall_config" >&2
return 1
fi
stop
systemctl --user stop hyprpaper.service >/dev/null 2>&1 || true
run_neowall -c "$neowall_config" >>"$state_dir/neowall.log" 2>&1
sleep 0.2
pid="$(pgrep -n -x neowall || true)"
if [ -z "$pid" ]; then
log_event "neowall start failed: no neowall process found"
return 1
fi
printf '%s\n' "$pid" > "$neowall_pid_file"
log_event "neowall start ok pid=$pid config=$neowall_config"
}
start_mpvpaper() {
local source output layer options pid local source output layer options pid
if is_running; then if is_running; then
@@ -212,7 +277,22 @@ start() {
log_event "start ok pid=$pid" log_event "start ok pid=$pid"
} }
stop() { start() {
case "$backend" in
mpvpaper)
start_mpvpaper
;;
neowall)
start_neowall
;;
*)
printf 'Invalid HYPR_SCREENSAVER_BACKEND=%s; expected mpvpaper or neowall\n' "$backend" >&2
exit 2
;;
esac
}
stop_mpvpaper() {
local pid legacy_pid local pid legacy_pid
if [ -f "$pid_file" ]; then if [ -f "$pid_file" ]; then
@@ -231,6 +311,20 @@ stop() {
done done
} }
stop_neowall() {
if [ -f "$neowall_pid_file" ]; then
log_event "neowall stop pid=$(<"$neowall_pid_file")"
run_neowall kill >/dev/null 2>&1 || pkill -TERM -x neowall >/dev/null 2>&1 || true
rm -f "$neowall_pid_file"
systemctl --user start hyprpaper.service >/dev/null 2>&1 || true
fi
}
stop() {
stop_mpvpaper
stop_neowall
}
status() { status() {
is_running is_running
} }

View File

@@ -0,0 +1,107 @@
#!/usr/bin/env bash
set -euo pipefail
config_dir="${XDG_CONFIG_HOME:-$HOME/.config}/neowall"
config="${NEOWALL_WALLPAPER_CONFIG:-$config_dir/config.vibe}"
usage() {
cat <<'EOF'
Usage: neowall-wallpaper <start|stop|toggle|status|next|list|current|static>
Commands:
start Stop hyprpaper and start NeoWall with ~/.config/neowall/config.vibe.
stop Stop NeoWall and restart hyprpaper.
toggle Switch between NeoWall and hyprpaper.
status Exit 0 if NeoWall is running, otherwise exit 1.
next Ask NeoWall to advance to the next configured wallpaper.
list List NeoWall's current cycle.
current Show NeoWall's current wallpaper.
static Alias for stop.
Override the config with:
NEOWALL_WALLPAPER_CONFIG=/path/to/config.vibe neowall-wallpaper start
EOF
}
notify() {
if command -v notify-send >/dev/null 2>&1; then
notify-send "NeoWall" "$1"
else
printf '%s\n' "$1" >&2
fi
}
run_neowall() {
if command -v neowall >/dev/null 2>&1; then
neowall "$@"
return
fi
nix shell nixpkgs#neowall --command neowall "$@"
}
is_running() {
pgrep -x neowall >/dev/null 2>&1
}
stop_hyprpaper() {
systemctl --user stop hyprpaper.service >/dev/null 2>&1 || true
}
start_hyprpaper() {
systemctl --user start hyprpaper.service >/dev/null 2>&1 || true
}
stop_neowall() {
if is_running; then
run_neowall kill >/dev/null 2>&1 || pkill -TERM -x neowall >/dev/null 2>&1 || true
fi
}
start() {
if [ ! -r "$config" ]; then
notify "Config not found: $config"
exit 1
fi
stop_hyprpaper
stop_neowall
run_neowall -c "$config"
notify "Live wallpaper started"
}
stop() {
stop_neowall
start_hyprpaper
notify "Static wallpaper restored"
}
case "${1:-}" in
start)
start
;;
stop|static)
stop
;;
toggle)
if is_running; then
stop
else
start
fi
;;
status)
is_running
;;
next|list|current)
run_neowall "$1"
;;
""|-h|--help|help)
usage
;;
*)
usage >&2
exit 2
;;
esac

View File

@@ -256,6 +256,7 @@
[ [
# Hyprland utilities # Hyprland utilities
hyprpaper # Wallpaper hyprpaper # Wallpaper
neowall # Shader wallpaper
hypridle # Idle daemon hypridle # Idle daemon
hyprlock # Screen locker hyprlock # Screen locker
hyprcursor # Cursor themes hyprcursor # Cursor themes