This commit is contained in:
2026-02-26 21:21:04 +01:00
parent e44a2310b2
commit b054309708
10 changed files with 0 additions and 26 deletions
-26
View File
@@ -1765,76 +1765,58 @@ in
** Workspace Wallpaper ** Workspace Wallpaper
#+begin_src nix :tangle home/desktop/workspace_wallpaper.nix :noweb tangle :mkdirp yes #+begin_src nix :tangle home/desktop/workspace_wallpaper.nix :noweb tangle :mkdirp yes
{ config, lib, pkgs, flakeRoot, ... }: { config, lib, pkgs, flakeRoot, ... }:
let let
repoWallpaperDir = flakeRoot + "/assets/conf/desktop/wallpaper"; repoWallpaperDir = flakeRoot + "/assets/conf/desktop/wallpaper";
userRelRoot = "nixos_conf/wallpaperstuff"; userRelRoot = "nixos_conf/wallpaperstuff";
userAbsRoot = "${config.home.homeDirectory}/${userRelRoot}"; userAbsRoot = "${config.home.homeDirectory}/${userRelRoot}";
picturesDir = "${userAbsRoot}/pictures"; picturesDir = "${userAbsRoot}/pictures";
repoWallpapersOnly = lib.cleanSourceWith { repoWallpapersOnly = lib.cleanSourceWith {
src = repoWallpaperDir; src = repoWallpaperDir;
filter = path: type: true; filter = path: type: true;
}; };
wsScriptRel = "hypr/scripts/hyprpaper-workspace-1to9.sh"; wsScriptRel = "hypr/scripts/hyprpaper-workspace-1to9.sh";
in in
{ {
home.packages = [ pkgs.hyprpaper pkgs.socat pkgs.jq ]; home.packages = [ pkgs.hyprpaper pkgs.socat pkgs.jq ];
home.file."${userRelRoot}" = { home.file."${userRelRoot}" = {
source = repoWallpapersOnly; source = repoWallpapersOnly;
recursive = true; recursive = true;
}; };
xdg.configFile."hypr/hyprpaper.conf".text = '' xdg.configFile."hypr/hyprpaper.conf".text = ''
ipc = true ipc = true
splash = false splash = false
''; '';
xdg.configFile."${wsScriptRel}" = { xdg.configFile."${wsScriptRel}" = {
executable = true; executable = true;
text = '' text = ''
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
: "''${XDG_RUNTIME_DIR:?XDG_RUNTIME_DIR not set}" : "''${XDG_RUNTIME_DIR:?XDG_RUNTIME_DIR not set}"
: "''${HYPRLAND_INSTANCE_SIGNATURE:?HYPRLAND_INSTANCE_SIGNATURE not set}" : "''${HYPRLAND_INSTANCE_SIGNATURE:?HYPRLAND_INSTANCE_SIGNATURE not set}"
SOCK="''${XDG_RUNTIME_DIR}/hypr/''${HYPRLAND_INSTANCE_SIGNATURE}/.socket2.sock" SOCK="''${XDG_RUNTIME_DIR}/hypr/''${HYPRLAND_INSTANCE_SIGNATURE}/.socket2.sock"
[[ -S "$SOCK" ]] || { echo "Hyprland socket not found: $SOCK" >&2; exit 1; } [[ -S "$SOCK" ]] || { echo "Hyprland socket not found: $SOCK" >&2; exit 1; }
# Allow overriding the pictures dir from argv; default to the Nix-provided one # Allow overriding the pictures dir from argv; default to the Nix-provided one
PICTURES_DIR="''${1:-${picturesDir}}" PICTURES_DIR="''${1:-${picturesDir}}"
FIT_MODE="fill" FIT_MODE="fill"
FOCUSED_MON="" FOCUSED_MON=""
pick_wall_for_ws() { pick_wall_for_ws() {
local ws="''${1}" local ws="''${1}"
local f local f
f="$(ls -1 "''${PICTURES_DIR}/''${ws}."* 2>/dev/null | head -n 1 || true)" f="$(ls -1 "''${PICTURES_DIR}/''${ws}."* 2>/dev/null | head -n 1 || true)"
echo "''${f}" echo "''${f}"
} }
apply_wallpaper() { apply_wallpaper() {
local mon="''${1}" local mon="''${1}"
local ws="''${2}" local ws="''${2}"
local file local file
file="$(pick_wall_for_ws "''${ws}")" file="$(pick_wall_for_ws "''${ws}")"
[[ -n "''${file}" ]] || return 0 [[ -n "''${file}" ]] || return 0
hyprctl hyprpaper wallpaper "''${mon}, ''${file}, ''${FIT_MODE}" >/dev/null hyprctl hyprpaper wallpaper "''${mon}, ''${file}, ''${FIT_MODE}" >/dev/null
} }
FOCUSED_MON="$(hyprctl -j monitors | jq -r '.[] | select(.focused==true) | .name' | head -n 1 || true)" FOCUSED_MON="$(hyprctl -j monitors | jq -r '.[] | select(.focused==true) | .name' | head -n 1 || true)"
CUR_WS="$(hyprctl -j activeworkspace | jq -r '.name' | head -n 1 || true)" CUR_WS="$(hyprctl -j activeworkspace | jq -r '.name' | head -n 1 || true)"
CUR_WS="''${CUR_WS%%:*}" CUR_WS="''${CUR_WS%%:*}"
[[ -n "''${FOCUSED_MON}" && -n "''${CUR_WS}" ]] && apply_wallpaper "''${FOCUSED_MON}" "''${CUR_WS}" [[ -n "''${FOCUSED_MON}" && -n "''${CUR_WS}" ]] && apply_wallpaper "''${FOCUSED_MON}" "''${CUR_WS}"
handle() { handle() {
case "''${1}" in case "''${1}" in
focusedmon* ) focusedmon* )
@@ -1849,13 +1831,11 @@ in
;; ;;
esac esac
} }
socat -U - UNIX-CONNECT:"''${SOCK}" | while read -r line; do socat -U - UNIX-CONNECT:"''${SOCK}" | while read -r line; do
handle "''${line}" || true handle "''${line}" || true
done done
''; '';
}; };
systemd.user.services.hyprpaper = { systemd.user.services.hyprpaper = {
Unit = { Unit = {
Description = "hyprpaper wallpaper daemon"; Description = "hyprpaper wallpaper daemon";
@@ -1869,7 +1849,6 @@ in
}; };
Install = { WantedBy = [ "graphical-session.target" ]; }; Install = { WantedBy = [ "graphical-session.target" ]; };
}; };
systemd.user.services.hyprpaper-workspace-wallpapers = { systemd.user.services.hyprpaper-workspace-wallpapers = {
Unit = { Unit = {
Description = "Hyprpaper workspace wallpapers (socket2 listener)"; Description = "Hyprpaper workspace wallpapers (socket2 listener)";
@@ -1886,8 +1865,6 @@ in
} }
#+end_src #+end_src
** Waybar ** Waybar
[[./.github/images/waybar.png]] [[./.github/images/waybar.png]]
@@ -1899,20 +1876,17 @@ let
in in
{ {
programs.waybar.enable = true; programs.waybar.enable = true;
# Ensure config matches repo (HM-managed symlink, not user-editable) # Ensure config matches repo (HM-managed symlink, not user-editable)
xdg.configFile."waybar/config" = { xdg.configFile."waybar/config" = {
source = repoWaybarDir + "/config.jsonc"; source = repoWaybarDir + "/config.jsonc";
force = true; force = true;
}; };
# Override HM's internally-generated waybar-style.css derivation # Override HM's internally-generated waybar-style.css derivation
# and use your repo file instead. # and use your repo file instead.
xdg.configFile."waybar/style.css" = { xdg.configFile."waybar/style.css" = {
source = lib.mkForce (repoWaybarDir + "/style.css"); source = lib.mkForce (repoWaybarDir + "/style.css");
force = true; force = true;
}; };
# Prevent HM from also trying to generate style content via programs.waybar.style # Prevent HM from also trying to generate style content via programs.waybar.style
# (not strictly required once mkForce is in place, but keeps intent clear) # (not strictly required once mkForce is in place, but keeps intent clear)
programs.waybar.style = ""; programs.waybar.style = "";

Before

Width:  |  Height:  |  Size: 292 KiB

After

Width:  |  Height:  |  Size: 292 KiB

Before

Width:  |  Height:  |  Size: 963 KiB

After

Width:  |  Height:  |  Size: 963 KiB

Before

Width:  |  Height:  |  Size: 1.8 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

Before

Width:  |  Height:  |  Size: 2.7 MiB

After

Width:  |  Height:  |  Size: 2.7 MiB

Before

Width:  |  Height:  |  Size: 270 KiB

After

Width:  |  Height:  |  Size: 270 KiB

Before

Width:  |  Height:  |  Size: 173 KiB

After

Width:  |  Height:  |  Size: 173 KiB

Before

Width:  |  Height:  |  Size: 962 KiB

After

Width:  |  Height:  |  Size: 962 KiB

Before

Width:  |  Height:  |  Size: 425 KiB

After

Width:  |  Height:  |  Size: 425 KiB

Before

Width:  |  Height:  |  Size: 5.3 MiB

After

Width:  |  Height:  |  Size: 5.3 MiB