Some checks failed
Check / eval (push) Has been cancelled
The machine flake's git-tracked settings file is system state, not "theme" only — rename it to state.json. CLI becomes nomarchy-state-sync with a nomarchy-theme-sync symlink for scripts and muscle memory. Eval (mkFlake, doctor, lifecycle) still accepts theme-state.json; the next write migrates to state.json and removes the legacy file. Documented in MIGRATION.md; drop the CLI alias after release notes.
45 lines
1.8 KiB
Nix
45 lines
1.8 KiB
Nix
# Auto-timezone, home side: keep the Waybar clock in step with the system
|
|
# timezone. Waybar's clock module captures the zone once at construction, so a
|
|
# runtime timezone change (automatic-timezoned, nomarchy.system.autoTimezone)
|
|
# would NOT show until a relogin. A tiny watcher subscribes to timedate1's
|
|
# change signal and reloads Waybar (SIGUSR2 = the same reload state-sync uses),
|
|
# so the clock follows your location live. Also catches a manual
|
|
# `timedatectl set-timezone`.
|
|
#
|
|
# Gated on the same in-flake flag the system side reads (settings.autoTimezone,
|
|
# exposed via nomarchy.settings) — so it only runs when the feature is on. The
|
|
# menu toggle (nomarchy-autotimezone) rebuilds both sides off that one flag.
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
cfg = config.nomarchy;
|
|
enabled = cfg.waybar.enable && (cfg.settings.autoTimezone or false);
|
|
|
|
tzWatch = pkgs.writeShellScript "nomarchy-tz-watch" ''
|
|
last=$(${pkgs.systemd}/bin/timedatectl show -p Timezone --value 2>/dev/null || true)
|
|
${pkgs.dbus}/bin/dbus-monitor --system \
|
|
"type='signal',interface='org.freedesktop.DBus.Properties',path='/org/freedesktop/timedate1',member='PropertiesChanged'" \
|
|
2>/dev/null |
|
|
while read -r _; do
|
|
cur=$(${pkgs.systemd}/bin/timedatectl show -p Timezone --value 2>/dev/null || true)
|
|
[ "$cur" = "$last" ] && continue
|
|
last=$cur
|
|
${pkgs.procps}/bin/pkill -SIGUSR2 -x waybar 2>/dev/null || true
|
|
done
|
|
'';
|
|
in
|
|
{
|
|
systemd.user.services.nomarchy-tz-watch = lib.mkIf enabled {
|
|
Unit = {
|
|
Description = "Reload Waybar on timezone change (auto-timezone)";
|
|
PartOf = [ "graphical-session.target" ];
|
|
After = [ "graphical-session.target" ];
|
|
};
|
|
Service = {
|
|
ExecStart = "${tzWatch}";
|
|
Restart = "on-failure";
|
|
};
|
|
Install.WantedBy = [ "graphical-session.target" ];
|
|
};
|
|
}
|