Regenerated
This commit is contained in:
+303
-293
File diff suppressed because it is too large
Load Diff
+15
-5
@@ -2080,7 +2080,8 @@ exec-once = hypridle
|
|||||||
exec-once = hyprpolkitagent
|
exec-once = hyprpolkitagent
|
||||||
exec-once = systemd-run --user --scope --unit=elephant elephant
|
exec-once = systemd-run --user --scope --unit=elephant elephant
|
||||||
exec-once = bash -c "sleep 5 && waybar"
|
exec-once = bash -c "sleep 5 && waybar"
|
||||||
exec-once = swww-daemon &
|
exec-once = swww-daemon & swww img -o eDP-1 ~/Wallpapers/pictures/18.jpg
|
||||||
|
exec-once = sh ~/Wallpapers/scripts/wallpaper.sh &
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** =.config/hypr/hypridle.conf=
|
** =.config/hypr/hypridle.conf=
|
||||||
@@ -2366,6 +2367,7 @@ let
|
|||||||
homeDir = "/home/${username}";
|
homeDir = "/home/${username}";
|
||||||
wallpaperSrc = "${flakeRoot}/assets/traveldroid/Wallpapers";
|
wallpaperSrc = "${flakeRoot}/assets/traveldroid/Wallpapers";
|
||||||
wallpaperDst = "${homeDir}/Wallpapers";
|
wallpaperDst = "${homeDir}/Wallpapers";
|
||||||
|
randoScript = "${homeDir}/Wallpapers/scripts/randomizeWallpapers.sh";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# Make bash available
|
# Make bash available
|
||||||
@@ -2404,17 +2406,27 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# User service to run the script
|
# User service to run the script that copies the Wallpaperstuff
|
||||||
systemd.user.services.copyWallpapers = {
|
systemd.user.services.copyWallpapers = {
|
||||||
description = "Copy wallpapers from repo to ~/Wallpapers";
|
description = "Copy wallpapers from repo to ~/Wallpapers";
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
ExecStart = "${homeDir}/copy-wallpapers.sh";
|
ExecStart = "${homeDir}/copy-wallpapers.sh";
|
||||||
Restart = "no";
|
Restart = "no";
|
||||||
WorkingDirectory = homeDir;
|
WorkingDirectory = homeDir;
|
||||||
};
|
};
|
||||||
|
wantedBy = [ "default.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
# User service to randomize wallpapers
|
||||||
|
systemd.user.services.copyWallpapers = {
|
||||||
|
description = "Copy wallpapers from repo to ~/Wallpapers";
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
ExecStart = "${randoScript}";
|
||||||
|
Restart = "no";
|
||||||
|
WorkingDirectory = homeDir;
|
||||||
|
};
|
||||||
wantedBy = [ "default.target" ];
|
wantedBy = [ "default.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2426,12 +2438,10 @@ in
|
|||||||
description = "Dynamic wallpapers per workspace for Hyprland";
|
description = "Dynamic wallpapers per workspace for Hyprland";
|
||||||
after = [ "graphical-session.target" ];
|
after = [ "graphical-session.target" ];
|
||||||
wants = [ "graphical-session.target" ];
|
wants = [ "graphical-session.target" ];
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${homeDir}/Wallpapers/scripts/workspace-wallpapers.sh";
|
ExecStart = "${homeDir}/Wallpapers/scripts/workspace-wallpapers.sh";
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
};
|
};
|
||||||
|
|
||||||
wantedBy = [ "default.target" ];
|
wantedBy = [ "default.target" ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
#!/run/current-system/sw/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
WALLPAPER_DIR="$HOME/Wallpapers/pictures"
|
||||||
|
echo "Wallpaper dir = $WALLPAPER_DIR"
|
||||||
|
|
||||||
|
randomize_and_rename_wallpapers() {
|
||||||
|
echo "Randomizing JPG filenames..."
|
||||||
|
|
||||||
|
shopt -s nullglob
|
||||||
|
|
||||||
|
# Grab all jpg/JPG files
|
||||||
|
files=("$WALLPAPER_DIR"/*.[jJ][pP][gG])
|
||||||
|
|
||||||
|
if [ ${#files[@]} -eq 0 ]; then
|
||||||
|
echo "No JPG files found in $WALLPAPER_DIR"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Shuffle the array
|
||||||
|
mapfile -t files < <(printf "%s\n" "${files[@]}" | shuf)
|
||||||
|
|
||||||
|
tmp_names=()
|
||||||
|
|
||||||
|
for file in "${files[@]}"; do
|
||||||
|
ext="${file##*.}"
|
||||||
|
|
||||||
|
# generate a random 16-character alphanumeric name
|
||||||
|
while : ; do
|
||||||
|
rand_name=$(head /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c16)
|
||||||
|
new_path="$WALLPAPER_DIR/$rand_name.$ext"
|
||||||
|
if [[ ! -e "$new_path" ]]; then
|
||||||
|
mv "$file" "$new_path"
|
||||||
|
tmp_names+=("$new_path")
|
||||||
|
echo "Renamed $file -> $new_path"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
# Sequentially rename to 01.jpg ... 99.jpg
|
||||||
|
counter=1
|
||||||
|
for file in "${tmp_names[@]}"; do
|
||||||
|
new_name=$(printf "%02d.jpg" "$counter")
|
||||||
|
mv "$file" "$WALLPAPER_DIR/$new_name"
|
||||||
|
echo "Final rename $file -> $WALLPAPER_DIR/$new_name"
|
||||||
|
((counter++))
|
||||||
|
[[ $counter -gt 99 ]] && break
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Randomization complete."
|
||||||
|
}
|
||||||
|
|
||||||
|
randomize_and_rename_wallpapers
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
WALLPAPER_DIR="$HOME/Wallpapers"
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Set wallpaper on all monitors
|
||||||
|
# -----------------------------
|
||||||
|
set_wallpaper_all_monitors() {
|
||||||
|
pic="$1"
|
||||||
|
monitors=$(hyprctl monitors -j | jq -r '.[].name') # list all monitor names
|
||||||
|
for m in $monitors; do
|
||||||
|
swww img -o "$m" -t fade --transition-duration 1 "$pic"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Handle workspace events
|
||||||
|
# -----------------------------
|
||||||
|
handle() {
|
||||||
|
case $1 in
|
||||||
|
workspace*)
|
||||||
|
workspace="${1: -1}" # last character
|
||||||
|
pic=""
|
||||||
|
case $workspace in
|
||||||
|
1) pic="$WALLPAPER_DIR/01.jpg" ;;
|
||||||
|
2) pic="$WALLPAPER_DIR/02.jpg" ;;
|
||||||
|
3) pic="$WALLPAPER_DIR/03.jpg" ;;
|
||||||
|
4) pic="$WALLPAPER_DIR/04.jpg" ;;
|
||||||
|
5) pic="$WALLPAPER_DIR/05.jpg" ;;
|
||||||
|
6) pic="$WALLPAPER_DIR/06.jpg" ;;
|
||||||
|
7) pic="$WALLPAPER_DIR/07.jpg" ;;
|
||||||
|
8) pic="$WALLPAPER_DIR/08.jpg" ;;
|
||||||
|
9) pic="$WALLPAPER_DIR/09.jpg" ;;
|
||||||
|
10) pic="$WALLPAPER_DIR/10.jpg" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
[ -n "$pic" ] && set_wallpaper_all_monitors "$pic"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Listen to Hyprland socket events
|
||||||
|
# -----------------------------
|
||||||
|
socat -U - UNIX-CONNECT:"$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" | while read -r line; do
|
||||||
|
handle "$line"
|
||||||
|
done
|
||||||
@@ -1,50 +1,41 @@
|
|||||||
#!/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
|
|
||||||
currentpath=/run/current-system/sw/bin
|
currentpath=/run/current-system/sw/bin
|
||||||
|
|
||||||
while [ ! -S "$IPC_SOCKET" ]; do
|
|
||||||
echo "Waiting for Hyprland socket..."
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
# -----------------------------
|
|
||||||
# Configuration
|
|
||||||
# -----------------------------
|
|
||||||
PICTURES_DIR="$HOME/Wallpapers/pictures"
|
PICTURES_DIR="$HOME/Wallpapers/pictures"
|
||||||
NAMESPACE="main" # Fixed swww namespace
|
NAMESPACE="main"
|
||||||
MONITOR=$($currentpath/hyprctl monitors -j | $currentpath/jq -r '.[0].name')
|
|
||||||
|
|
||||||
# -----------------------------
|
: "${XDG_RUNTIME_DIR:?XDG_RUNTIME_DIR is not set}"
|
||||||
# Start swww-daemon if not running
|
: "${HYPRLAND_INSTANCE_SIGNATURE:?HYPRLAND_INSTANCE_SIGNATURE is not set}"
|
||||||
# -----------------------------
|
|
||||||
if ! pgrep -x $currentpath/swww-daemon >/dev/null; then
|
|
||||||
echo "Starting swww-daemon..."
|
|
||||||
$currentpath/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"
|
IPC_SOCKET="$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock"
|
||||||
echo "Listening for workspace events on $IPC_SOCKET..."
|
|
||||||
|
|
||||||
$currentpath/socat -u UNIX-CONNECT:"$IPC_SOCKET" STDOUT | while read -r line; do
|
while [ ! -S "$IPC_SOCKET" ]; do sleep 1; done
|
||||||
if [[ "$line" =~ workspace\#([0-9]+) ]]; then
|
|
||||||
WS="${BASH_REMATCH[1]}"
|
echo $IPC_SOCKET
|
||||||
RAND_IMAGE="${IMAGES[RANDOM % ${#IMAGES[@]}]}"
|
|
||||||
echo "Workspace $WS active → setting wallpaper: $RAND_IMAGE"
|
# Start swww-daemon only if not already running for this namespace
|
||||||
$currentpath/swww img "$RAND_IMAGE" --resize stretch --transition-type random --namespace "$WS"
|
if [ ! -S "$XDG_RUNTIME_DIR/swww/$NAMESPACE.sock" ]; then
|
||||||
|
"$currentpath/swww-daemon" --namespace "$NAMESPACE" &
|
||||||
|
sleep 0.5
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Load wallpapers
|
||||||
|
mapfile -t IMAGES < <(find "$PICTURES_DIR" -type f \( -iname '*.png' -o -iname '*.jpg' -o -iname '*.jpeg' \))
|
||||||
|
[ "${#IMAGES[@]}" -eq 0 ] && exit 1
|
||||||
|
|
||||||
|
# Subscribe to workspace events
|
||||||
|
{
|
||||||
|
echo '{"subscribe":["workspace"]}'
|
||||||
|
"$currentpath/socat" - UNIX-CONNECT:"$IPC_SOCKET"
|
||||||
|
} | while read -r line; do
|
||||||
|
# Only parse lines starting with '{' (JSON)
|
||||||
|
if [[ "$line" =~ ^\{ ]]; then
|
||||||
|
WS_NUM=$(echo "$line" | "$currentpath/jq" -e -r 'select(.type=="workspace" and .active==true) | .workspace' 2>/dev/null || true)
|
||||||
|
if [ -n "$WS_NUM" ]; then
|
||||||
|
RAND_IMAGE="${IMAGES[RANDOM % ${#IMAGES[@]}]}"
|
||||||
|
MONITOR=$(echo "$line" | "$currentpath/jq" -r '.monitor')
|
||||||
|
"$currentpath/swww" img "$RAND_IMAGE" --resize stretch --transition-type random --namespace "$WS_NUM"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -3,4 +3,5 @@ exec-once = hypridle
|
|||||||
exec-once = hyprpolkitagent
|
exec-once = hyprpolkitagent
|
||||||
exec-once = systemd-run --user --scope --unit=elephant elephant
|
exec-once = systemd-run --user --scope --unit=elephant elephant
|
||||||
exec-once = bash -c "sleep 5 && waybar"
|
exec-once = bash -c "sleep 5 && waybar"
|
||||||
exec-once = swww-daemon &
|
exec-once = swww-daemon & swww img -o eDP-1 ~/Wallpapers/pictures/18.jpg
|
||||||
|
exec-once = sh ~/Wallpapers/scripts/wallpaper.sh &
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ let
|
|||||||
homeDir = "/home/${username}";
|
homeDir = "/home/${username}";
|
||||||
wallpaperSrc = "${flakeRoot}/assets/traveldroid/Wallpapers";
|
wallpaperSrc = "${flakeRoot}/assets/traveldroid/Wallpapers";
|
||||||
wallpaperDst = "${homeDir}/Wallpapers";
|
wallpaperDst = "${homeDir}/Wallpapers";
|
||||||
|
randoScript = "${homeDir}/Wallpapers/scripts/randomizeWallpapers.sh";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# Make bash available
|
# Make bash available
|
||||||
@@ -43,17 +44,27 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# User service to run the script
|
# User service to run the script that copies the Wallpaperstuff
|
||||||
systemd.user.services.copyWallpapers = {
|
systemd.user.services.copyWallpapers = {
|
||||||
description = "Copy wallpapers from repo to ~/Wallpapers";
|
description = "Copy wallpapers from repo to ~/Wallpapers";
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
ExecStart = "${homeDir}/copy-wallpapers.sh";
|
ExecStart = "${homeDir}/copy-wallpapers.sh";
|
||||||
Restart = "no";
|
Restart = "no";
|
||||||
WorkingDirectory = homeDir;
|
WorkingDirectory = homeDir;
|
||||||
};
|
};
|
||||||
|
wantedBy = [ "default.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
# User service to randomize wallpapers
|
||||||
|
systemd.user.services.copyWallpapers = {
|
||||||
|
description = "Copy wallpapers from repo to ~/Wallpapers";
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
ExecStart = "${randoScript}";
|
||||||
|
Restart = "no";
|
||||||
|
WorkingDirectory = homeDir;
|
||||||
|
};
|
||||||
wantedBy = [ "default.target" ];
|
wantedBy = [ "default.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -65,12 +76,10 @@ in
|
|||||||
description = "Dynamic wallpapers per workspace for Hyprland";
|
description = "Dynamic wallpapers per workspace for Hyprland";
|
||||||
after = [ "graphical-session.target" ];
|
after = [ "graphical-session.target" ];
|
||||||
wants = [ "graphical-session.target" ];
|
wants = [ "graphical-session.target" ];
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${homeDir}/Wallpapers/scripts/workspace-wallpapers.sh";
|
ExecStart = "${homeDir}/Wallpapers/scripts/workspace-wallpapers.sh";
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
};
|
};
|
||||||
|
|
||||||
wantedBy = [ "default.target" ];
|
wantedBy = [ "default.target" ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user