Files
Nomarchy/bin/nomarchy-toggle-idle
Bernardo Magri 29cc0d2547 feat: implement modular foundation and core system services
- Update flake.nix with 25.11 release and core inputs
- Add dedicated modules for audio (Pipewire), bluetooth, and networking
- Update GEMINI.md with the new Modular Merging Architecture blueprint
- Configure graphical installer ISO and test VM outputs
2026-04-03 21:06:42 +01:00

29 lines
797 B
Bash
Executable File

#!/usr/bin/env bash
# Toggles the idle daemon (hypridle) between enabled and disabled.
# Declarative + Hybrid (instant IPC/kill) for Nomarchy NixOS.
STATE_FILE="$HOME/.config/home-manager/idle-state.json"
mkdir -p "$(dirname "$STATE_FILE")"
if [ ! -f "$STATE_FILE" ]; then
echo '{"enabled": true}' > "$STATE_FILE"
fi
enabled=$(jq -r '.enabled' "$STATE_FILE")
if [[ $enabled == "true" ]]; then
NEW_ENABLED="false"
pkill -x hypridle
notify-send -u low "󱫖 Stop locking computer when idle"
else
NEW_ENABLED="true"
setsid hypridle >/dev/null 2>&1 &
notify-send -u low "󱫖 Now locking computer when idle"
fi
echo "{\"enabled\": $NEW_ENABLED}" > "$STATE_FILE"
echo "Idle daemon set to $NEW_ENABLED declaratively."
pkill -RTMIN+9 waybar # Signal waybar if needed