28 lines
820 B
Bash
Executable File
28 lines
820 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
# Toggles the waybar top bar. Writes the new state to state.json (so the
|
|
# next home-manager rebuild realigns programs.waybar.enable via
|
|
# features/desktop/waybar/default.nix) and flips the running systemd
|
|
# user unit for instant feedback.
|
|
|
|
STATE_DIR="$HOME/.config/nomarchy"
|
|
STATE_FILE="$STATE_DIR/state.json"
|
|
mkdir -p "$STATE_DIR"
|
|
|
|
[[ ! -f $STATE_FILE ]] && echo "{}" > "$STATE_FILE"
|
|
|
|
if [[ $NOMARCHY_TOGGLE_WAYBAR == "false" ]]; then
|
|
NEW_VALUE="true"
|
|
systemctl --user start waybar.service 2>/dev/null || true
|
|
notify-send -u low " Top bar enabled"
|
|
else
|
|
NEW_VALUE="false"
|
|
systemctl --user stop waybar.service 2>/dev/null || true
|
|
notify-send -u low " Top bar disabled"
|
|
fi
|
|
|
|
nomarchy-state-write waybar "$NEW_VALUE" --type bool
|
|
|
|
echo "Waybar state set to $NEW_VALUE."
|