Regenerated
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
PICTURES_DIR="$HOME/Wallpapers/pictures"
|
||||
|
||||
# -----------------------------
|
||||
# Get list of images
|
||||
# -----------------------------
|
||||
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
|
||||
|
||||
# -----------------------------
|
||||
# Set a random wallpaper per workspace
|
||||
# -----------------------------
|
||||
WORKSPACES=$(hyprctl workspaces -j | jq -r '.[].id')
|
||||
|
||||
for ws in $WORKSPACES; do
|
||||
RAND_IMAGE="${IMAGES[RANDOM % ${#IMAGES[@]}]}"
|
||||
echo "Setting wallpaper for workspace $ws: $RAND_IMAGE"
|
||||
# Set wallpaper for workspace
|
||||
swww img "$RAND_IMAGE" --resize fit --transition-type random --namespace "$ws"
|
||||
done
|
||||
@@ -1,36 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Determine repo root dynamically
|
||||
repoRoot="$(dirname "$(readlink -f "$0")")/../.."
|
||||
wallpaperSrc="$repoRoot/assets/Wallpapers"
|
||||
wallpaperDst="$HOME/Wallpapers"
|
||||
|
||||
mkdir -p "$wallpaperDst"
|
||||
|
||||
# 2-way sync (add only, overwrite if newer, never delete)
|
||||
rsync -au --ignore-existing "$wallpaperSrc/" "$wallpaperDst/"
|
||||
rsync -tu "$wallpaperDst/" "$wallpaperSrc/"
|
||||
|
||||
# Gather wallpapers
|
||||
mapfile -t wallpapers < <(find "$wallpaperDst" -type f)
|
||||
numWallpapers=${#wallpapers[@]}
|
||||
|
||||
if [[ $numWallpapers -eq 0 ]]; then
|
||||
echo "No wallpapers found in $wallpaperDst"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if a workspace ID is passed
|
||||
if [[ $# -eq 1 ]]; then
|
||||
ws="$1"
|
||||
randomIndex=$(( RANDOM % numWallpapers ))
|
||||
swww img "${wallpapers[$randomIndex]}" --transition-fade 1 --workspace "$ws"
|
||||
else
|
||||
# Full refresh for all workspaces
|
||||
workspaces=$(hyprctl workspaces -j | jq -r '.[].id')
|
||||
for ws in $workspaces; do
|
||||
randomIndex=$(( RANDOM % numWallpapers ))
|
||||
swww img "${wallpapers[$randomIndex]}" --transition-fade 1 --workspace "$ws"
|
||||
done
|
||||
fi
|
||||
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# -----------------------------
|
||||
# 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,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
pgrep swww >/dev/null 2>&1 || swww &
|
||||
mkdir -p ~/Wallpapers
|
||||
rsync -au --ignore-existing ../ ~/
|
||||
rsync -au ../ ~/
|
||||
#bash ./set-wallpapers-at-logon.sh
|
||||
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# -----------------------------
|
||||
# Configuration
|
||||
# -----------------------------
|
||||
PICTURES_DIR="$HOME/Wallpapers/pictures"
|
||||
NAMESPACE="main" # Fixed swww namespace
|
||||
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
|
||||
|
||||
# -----------------------------
|
||||
# Workspace event listener
|
||||
# -----------------------------
|
||||
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]}"
|
||||
RAND_IMAGE="${IMAGES[RANDOM % ${#IMAGES[@]}]}"
|
||||
echo "Workspace $WS active → setting wallpaper: $RAND_IMAGE"
|
||||
swww img "$RAND_IMAGE" --resize stretch --transition-type random --namespace "$WS"
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user