Regenerated
This commit is contained in:
+289
-321
File diff suppressed because it is too large
Load Diff
+1
-33
@@ -2366,7 +2366,6 @@ let
|
|||||||
homeDir = "/home/${username}";
|
homeDir = "/home/${username}";
|
||||||
wallpaperSrc = "${flakeRoot}/assets/traveldroid/Wallpapers";
|
wallpaperSrc = "${flakeRoot}/assets/traveldroid/Wallpapers";
|
||||||
wallpaperDst = "${homeDir}/Wallpapers";
|
wallpaperDst = "${homeDir}/Wallpapers";
|
||||||
scriptFile = "${homeDir}/Wallpapers/scripts/set-wallpapers.sh";
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# Make bash available
|
# Make bash available
|
||||||
@@ -2421,38 +2420,7 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
############################
|
############################
|
||||||
# User service to run wallpaper script/usr/bin/env bash
|
# Random background per workspace at logon
|
||||||
############################
|
|
||||||
systemd.user.services.wallpaperAtLogon = {
|
|
||||||
description = "Run wallpaper logon script";
|
|
||||||
after = [ "graphical-session.target" ];
|
|
||||||
wants = [ "graphical-session.target" ];
|
|
||||||
|
|
||||||
serviceConfig = {
|
|
||||||
Type = "oneshot";
|
|
||||||
ExecStart = scriptFile;
|
|
||||||
Restart = "no";
|
|
||||||
};
|
|
||||||
|
|
||||||
wantedBy = [ "default.target" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
############################
|
|
||||||
# Timer to run the script at login and every 15 minutes
|
|
||||||
############################
|
|
||||||
systemd.user.timers.wallpaperAtLogonTimer = {
|
|
||||||
description = "Run wallpaper script at login and every 15 minutes";
|
|
||||||
wantedBy = [ "timers.target" ];
|
|
||||||
|
|
||||||
timerConfig = {
|
|
||||||
OnBootSec = "1min"; # run 1 minute after login
|
|
||||||
OnUnitActiveSec = "15min"; # repeat every 15 minutes
|
|
||||||
Persistent = true; # catch up missed runs
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
############################
|
|
||||||
# Random background per workspace at boot
|
|
||||||
############################
|
############################
|
||||||
|
|
||||||
systemd.user.services.workspaceWallpapers = {
|
systemd.user.services.workspaceWallpapers = {
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
#!/run/current-system/sw/bin/bash
|
|
||||||
set -euo pipefail
|
|
||||||
echo "Running as $(whoami)"
|
|
||||||
|
|
||||||
# -----------------------------
|
|
||||||
# Configuration
|
|
||||||
# -----------------------------
|
|
||||||
PICTURES_DIR="$HOME/Wallpapers/pictures"
|
|
||||||
NAMESPACE="main" # Base namespace for swww-daemon
|
|
||||||
MONITOR=$(hyprctl monitors -j | jq -r '.[0].name') # First monitor
|
|
||||||
|
|
||||||
# -----------------------------
|
|
||||||
# Start swww-daemon if not running
|
|
||||||
# -----------------------------
|
|
||||||
if ! pgrep -x swww-daemon >/dev/null; then
|
|
||||||
echo "Starting swww-daemon..."
|
|
||||||
swww-daemon --namespace "$NAMESPACE" &
|
|
||||||
sleep 0.5 # give socket time to appear
|
|
||||||
fi
|
|
||||||
|
|
||||||
# -----------------------------
|
|
||||||
# Gather wallpapers
|
|
||||||
# -----------------------------
|
|
||||||
mapfile -t IMAGES < <(find "$PICTURES_DIR" -type f \( -iname '*.png' -o -iname '*.jpg' -o -iname '*.jpeg' \))
|
|
||||||
if [ "${#IMAGES[@]}" -eq 0 ]; then
|
|
||||||
echo "No images found in $PICTURES_DIR"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# -----------------------------
|
|
||||||
# Pre-assign wallpapers to each workspace
|
|
||||||
# -----------------------------
|
|
||||||
declare -A WS_WALLPAPER
|
|
||||||
for ws in $(hyprctl workspaces -j | jq -r '.[].id'); do
|
|
||||||
RAND_IMAGE="${IMAGES[RANDOM % ${#IMAGES[@]}]}"
|
|
||||||
WS_WALLPAPER["$ws"]="$RAND_IMAGE"
|
|
||||||
echo "Pre-assigning wallpaper for workspace $ws: $RAND_IMAGE"
|
|
||||||
swww img "$RAND_IMAGE" --resize stretch --transition-type random --namespace "$ws"
|
|
||||||
done
|
|
||||||
|
|
||||||
# -----------------------------
|
|
||||||
# Listen for workspace events
|
|
||||||
# -----------------------------
|
|
||||||
IPC_SOCKET="$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock"
|
|
||||||
echo "Listening for workspace events on $IPC_SOCKET..."
|
|
||||||
|
|
||||||
socat -u UNIX-CONNECT:"$IPC_SOCKET" STDOUT | while read -r line; do
|
|
||||||
if [[ "$line" =~ workspace\#([0-9]+) ]]; then
|
|
||||||
WS="${BASH_REMATCH[1]}"
|
|
||||||
# Use the pre-assigned wallpaper for this workspace
|
|
||||||
RAND_IMAGE="${WS_WALLPAPER[$WS]}"
|
|
||||||
echo "Workspace $WS active → setting wallpaper: $RAND_IMAGE"
|
|
||||||
swww img "$RAND_IMAGE" --resize stretch --transition-type random --namespace "$WS"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
@@ -1,19 +1,23 @@
|
|||||||
#!/run/current-system/sw/bin/bash
|
#!/run/current-system/sw/bin/bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
echo "Running as $(whoami)"
|
||||||
|
currentuser=$(whoami) # or set manually
|
||||||
|
currentprofile=/run/current-system/sw/bin
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
# Configuration
|
# Configuration
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
PICTURES_DIR="$HOME/Wallpapers/pictures"
|
PICTURES_DIR="$HOME/Wallpapers/pictures"
|
||||||
NAMESPACE="main" # Fixed swww namespace
|
NAMESPACE="main" # Fixed swww namespace
|
||||||
MONITOR=$(hyprctl monitors -j | jq -r '.[0].name') # First monitor
|
MONITOR=$($currentprofile/hyprctl monitors -j | $currentprofile/jq -r '.[0].name')
|
||||||
|
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
# Start swww-daemon if not running
|
# Start swww-daemon if not running
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
if ! pgrep -x swww-daemon >/dev/null; then
|
if ! pgrep -x swww-daemon >/dev/null; then
|
||||||
echo "Starting swww-daemon..."
|
echo "Starting swww-daemon..."
|
||||||
swww-daemon --namespace "$NAMESPACE" &
|
$currentprofile/swww-daemon --namespace "$NAMESPACE" &
|
||||||
sleep 0.5 # give socket time to appear
|
sleep 0.5 # give socket time to appear
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -37,6 +41,6 @@ socat -u UNIX-CONNECT:"$IPC_SOCKET" STDOUT | while read -r line; do
|
|||||||
WS="${BASH_REMATCH[1]}"
|
WS="${BASH_REMATCH[1]}"
|
||||||
RAND_IMAGE="${IMAGES[RANDOM % ${#IMAGES[@]}]}"
|
RAND_IMAGE="${IMAGES[RANDOM % ${#IMAGES[@]}]}"
|
||||||
echo "Workspace $WS active → setting wallpaper: $RAND_IMAGE"
|
echo "Workspace $WS active → setting wallpaper: $RAND_IMAGE"
|
||||||
swww img "$RAND_IMAGE" --resize stretch --transition-type random --namespace "$WS"
|
$currentprofile/swww img "$RAND_IMAGE" --resize stretch --transition-type random --namespace "$WS"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ let
|
|||||||
homeDir = "/home/${username}";
|
homeDir = "/home/${username}";
|
||||||
wallpaperSrc = "${flakeRoot}/assets/traveldroid/Wallpapers";
|
wallpaperSrc = "${flakeRoot}/assets/traveldroid/Wallpapers";
|
||||||
wallpaperDst = "${homeDir}/Wallpapers";
|
wallpaperDst = "${homeDir}/Wallpapers";
|
||||||
scriptFile = "${homeDir}/Wallpapers/scripts/set-wallpapers.sh";
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# Make bash available
|
# Make bash available
|
||||||
@@ -60,38 +59,7 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
############################
|
############################
|
||||||
# User service to run wallpaper script/usr/bin/env bash
|
# Random background per workspace at logon
|
||||||
############################
|
|
||||||
systemd.user.services.wallpaperAtLogon = {
|
|
||||||
description = "Run wallpaper logon script";
|
|
||||||
after = [ "graphical-session.target" ];
|
|
||||||
wants = [ "graphical-session.target" ];
|
|
||||||
|
|
||||||
serviceConfig = {
|
|
||||||
Type = "oneshot";
|
|
||||||
ExecStart = scriptFile;
|
|
||||||
Restart = "no";
|
|
||||||
};
|
|
||||||
|
|
||||||
wantedBy = [ "default.target" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
############################
|
|
||||||
# Timer to run the script at login and every 15 minutes
|
|
||||||
############################
|
|
||||||
systemd.user.timers.wallpaperAtLogonTimer = {
|
|
||||||
description = "Run wallpaper script at login and every 15 minutes";
|
|
||||||
wantedBy = [ "timers.target" ];
|
|
||||||
|
|
||||||
timerConfig = {
|
|
||||||
OnBootSec = "1min"; # run 1 minute after login
|
|
||||||
OnUnitActiveSec = "15min"; # repeat every 15 minutes
|
|
||||||
Persistent = true; # catch up missed runs
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
############################
|
|
||||||
# Random background per workspace at boot
|
|
||||||
############################
|
############################
|
||||||
|
|
||||||
systemd.user.services.workspaceWallpapers = {
|
systemd.user.services.workspaceWallpapers = {
|
||||||
|
|||||||
Reference in New Issue
Block a user