New script with writable toml

This commit is contained in:
2026-02-26 21:04:59 +01:00
parent 6ac406218f
commit 9445a13169
5 changed files with 726 additions and 862 deletions
+478 -442
View File
File diff suppressed because it is too large Load Diff
+153 -121
View File
@@ -1657,127 +1657,6 @@ This module will import all necessities.
} }
#+end_src #+end_src
** Rotating Wallpaper
rotating_wallpaper.nix installs wpaperd and deploys your wallpaper files from the repo (./assets/conf/desktop/wallpaper/pictures/) into ~/conf/desktop/wallpaper/pictures. It also deploys the default wallpaper configuration from assets/conf/desktop/wallpaper/wallpaper.conf into ~/conf/desktop/wallpaper/wallpaper.conf, which is the file you can edit as a user override.
Finally, it creates a systemd user service (wpaperd.service) that automatically starts wpaperd at login and keeps it running, using your override config so wallpapers rotate according to your settings.
#+begin_src nix :tangle home/desktop/rotating_wallpaper.nix :noweb tangle :mkdirp yes
{ config, lib, pkgs, ... }:
let
scriptPath = "hypr/scripts/wp-workspace-1to9.sh";
wpScript = ''
#!/usr/bin/env bash
set -euo pipefail
WALL_DIR="''${1:-$HOME/nixos_conf/wallpaperstuff/pictures}"
: "''${XDG_RUNTIME_DIR:?XDG_RUNTIME_DIR not set}"
: "''${HYPRLAND_INSTANCE_SIGNATURE:?HYPRLAND_INSTANCE_SIGNATURE not set}"
SOCK="''${XDG_RUNTIME_DIR}/hypr/''${HYPRLAND_INSTANCE_SIGNATURE}/.socket2.sock"
[[ -S "$SOCK" ]] || { echo "Hyprland socket not found: $SOCK" >&2; exit 1; }
need() { command -v "$1" >/dev/null 2>&1 || { echo "Missing dependency: $1" >&2; exit 1; }; }
need hyprctl
need wpaperctl
need socat
get_active_ws_id() {
if command -v jq >/dev/null 2>&1; then
hyprctl activeworkspace -j | jq -r '.id'
else
hyprctl activeworkspace | awk '/workspace ID/ {print $3; exit}'
fi
}
get_active_monitor() {
if command -v jq >/dev/null 2>&1; then
hyprctl activeworkspace -j | jq -r '.monitor'
else
hyprctl activeworkspace | sed -n 's/.* on monitor \([^:]*\):.*/\1/p' | head -n1
fi
}
set_for_ws() {
local ws_raw="$1"
local ws="''${ws_raw%%:*}"
[[ "$ws" =~ ^[1-9]$ ]] || return 0
local img="''${WALL_DIR}/wallpaper''${ws}.jpg"
[[ -f "$img" ]] || return 0
local mon
mon="$(get_active_monitor)"
if [[ -n "''${mon:-}" ]]; then
wpaperctl set "$img" "$mon"
else
wpaperctl set "$img"
fi
}
preseed_1_to_9() {
local orig
orig="$(get_active_ws_id)"
for ws in {1..9}; do
hyprctl dispatch workspace "$ws" >/dev/null
sleep 0.05
set_for_ws "$ws"
done
hyprctl dispatch workspace "$orig" >/dev/null
}
# Start daemon if not already running
if ! pgrep -x wpaperd >/dev/null; then
wpaperd -d &
sleep 0.5
fi
preseed_1_to_9
set_for_ws "$(get_active_ws_id)"
while IFS= read -r line; do
case "$line" in
workspace\>\>*)
set_for_ws "''${line#workspace>>}"
;;
workspacev2\>\>*)
payload="''${line#workspacev2>>}"
ws_id="''${payload%%,*}"
set_for_ws "$ws_id"
;;
esac
done < <(socat -U - "UNIX-CONNECT:''${SOCK}")
'';
in
{
home.packages = with pkgs; [
wpaperd
socat
jq
];
# Write script
xdg.configFile."${scriptPath}" = {
text = wpScript;
executable = true;
};
# Ensure Hyprland starts it
wayland.windowManager.hyprland = {
enable = true;
extraConfig = ''
exec-once = ${config.xdg.configHome}/${scriptPath}
'';
};
}
#+end_src
** Animated Wallpaper ** Animated Wallpaper
userRelRoot = "nixos_conf/wallpaperstuff"; userRelRoot = "nixos_conf/wallpaperstuff";
animated_wallpaper.nix installs mpvpaper and deploys your wallpaper files from the repo (./assets/conf/desktop/wallpaper) into ~/conf/desktop/wallpaper/pictures. animated_wallpaper.nix installs mpvpaper and deploys your wallpaper files from the repo (./assets/conf/desktop/wallpaper) into ~/conf/desktop/wallpaper/pictures.
@@ -1834,6 +1713,159 @@ in
} }
#+end_src #+end_src
** Rotating Wallpaper
rotating_wallpaper.nix installs wpaperd and deploys your wallpaper files from the repo (./assets/conf/desktop/wallpaper/pictures/) into ~/conf/desktop/wallpaper/pictures. It also deploys the default wallpaper configuration from assets/conf/desktop/wallpaper/wallpaper.conf into ~/conf/desktop/wallpaper/wallpaper.conf, which is the file you can edit as a user override.
Finally, it creates a systemd user service (wpaperd.service) that automatically starts wpaperd at login and keeps it running, using your override config so wallpapers rotate according to your settings.
#+begin_src nix :tangle home/desktop/rotating_wallpaper.nix :noweb tangle :mkdirp yes
#+begin_src nix :tangle home/desktop/wallpaper.nix :noweb tangle :mkdirp yes
{ config, pkgs, lib, flakeRoot, ... }:
let
repoWallpaperDir = flakeRoot + "/assets/conf/desktop/wallpaper";
repoWallpaperConf = flakeRoot + "/assets/conf/desktop/wallpaper/wallpaper.conf";
userRelRoot = "nixos_conf/wallpaperstuff";
userAbsRoot = "${config.home.homeDirectory}/${userRelRoot}";
userConfPath = "${userAbsRoot}/wallpaper.conf";
# Exclude wallpaper.conf so HM does NOT manage it (avoids backup collisions)
repoWallpapersOnly = lib.cleanSourceWith {
src = repoWallpaperDir;
filter = path: type:
(builtins.baseNameOf path) != "wallpaper.conf";
};
in
{
home.packages = [ pkgs.wpaperd ];
# Sync everything *except* wallpaper.conf into ~/nixos_conf/wallpaperstuff
home.file."${userRelRoot}" = {
source = repoWallpapersOnly;
recursive = true;
};
# Now safely overwrite the config every activation (no HM collision)
home.activation.wallpaperConfForce =
lib.hm.dag.entryAfter [ "writeBoundary" ] ''
set -euo pipefail
mkdir -p "${userAbsRoot}"
install -m 0644 "${repoWallpaperConf}" "${userConfPath}"
'';
systemd.user.services.wpaperd = {
Unit = {
Description = "wpaperd wallpaper daemon";
After = [ "default.target" ];
};
Service = {
Type = "simple";
ExecStart = "${pkgs.wpaperd}/bin/wpaperd --config ${userConfPath}";
Restart = "on-failure";
RestartSec = 1;
};
Install.WantedBy = [ "default.target" ];
};
}
#+end_src
** Workspace Wallpaper
#+begin_src nix :tangle home/desktop/workspace_wallpaper.nix :noweb tangle :mkdirp yes
{ config, lib, pkgs, flakeRoot, ... }:
let
# Repo inputs
repoWallpaperDir = flakeRoot + "/assets/conf/desktop/wallpaper";
# Where we sync assets to (writable)
userRelRoot = "nixos_conf/wallpaperstuff";
userAbsRoot = "${config.home.homeDirectory}/${userRelRoot}";
picturesDir = "${userAbsRoot}/pictures";
# Writable runtime TOML (NOT under ~/.config)
runtimeConf = "${userAbsRoot}/wpaperd-runtime.toml";
# Your generator script (synced from repo into userAbsRoot)
wsScript = "${userAbsRoot}/wpaperd-workspace-1to9.sh";
# Sync everything in repoWallpaperDir to ~/nixos_conf/wallpaperstuff,
# but keep it simple: we exclude no files here unless you want to.
repoWallpapersOnly = lib.cleanSourceWith {
src = repoWallpaperDir;
filter = path: type: true;
};
in
{
home.packages = [
pkgs.wpaperd
];
# 1) Sync your wallpaper assets + scripts into a writable location
home.file."${userRelRoot}" = {
source = repoWallpapersOnly;
recursive = true;
};
# 2) Ensure we have a writable runtime config (created if missing)
#
# NOTE: We intentionally do NOT create ~/.config/wpaperd/config.toml via HM,
# because HM places managed files in /nix/store and symlinks them (read-only),
# which breaks apps/scripts that want to write there.
home.activation.ensureWpaperdRuntimeConf =
lib.hm.dag.entryAfter [ "writeBoundary" ] ''
mkdir -p "${userAbsRoot}"
mkdir -p "${picturesDir}"
if [ ! -f "${runtimeConf}" ]; then
cat > "${runtimeConf}" <<'EOF'
[default]
mode = "stretch"
# Fallback for outputs not explicitly listed:
[any]
path = "__WALLPAPER_DIR__"
EOF
# default: point [any].path at your pictures dir
${pkgs.gnused}/bin/sed -i "s|__WALLPAPER_DIR__|${picturesDir}|g" "${runtimeConf}"
fi
'';
# 3) wpaperd user service: always use the writable runtime config
systemd.user.services.wpaperd = {
Unit = {
Description = "wpaperd wallpaper daemon (runtime config)";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
};
Service = {
ExecStart = "${pkgs.wpaperd}/bin/wpaperd --config ${runtimeConf}";
Restart = "on-failure";
RestartSec = 1;
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
};
# 4) Optional: run your workspace generator once per login, then restart wpaperd
systemd.user.services.wpaperd-workspaces-init = {
Unit = {
Description = "Generate workspace wallpapers (wpaperd runtime config)";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
};
Service = {
Type = "oneshot";
ExecStart = "${pkgs.bash}/bin/bash ${wsScript} ${picturesDir}";
ExecStartPost = "${pkgs.systemd}/bin/systemctl --user restart wpaperd";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
};
}
#+end_src
** Waybar ** Waybar
[[./.github/images/waybar.png]] [[./.github/images/waybar.png]]
+36 -107
View File
@@ -1,114 +1,43 @@
{ config, lib, pkgs, ... }: #+begin_src nix :tangle home/desktop/wallpaper.nix :noweb tangle :mkdirp yes
{ config, pkgs, lib, flakeRoot, ... }:
let let
scriptPath = "hypr/scripts/wp-workspace-1to9.sh"; repoWallpaperDir = flakeRoot + "/assets/conf/desktop/wallpaper";
repoWallpaperConf = flakeRoot + "/assets/conf/desktop/wallpaper/wallpaper.conf";
wpScript = '' userRelRoot = "nixos_conf/wallpaperstuff";
#!/usr/bin/env bash userAbsRoot = "${config.home.homeDirectory}/${userRelRoot}";
set -euo pipefail userConfPath = "${userAbsRoot}/wallpaper.conf";
# Exclude wallpaper.conf so HM does NOT manage it (avoids backup collisions)
WALL_DIR="''${1:-$HOME/nixos_conf/wallpaperstuff/pictures}" repoWallpapersOnly = lib.cleanSourceWith {
src = repoWallpaperDir;
: "''${XDG_RUNTIME_DIR:?XDG_RUNTIME_DIR not set}" filter = path: type:
: "''${HYPRLAND_INSTANCE_SIGNATURE:?HYPRLAND_INSTANCE_SIGNATURE not set}" (builtins.baseNameOf path) != "wallpaper.conf";
};
SOCK="''${XDG_RUNTIME_DIR}/hypr/''${HYPRLAND_INSTANCE_SIGNATURE}/.socket2.sock"
[[ -S "$SOCK" ]] || { echo "Hyprland socket not found: $SOCK" >&2; exit 1; }
need() { command -v "$1" >/dev/null 2>&1 || { echo "Missing dependency: $1" >&2; exit 1; }; }
need hyprctl
need wpaperctl
need socat
get_active_ws_id() {
if command -v jq >/dev/null 2>&1; then
hyprctl activeworkspace -j | jq -r '.id'
else
hyprctl activeworkspace | awk '/workspace ID/ {print $3; exit}'
fi
}
get_active_monitor() {
if command -v jq >/dev/null 2>&1; then
hyprctl activeworkspace -j | jq -r '.monitor'
else
hyprctl activeworkspace | sed -n 's/.* on monitor \([^:]*\):.*/\1/p' | head -n1
fi
}
set_for_ws() {
local ws_raw="$1"
local ws="''${ws_raw%%:*}"
[[ "$ws" =~ ^[1-9]$ ]] || return 0
local img="''${WALL_DIR}/wallpaper''${ws}.jpg"
[[ -f "$img" ]] || return 0
local mon
mon="$(get_active_monitor)"
if [[ -n "''${mon:-}" ]]; then
wpaperctl set "$img" "$mon"
else
wpaperctl set "$img"
fi
}
preseed_1_to_9() {
local orig
orig="$(get_active_ws_id)"
for ws in {1..9}; do
hyprctl dispatch workspace "$ws" >/dev/null
sleep 0.05
set_for_ws "$ws"
done
hyprctl dispatch workspace "$orig" >/dev/null
}
# Start daemon if not already running
if ! pgrep -x wpaperd >/dev/null; then
wpaperd -d &
sleep 0.5
fi
preseed_1_to_9
set_for_ws "$(get_active_ws_id)"
while IFS= read -r line; do
case "$line" in
workspace\>\>*)
set_for_ws "''${line#workspace>>}"
;;
workspacev2\>\>*)
payload="''${line#workspacev2>>}"
ws_id="''${payload%%,*}"
set_for_ws "$ws_id"
;;
esac
done < <(socat -U - "UNIX-CONNECT:''${SOCK}")
'';
in in
{ {
home.packages = with pkgs; [ home.packages = [ pkgs.wpaperd ];
wpaperd # Sync everything *except* wallpaper.conf into ~/nixos_conf/wallpaperstuff
socat home.file."${userRelRoot}" = {
jq source = repoWallpapersOnly;
]; recursive = true;
# Write script
xdg.configFile."${scriptPath}" = {
text = wpScript;
executable = true;
}; };
# Now safely overwrite the config every activation (no HM collision)
# Ensure Hyprland starts it home.activation.wallpaperConfForce =
wayland.windowManager.hyprland = { lib.hm.dag.entryAfter [ "writeBoundary" ] ''
enable = true; set -euo pipefail
mkdir -p "${userAbsRoot}"
extraConfig = '' install -m 0644 "${repoWallpaperConf}" "${userConfPath}"
exec-once = ${config.xdg.configHome}/${scriptPath}
''; '';
systemd.user.services.wpaperd = {
Unit = {
Description = "wpaperd wallpaper daemon";
After = [ "default.target" ];
};
Service = {
Type = "simple";
ExecStart = "${pkgs.wpaperd}/bin/wpaperd --config ${userConfPath}";
Restart = "on-failure";
RestartSec = 1;
};
Install.WantedBy = [ "default.target" ];
}; };
} }
-42
View File
@@ -1,42 +0,0 @@
{ config, pkgs, lib, flakeRoot, ... }:
let
repoWallpaperDir = flakeRoot + "/assets/conf/desktop/wallpaper";
repoWallpaperConf = flakeRoot + "/assets/conf/desktop/wallpaper/wallpaper.conf";
userRelRoot = "nixos_conf/wallpaperstuff";
userAbsRoot = "${config.home.homeDirectory}/${userRelRoot}";
userConfPath = "${userAbsRoot}/wallpaper.conf";
# Exclude wallpaper.conf so HM does NOT manage it (avoids backup collisions)
repoWallpapersOnly = lib.cleanSourceWith {
src = repoWallpaperDir;
filter = path: type:
(builtins.baseNameOf path) != "wallpaper.conf";
};
in
{
home.packages = [ pkgs.wpaperd ];
# Sync everything *except* wallpaper.conf into ~/nixos_conf/wallpaperstuff
home.file."${userRelRoot}" = {
source = repoWallpapersOnly;
recursive = true;
};
# Now safely overwrite the config every activation (no HM collision)
home.activation.wallpaperConfForce =
lib.hm.dag.entryAfter [ "writeBoundary" ] ''
set -euo pipefail
mkdir -p "${userAbsRoot}"
install -m 0644 "${repoWallpaperConf}" "${userConfPath}"
'';
systemd.user.services.wpaperd = {
Unit = {
Description = "wpaperd wallpaper daemon";
After = [ "default.target" ];
};
Service = {
Type = "simple";
ExecStart = "${pkgs.wpaperd}/bin/wpaperd --config ${userConfPath}";
Restart = "on-failure";
RestartSec = 1;
};
Install.WantedBy = [ "default.target" ];
};
}
+59 -150
View File
@@ -1,189 +1,98 @@
{ config, pkgs, lib, flakeRoot, ... }: { config, lib, pkgs, flakeRoot, ... }:
let let
# Repo folder that gets copied to ~/nixos_conf/wallpaperstuff # Repo inputs
repoWallpaperDir = flakeRoot + "/assets/conf/desktop/wallpaper"; repoWallpaperDir = flakeRoot + "/assets/conf/desktop/wallpaper";
# Where we sync assets to (writable)
userRelRoot = "nixos_conf/wallpaperstuff"; userRelRoot = "nixos_conf/wallpaperstuff";
userAbsRoot = "${config.home.homeDirectory}/${userRelRoot}"; userAbsRoot = "${config.home.homeDirectory}/${userRelRoot}";
# Your actual layout:
# ~/nixos_conf/wallpaperstuff/pictures/wallpaper{1..9}.jpg
picturesDir = "${userAbsRoot}/pictures"; picturesDir = "${userAbsRoot}/pictures";
stateDir = "${userAbsRoot}/current";
symlinkPath = "${stateDir}/workspace.jpg";
scriptRel = "hypr/scripts/wpaperd-workspace-1to9.sh"; # Writable runtime TOML (NOT under ~/.config)
wpaperdConfRel = "wpaperd/config.toml"; runtimeConf = "${userAbsRoot}/wpaperd-runtime.toml";
# Your generator script (synced from repo into userAbsRoot)
wsScript = "${userAbsRoot}/wpaperd-workspace-1to9.sh";
# Sync everything in repoWallpaperDir to ~/nixos_conf/wallpaperstuff,
# but keep it simple: we exclude no files here unless you want to.
repoWallpapersOnly = lib.cleanSourceWith {
src = repoWallpaperDir;
filter = path: type: true;
};
in in
{ {
home.packages = [ home.packages = [
pkgs.wpaperd pkgs.wpaperd
pkgs.socat
pkgs.jq
]; ];
# Copy wallpapers from repo → ~/nixos_conf/wallpaperstuff (includes pictures/) # 1) Sync your wallpaper assets + scripts into a writable location
home.file."${userRelRoot}" = { home.file."${userRelRoot}" = {
source = repoWallpaperDir; source = repoWallpapersOnly;
recursive = true; recursive = true;
}; };
# Ensure wpaperd config points to the global symlink (not per-monitor, not rotating) # 2) Ensure we have a writable runtime config (created if missing)
xdg.configFile."${wpaperdConfRel}".text = '' #
[default] # NOTE: We intentionally do NOT create ~/.config/wpaperd/config.toml via HM,
mode = "stretch" # because HM places managed files in /nix/store and symlinks them (read-only),
# which breaks apps/scripts that want to write there.
home.activation.ensureWpaperdRuntimeConf =
lib.hm.dag.entryAfter [ "writeBoundary" ] ''
mkdir -p "${userAbsRoot}"
mkdir -p "${picturesDir}"
[any] if [ ! -f "${runtimeConf}" ]; then
path = "${symlinkPath}" cat > "${runtimeConf}" <<'EOF'
''; [default]
mode = "stretch"
# Script: global wallpaper per workspace (focused workspace), via symlink + reload-wallpaper # Fallback for outputs not explicitly listed:
xdg.configFile."${scriptRel}" = { [any]
executable = true; path = "__WALLPAPER_DIR__"
text = '' EOF
#!/usr/bin/env bash # default: point [any].path at your pictures dir
set -euo pipefail ${pkgs.gnused}/bin/sed -i "s|__WALLPAPER_DIR__|${picturesDir}|g" "${runtimeConf}"
fi
log() { echo "[wpaperd-ws] $*" >&2; }
PICTURES_DIR="${picturesDir}"
STATE_DIR="${stateDir}"
SYMLINK="${symlinkPath}"
XDG_CONFIG_HOME="''${XDG_CONFIG_HOME:-$HOME/.config}"
WPAPERD_DIR="$XDG_CONFIG_HOME/wpaperd"
CONF="$WPAPERD_DIR/config.toml"
: "''${XDG_RUNTIME_DIR:?XDG_RUNTIME_DIR not set}"
: "''${HYPRLAND_INSTANCE_SIGNATURE:?HYPRLAND_INSTANCE_SIGNATURE not set}"
SOCK="''${XDG_RUNTIME_DIR}/hypr/''${HYPRLAND_INSTANCE_SIGNATURE}/.socket2.sock"
mkdir -p "$STATE_DIR" "$WPAPERD_DIR"
# Wait for Hyprland socket so we don't exit too early
for i in $(seq 1 120); do
[[ -S "$SOCK" ]] && break
sleep 0.1
done
[[ -S "$SOCK" ]] || { log "Hyprland socket not found: $SOCK"; exit 1; }
ws_num() {
local w="''${1%%:*}"
[[ "$w" =~ ^[0-9]+$ ]] || return 1
printf '%s\n' "$w"
}
img_for_ws() {
local n="$1"
case "$n" in
1|2|3|4|5|6|7|8|9) printf '%s/wallpaper%s.jpg\n' "$PICTURES_DIR" "$n" ;;
*) return 1 ;;
esac
}
ensure_config() {
# keep config stable and always pointing to the symlink
cat >"$CONF" <<EOF
[default]
mode = "stretch"
[any]
path = "$SYMLINK"
EOF
}
reload_wallpaper() {
${pkgs.wpaperd}/bin/wpaperctl reload-wallpaper >/dev/null 2>&1 || true
}
apply_workspace() {
local ws_raw="$1"
local n img
n="$(ws_num "$ws_raw")" || { log "Ignoring non-numeric workspace: $ws_raw"; return 0; }
img="$(img_for_ws "$n")" || return 0
if [[ ! -f "$img" ]]; then
log "Missing image for ws=$n: $img"
return 0
fi
# If already set, skip
if [[ -L "$SYMLINK" ]] && [[ "$(readlink -f "$SYMLINK")" == "$(readlink -f "$img")" ]]; then
return 0
fi
ln -sf "$img" "$SYMLINK"
log "Workspace $n -> $img"
ensure_config
reload_wallpaper
}
apply_initial() {
local ws
ws="$(${pkgs.hyprland}/bin/hyprctl -j monitors | ${pkgs.jq}/bin/jq -r '.[] | select(.focused==true) | .activeWorkspace.name' | head -n1)"
if [[ -n "$ws" && "$ws" != "null" ]]; then
apply_workspace "$ws"
else
log "Could not determine initial focused workspace"
fi
}
handle_line() {
case "$1" in
workspace\>\>*)
apply_workspace "''${1#workspace>>}"
;;
workspacev2\>\>*)
local payload="''${1#workspacev2>>}"
apply_workspace "''${payload#*,}"
;;
focusedmon\>\>*)
local payload="''${1#focusedmon>>}"
local ws="''${payload#*,}"
apply_workspace "$ws"
;;
esac
}
ensure_config
apply_initial
log "Listening on $SOCK"
exec ${pkgs.socat}/bin/socat -U - "UNIX-CONNECT:$SOCK" \
| while IFS= read -r line; do
handle_line "$line" || true
done
''; '';
};
# wpaperd daemon # 3) wpaperd user service: always use the writable runtime config
systemd.user.services.wpaperd = { systemd.user.services.wpaperd = {
Unit = { Unit = {
Description = "wpaperd wallpaper daemon"; Description = "wpaperd wallpaper daemon (runtime config)";
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ]; PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
}; };
Service = { Service = {
ExecStart = "${pkgs.wpaperd}/bin/wpaperd"; ExecStart = "${pkgs.wpaperd}/bin/wpaperd --config ${runtimeConf}";
Restart = "on-failure"; Restart = "on-failure";
RestartSec = 1; RestartSec = 1;
}; };
Install.WantedBy = [ "graphical-session.target" ];
Install = {
WantedBy = [ "graphical-session.target" ];
};
}; };
# listener # 4) Optional: run your workspace generator once per login, then restart wpaperd
systemd.user.services.wpaperd-workspace-wallpaper = { systemd.user.services.wpaperd-workspaces-init = {
Unit = { Unit = {
Description = "Global wallpaper per workspace (1..9)"; Description = "Generate workspace wallpapers (wpaperd runtime config)";
After = [ "graphical-session.target" "wpaperd.service" ];
PartOf = [ "graphical-session.target" ]; PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
}; };
Service = { Service = {
ExecStart = "${pkgs.bash}/bin/bash ${config.xdg.configHome}/${scriptRel}"; Type = "oneshot";
Restart = "on-failure"; ExecStart = "${pkgs.bash}/bin/bash ${wsScript} ${picturesDir}";
RestartSec = 1; ExecStartPost = "${pkgs.systemd}/bin/systemctl --user restart wpaperd";
};
Install = {
WantedBy = [ "graphical-session.target" ];
}; };
Install.WantedBy = [ "graphical-session.target" ];
}; };
} }