Regenerated

This commit is contained in:
2026-03-29 12:05:13 +00:00
parent db2f3e522e
commit 101ab20168
6 changed files with 450 additions and 615 deletions
+332 -395
View File
File diff suppressed because it is too large Load Diff
+43 -106
View File
@@ -2115,7 +2115,7 @@ source = ./layer-rules.conf
source = ./layout.conf source = ./layout.conf
source = ./monitor-rules.conf source = ./monitor-rules.conf
# source = ./window-rules.conf # source = ./window-rules.conf
# source = ./workspace-rules.conf source = ./workspace-rules.conf
exec-once = /nix/store/c9cnbxhxbagj7gfpc1g5hl4x4f8dzayv-dbus-1.16.2/bin/dbus-update-activation-environment --systemd DISPLAY HYPRLAND_INSTANCE_SIGNATURE WAYLAND_DISPLAY XDG_CURRENT_DESKTOP XDG_SESSION_TYPE && systemctl --user stop hyprland-session.target && systemctl --user start hyprland-session.target exec-once = /nix/store/c9cnbxhxbagj7gfpc1g5hl4x4f8dzayv-dbus-1.16.2/bin/dbus-update-activation-environment --systemd DISPLAY HYPRLAND_INSTANCE_SIGNATURE WAYLAND_DISPLAY XDG_CURRENT_DESKTOP XDG_SESSION_TYPE && systemctl --user stop hyprland-session.target && systemctl --user start hyprland-session.target
@@ -2314,6 +2314,12 @@ windowrulev2 = floatclass:Wofi,opacity:0.9,blur:15
** =.config/hypr/workspace-rules.conf= ** =.config/hypr/workspace-rules.conf=
These are config files for .config/hypr These are config files for .config/hypr
#+BEGIN_SRC conf :tangle generated/.config/hypr/workspace-rules.conf :noweb yes :mkdirp yes :eval never #+BEGIN_SRC conf :tangle generated/.config/hypr/workspace-rules.conf :noweb yes :mkdirp yes :eval never
#Load random wallpaper
workspacecreated = exec $HOME/.local/bin/wallpaper-sync-and-set.sh $workspace
/*
# Workspace definitions (modern syntax) # Workspace definitions (modern syntax)
workspace = 1 workspace = 1
workspace = 2 workspace = 2
@@ -2321,6 +2327,7 @@ workspace = 3
workspace = 4 workspace = 4
workspace = 5 workspace = 5
/*
# Auto-launch apps on specific workspaces (use `exec` with `workspace` rule) # Auto-launch apps on specific workspaces (use `exec` with `workspace` rule)
exec-once = kitty, workspace 1 exec-once = kitty, workspace 1
exec-once = flatpak run app.betterbird.zen, workspace 2 exec-once = flatpak run app.betterbird.zen, workspace 2
@@ -2344,85 +2351,25 @@ windowrule = move workspace 3, ^(libreoffice)$
workspace { workspace {
cycle_move_empty = no cycle_move_empty = no
} }
*/
#+END_SRC #+END_SRC
** =generated/modules/traveldroid/desktop/wallpaper.nix= ** =generated/modules/traveldroid/desktop/wallpaper.nix=
Setting up wallpaper engine + wallpaper gui Setting up wallpaper engine + wallpaper gui
#+BEGIN_SRC nix :tangle generated/modules/traveldroid/desktop/wallpaper.nix :noweb yes :mkdirp yes :eval never #+BEGIN_SRC nix :tangle generated/modules/traveldroid/desktop/wallpaper.nix :noweb yes :mkdirp yes :eval never
{ config, pkgs, lib, flakeRoot, ... }: { config, pkgs, lib, ... }:
let let
username = config.defaultUser or "henrov"; username = config.defaultUser or "henrov";
homeDir = "/home/${username}"; homeDir = "/home/${username}";
wallpaperSrc = "${flakeRoot}/assets/Wallpapers"; wallpaperDir = "${homeDir}/Wallpapers";
wallpaperDst = "${homeDir}/Wallpapers"; scriptDest = "${homeDir}/Wallpapers/wallpaper-sync-and-set.sh";
script = pkgs.writeShellScript "wallpaper-sync-and-set.sh" ''
#!/usr/bin/env bash
set -euo pipefail
SRC="${wallpaperSrc}"
DST="${wallpaperDst}"
mkdir -p "$SRC" "$DST"
########################################
# 2-way sync (additive, newer wins)
########################################
# SRC -> DST
rsync -au "$SRC/" "$DST/"
# DST -> SRC
rsync -au "$DST/" "$SRC/"
########################################
# Initialize swww (safe if already running)
########################################
if ! pgrep -x swww-daemon >/dev/null; then
swww init
sleep 1
fi
########################################
# Get workspaces
########################################
WORKSPACES=$(hyprctl workspaces -j | jq -r '.[].id')
########################################
# Function: set random wallpaper for workspace
########################################
set_wallpaper() {
local WS="$1"
WALL=$(find "$DST" -type f | shuf -n 1)
if [ -n "$WALL" ]; then
hyprctl dispatch workspace "$WS"
swww img "$WALL" --transition-type any
fi
}
########################################
# If workspace passed only update that
########################################
if [ "$#" -eq 1 ]; then
set_wallpaper "$1"
exit 0
fi
########################################
# Otherwise: update all workspaces
########################################
for WS in $WORKSPACES; do
set_wallpaper "$WS"
done
'';
in in
{ {
################################# ############################
# Packages # Systemwide packages
################################# ############################
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
swww swww
waypaper waypaper
@@ -2430,48 +2377,38 @@ in
rsync rsync
]; ];
################################# ############################
# Service: main worker # Install the script
################################# ############################
home.file."Wallpapers/wallpaper-sync-and-set.sh".source = ./assets/Wallpapers/wallpaper-sync-and-set.sh;
home.file."Wallpapers/wallpaper-sync-and-set.sh".executable = true;
############################
# Systemd user service + timer
############################
systemd.user.services.wallpaperSync = { systemd.user.services.wallpaperSync = {
description = "2-way sync wallpapers + set random per workspace"; description = "2-way sync wallpapers + set random per workspace";
after = [ "graphical-session.target" ]; serviceConfig.Type = "oneshot";
serviceConfig.ExecStart = "${scriptDest}";
serviceConfig = { serviceConfig.Restart = "on-failure";
Type = "oneshot";
ExecStart = "${script}";
};
wantedBy = [ "default.target" ]; # run at login
}; };
################################# systemd.user.timers.wallpaperSyncTimer = {
# Timer: every hour description = "Run wallpaper sync every hour";
#################################
systemd.user.timers.wallpaperSync = {
description = "Run wallpaper sync hourly";
wantedBy = [ "timers.target" ]; wantedBy = [ "timers.target" ];
timerConfig.OnCalendar = "hourly";
timerConfig = { timerConfig.Persistent = true;
OnBootSec = "2min";
OnUnitActiveSec = "1h";
Persistent = true;
};
}; };
################################# ############################
# Hyprland integration (new workspace) # Run at login
################################# ############################
# This assumes you manage Hyprland via Nix/Home Manager systemd.user.services.wallpaperSyncLogin = {
################################# description = "Run wallpaper sync at login";
environment.etc."hypr/hyprland.conf".text = lib.mkAfter '' serviceConfig.Type = "oneshot";
# Run wallpaper script when workspace changes serviceConfig.ExecStart = "${scriptDest}";
bind = SUPER, Return, exec, ${script} install.WantedBy = [ "default.target" ];
};
# Hook: when workspace is created/switched
exec-once = hyprctl --batch "dispatch exec ${script}"
'';
} }
#+END_SRC #+END_SRC
@@ -1,11 +1,36 @@
#!/usr/bin/env bash #!/usr/bin/env bash
WALLS=("${HOME}/Wallpapers"/*) set -euo pipefail
NUM_WALLS=${#WALLS[@]}
# Get workspace IDs # Determine repo root dynamically
WS_IDS=($(hyprctl workspaces -j | jq -r '.[].id')) repoRoot="$(dirname "$(readlink -f "$0")")/../.."
wallpaperSrc="$repoRoot/assets/Wallpapers"
wallpaperDst="$HOME/Wallpapers"
for i in "${!WS_IDS[@]}"; do mkdir -p "$wallpaperDst"
WALL="${WALLS[$((i % NUM_WALLS))]}"
swww img "$WALL" --workspace "${WS_IDS[$i]}" --transition-type fade slide blend zoom wipe cube fade-zoom slide-zoom # 2-way sync (add only, overwrite if newer, never delete)
done 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
@@ -7,7 +7,7 @@ source = ./layer-rules.conf
source = ./layout.conf source = ./layout.conf
source = ./monitor-rules.conf source = ./monitor-rules.conf
# source = ./window-rules.conf # source = ./window-rules.conf
# source = ./workspace-rules.conf source = ./workspace-rules.conf
exec-once = /nix/store/c9cnbxhxbagj7gfpc1g5hl4x4f8dzayv-dbus-1.16.2/bin/dbus-update-activation-environment --systemd DISPLAY HYPRLAND_INSTANCE_SIGNATURE WAYLAND_DISPLAY XDG_CURRENT_DESKTOP XDG_SESSION_TYPE && systemctl --user stop hyprland-session.target && systemctl --user start hyprland-session.target exec-once = /nix/store/c9cnbxhxbagj7gfpc1g5hl4x4f8dzayv-dbus-1.16.2/bin/dbus-update-activation-environment --systemd DISPLAY HYPRLAND_INSTANCE_SIGNATURE WAYLAND_DISPLAY XDG_CURRENT_DESKTOP XDG_SESSION_TYPE && systemctl --user stop hyprland-session.target && systemctl --user start hyprland-session.target
@@ -1,3 +1,8 @@
#Load random wallpaper
workspacecreated = exec $HOME/.local/bin/wallpaper-sync-and-set.sh $workspace
/*
# Workspace definitions (modern syntax) # Workspace definitions (modern syntax)
workspace = 1 workspace = 1
workspace = 2 workspace = 2
@@ -5,6 +10,7 @@ workspace = 3
workspace = 4 workspace = 4
workspace = 5 workspace = 5
/*
# Auto-launch apps on specific workspaces (use `exec` with `workspace` rule) # Auto-launch apps on specific workspaces (use `exec` with `workspace` rule)
exec-once = kitty, workspace 1 exec-once = kitty, workspace 1
exec-once = flatpak run app.betterbird.zen, workspace 2 exec-once = flatpak run app.betterbird.zen, workspace 2
@@ -28,3 +34,5 @@ windowrule = move workspace 3, ^(libreoffice)$
workspace { workspace {
cycle_move_empty = no cycle_move_empty = no
} }
*/
@@ -1,77 +1,15 @@
{ config, pkgs, lib, flakeRoot, ... }: { config, pkgs, lib, ... }:
let let
username = config.defaultUser or "henrov"; username = config.defaultUser or "henrov";
homeDir = "/home/${username}"; homeDir = "/home/${username}";
wallpaperSrc = "${flakeRoot}/assets/Wallpapers"; wallpaperDir = "${homeDir}/Wallpapers";
wallpaperDst = "${homeDir}/Wallpapers"; scriptDest = "${homeDir}/Wallpapers/wallpaper-sync-and-set.sh";
script = pkgs.writeShellScript "wallpaper-sync-and-set.sh" ''
#!/usr/bin/env bash
set -euo pipefail
SRC="${wallpaperSrc}"
DST="${wallpaperDst}"
mkdir -p "$SRC" "$DST"
########################################
# 2-way sync (additive, newer wins)
########################################
# SRC -> DST
rsync -au "$SRC/" "$DST/"
# DST -> SRC
rsync -au "$DST/" "$SRC/"
########################################
# Initialize swww (safe if already running)
########################################
if ! pgrep -x swww-daemon >/dev/null; then
swww init
sleep 1
fi
########################################
# Get workspaces
########################################
WORKSPACES=$(hyprctl workspaces -j | jq -r '.[].id')
########################################
# Function: set random wallpaper for workspace
########################################
set_wallpaper() {
local WS="$1"
WALL=$(find "$DST" -type f | shuf -n 1)
if [ -n "$WALL" ]; then
hyprctl dispatch workspace "$WS"
swww img "$WALL" --transition-type any
fi
}
########################################
# If workspace passed only update that
########################################
if [ "$#" -eq 1 ]; then
set_wallpaper "$1"
exit 0
fi
########################################
# Otherwise: update all workspaces
########################################
for WS in $WORKSPACES; do
set_wallpaper "$WS"
done
'';
in in
{ {
################################# ############################
# Packages # Systemwide packages
################################# ############################
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
swww swww
waypaper waypaper
@@ -79,46 +17,36 @@ in
rsync rsync
]; ];
################################# ############################
# Service: main worker # Install the script
################################# ############################
home.file."Wallpapers/wallpaper-sync-and-set.sh".source = ./assets/Wallpapers/wallpaper-sync-and-set.sh;
home.file."Wallpapers/wallpaper-sync-and-set.sh".executable = true;
############################
# Systemd user service + timer
############################
systemd.user.services.wallpaperSync = { systemd.user.services.wallpaperSync = {
description = "2-way sync wallpapers + set random per workspace"; description = "2-way sync wallpapers + set random per workspace";
after = [ "graphical-session.target" ]; serviceConfig.Type = "oneshot";
serviceConfig.ExecStart = "${scriptDest}";
serviceConfig = { serviceConfig.Restart = "on-failure";
Type = "oneshot";
ExecStart = "${script}";
};
wantedBy = [ "default.target" ]; # run at login
}; };
################################# systemd.user.timers.wallpaperSyncTimer = {
# Timer: every hour description = "Run wallpaper sync every hour";
#################################
systemd.user.timers.wallpaperSync = {
description = "Run wallpaper sync hourly";
wantedBy = [ "timers.target" ]; wantedBy = [ "timers.target" ];
timerConfig.OnCalendar = "hourly";
timerConfig = { timerConfig.Persistent = true;
OnBootSec = "2min";
OnUnitActiveSec = "1h";
Persistent = true;
};
}; };
################################# ############################
# Hyprland integration (new workspace) # Run at login
################################# ############################
# This assumes you manage Hyprland via Nix/Home Manager systemd.user.services.wallpaperSyncLogin = {
################################# description = "Run wallpaper sync at login";
environment.etc."hypr/hyprland.conf".text = lib.mkAfter '' serviceConfig.Type = "oneshot";
# Run wallpaper script when workspace changes serviceConfig.ExecStart = "${scriptDest}";
bind = SUPER, Return, exec, ${script} install.WantedBy = [ "default.target" ];
};
# Hook: when workspace is created/switched
exec-once = hyprctl --batch "dispatch exec ${script}"
'';
} }