feat(snapshots): desktop browse/restore + snapshot /home by default

Surface snapper snapshots from the desktop: `nomarchy-menu snapshot` (in the
SUPER+M picker, self-gated) launches btrfs-assistant, the polkit-aware
browse/diff/restore/rollback UI -- safer than a fat-fingerable rofi rollback
for a destructive root-only op. Shipped system-side gated on
nomarchy.system.snapper.

Also snapshot /home by default (hourly 5 / daily 7 / weekly 4) when it's its
own BTRFS subvolume -- the installer only set up snapper for /. A boot
oneshot creates the required /home/.snapshots subvolume if missing, so
already-installed machines get it too (no disko change).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Bernardo Magri
2026-06-15 17:14:05 +01:00
parent 5c83b52727
commit 0897391cfb
3 changed files with 60 additions and 7 deletions

View File

@@ -172,6 +172,14 @@ let
&& notify-send "Do Not Disturb off" "Notifications resumed."
exit 0 ;;
snapshot)
# btrfs-assistant: snapshot browse / diff / restore / rollback over
# snapper, elevating via polkit. Shipped system-side with
# nomarchy.system.snapper; self-gate so the entry no-ops elsewhere.
command -v btrfs-assistant >/dev/null 2>&1 \
|| { notify-send "Snapshots" "btrfs-assistant isn't installed (BTRFS snapshots off?)."; exit 0; }
exec btrfs-assistant ;;
"")
entries=(
"󰀻 Apps"
@@ -188,6 +196,8 @@ let
"󰭹 Ask Claude"
"󰂛 Do Not Disturb"
)
# Snapshots only when btrfs-assistant is installed (BTRFS + snapper).
command -v btrfs-assistant >/dev/null 2>&1 && entries+=("󰋚 Snapshots")
# Power-profile picker only when this is a laptop (battery present)
# running power-profiles-daemon matches the Waybar indicator's
# self-gating; desktops and the TLP backend don't show it.
@@ -211,12 +221,13 @@ let
*Keybindings*) exec "$0" keybinds ;;
*Ask*) exec "$0" ask ;;
*"Do Not Disturb"*) exec "$0" dnd ;;
*Snapshots*) exec "$0" snapshot ;;
*"Power profile"*) exec "$0" power-profile ;;
*Power*) exec "$0" power ;;
esac ;;
*)
echo "usage: nomarchy-menu [power|power-profile|theme|clipboard|calc|files|emoji|web|network|bluetooth|capture|keybinds|ask|dnd]" >&2
echo "usage: nomarchy-menu [power|power-profile|theme|clipboard|calc|files|emoji|web|network|bluetooth|capture|keybinds|ask|dnd|snapshot]" >&2
exit 64 ;;
esac
'';