Skip to content

About

Shutdown, reboot, suspend or hibernate on a countdown you can always cancel — a bar plugin for Omarchy with a full-screen warning

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

Shutdown Timer for Omarchy

Shutdown Timer

English · Русский · 简体中文 · 日本語

Shut down, reboot, suspend or hibernate on a countdown you can always cancel.
The remaining time sits in the bar, a full-screen warning takes the last thirty seconds, and every surface — popup, overlay, notification, CLI — speaks the same language.

Release License Omarchy 4 Language

Install · Screenshots · Usage · Settings · How it works · Changelog


What is new in 3.0

The popup became an instrument instead of a form.

  • A dial you can operate three ways. Drag it and the value moves with your hand, not to where you pressed (one turn is an hour, Shift is the fine gear); scroll over it for one minute a notch, five with Shift; or type into two boxes that take minutes and seconds — no colon to hunt for.
  • The presets moved around the dial — 15 / 30 / 45 on the left, 60 / 90 / 120 on the right — so a common time is one click and the centre stays clean.
  • Seconds are real. 0 + 40 starts a forty-second timer; the daemon grew a set-secs command for it.
  • A metal knob, a two-tone arc, a minute scale — and the figure fits by construction, so 11:59:58 shrinks instead of crossing the ring.
  • The layout is tested, not eyeballed: tools/acceptance.sh checks the dial, the input and the hint share one axis, that the preset columns mirror each other, and that nothing overflows in any section.

The bar

the bar while a timer runs    the last five minutes

A timer you have to reopen a menu to read is a timer you forget. This one lives in the bar: the remaining time next to the power mark, a paused state that says so, and an urgent mark in the last minute — readable at a glance, without stealing focus.

  • Four actions: power off, reboot, suspend, hibernate.
  • Four ways to pick a time, all of them fast: the wheel (a notch is a minute, Shift five) works anywhere in the popup and on the bar icon without opening it; six presets sit around the dial; the ring drags relatively — one turn is an hour, Shift is the fine gear; and two boxes take minutes and seconds without a colon to type (0 + 40 is forty seconds).
  • Schedule: repeating timers per weekday (once / daily / weekdays / weekends), listed and removable from the popup.
  • Conditions: wait for inhibitors (a film, a backup) and a low-battery guard before the action fires; the popup says when it is holding.
  • History: the last runs with their outcome (executed / cancelled), so last night is not a mystery.
  • Keyboard-first: arrows walk the popup, Enter / Space activates, x removes the selected schedule, c / p / s / r cancel / pause / snooze / reset. The overlay takes Esc and Enter directly.
  • Languages: auto (system locale), en, ru — one setting, followed by the popup, the overlay, the notification and the CLI alike.
  • Contrast-checked: popup and overlay text auto-clears 4.5:1 against the theme surface, light and dark alike; reducedMotion disables the pulse and the easing.

The popup

The popup: the dial, the presets around it, the exact boxes    The live popup, light theme

Left: a design render of the v3 popup. Right: the live popup in the Flexoki Light theme. The live one takes every colour from the theme, so it looks different in yours — the layout is the same.

One page, top to bottom, no tabs: the action (shut down, reboot, suspend, hibernate), the dial with the six presets around it, the exact boxes for minutes and seconds, repeat (once, daily, weekdays, weekends) with a one-click add schedule, guards for battery, quiet and inhibitors, and the history of the last runs. Ambient fade and dry run sit in Advanced.

Hold the mark for half a second to cancel a running timer; inside the popup the arrows and Enter do the same work as the mouse.

Screenshots

The four states in motion (idle → active → warning → countdown → paused):

the bar states in motion

Bar states, cropped from real screenshots — dark (ristretto) on top, light (Flexoki Light) below. Every frame is the widget's own slot, cut from the bar by tools/screenshots.sh; nothing is drawn by hand:

statedarklight
idle
active
last 5 min
paused
countdown

The countdown — the last thirty seconds, on top of everything, in the theme's own accent:

The countdown overlay: 00:29, Cancel and +5 minutes

The same widget when the bar stands on the left:

The widget on a vertical bar

The overlay is the part that earns the plugin: a large monospace countdown, a progress line, Отмена / Cancel and +5 минут / +5 minutes, with Esc and Enter wired straight to them. It is a layer-shell surface, so it appears without moving your windows, and it follows the system theme.

The mark at real bar sizes — 16 / 20 / 24 / 32 px, dark on top, light below. If it reads at 16 px, it reads everywhere:

Install

omarchy plugin add https://github.com/valerkaaa/omarchy-shutdown-timer --enable

Or by hand, which is also how you would install a fork:

git clone https://github.com/valerkaaa/omarchy-shutdown-timer ~/.config/omarchy/plugins/honor.shutdown-timer
omarchy plugin enable honor.shutdown-timer

Then click the power mark in the bar. The plugin also works straight from ~/.config/omarchy/plugins/; omarchy plugin validate <dir> checks the manifest.

Update / remove

omarchy plugin update honor.shutdown-timer   # pull the latest release

# run this first when a timer is armed: cancels it, stops the daemon and
# verifies that the daemon is really gone
~/.config/omarchy/plugins/honor.shutdown-timer/control.sh uninstall

omarchy plugin disable honor.shutdown-timer  # keep the files, hide the widget
omarchy plugin remove honor.shutdown-timer   # uninstall (files + bar entry)

uninstall lives inside the plugin directory, so it has to run before the files are deleted. omarchy plugin remove deletes them without calling into the plugin — there is no removal hook — so the guarantee lives in the daemon: it checks its own directory on every pass and, once the plugin is gone, cancels the timer and exits instead of powering the machine off. An armed timer is noticed within a second, an idle daemon within a minute.

omarchy plugin disable does not leave a live timer behind: the daemon started by the widget notices that the plugin is no longer referenced in shell.json, cancels the timer and exits. A daemon started from a terminal (control.sh set …) is a headless timer — it has no widget whose disappearance could be observed, and keeps running.

omarchy plugin update replaces a running daemon with the build it just installed, so the checks above always belong to the code that is on disk; an armed timer survives the replacement.

Removal leaves the runtime state under ~/.local/state/omarchy/plugins/shutdown-timer/ on purpose, so a re-install finds its history. Delete it by hand for a full reset.

Dependencies

Nothing beyond a stock Omarchy: bash, jq-free parsing, and the system's systemctl (or omarchy system) for the power action. systemd-inhibit, upower, brightnessctl and wpctl are used opportunistically — the daemon runs without them. curl is needed only when you set webhookUrl. The overlay uses the shell's own qs.Ui components.

Usage

Click the mark to open the popup, pick an action and a time, launch.

  • Left click — the popup. Hold the mark — cancel a running timer.
  • In the popup: arrows move the cursor, Enter activates, Esc closes. Before the first arrow press, Enter launches the timer straight away.
  • In the overlay: Esc / Отмена cancels, Enter / +5 postpones.
cd ~/.config/omarchy/plugins/honor.shutdown-timer
./control.sh set 30 poweroff        # 30 minutes from now
./control.sh at 23:30               # at 23:30 (tomorrow if already past)
./control.sh status                 # add --json for machine-readable output
./control.sh pause && ./control.sh resume
./control.sh snooze 5
./control.sh cancel
./control.sh schedule add 23:30 daily poweroff
./control.sh schedule list
./control.sh schedule remove <id>
./control.sh history
./control.sh override echo   # dry run: firings are logged, the machine stays on
./control.sh override off    # back to real power actions
./control.sh override        # show the current mode
command does
set <min> <action> arm a timer, 1–1440 minutes
at <HH:MM> [action] arm it for a clock time
status [--json] state, action, time left
pause · resume stop and restart the countdown
snooze <min> add minutes to a running timer
cancel · reset drop the timer, or restart it at its original duration
schedule add|list|remove repeating timers
history the last runs and their outcome
override echo|off the dry-run switch

Settings

Key Default Meaning
language auto auto follows the system locale; en / ru force one.
refreshIntervalSec 1 Poll interval.
notifyEarlyMins 5 Early warning; 0 disables it.
overlaySeconds 30 Length of the full-screen countdown.
defaultAction poweroff Pre-selected action.
snoozeMins 5 Length of one "snooze" / "+N minutes".
presets 15,30,45,60,90,120 Quick-pick buttons in the popup.
quiet false Suppress notifications while a timer is armed.
batteryGuard false Do not run the action on low battery.
batteryThreshold 20 Low-battery threshold, percent.
waitForInhibitors false Wait until inhibitors clear before firing.
waitForProcesses `` Wait while a process whose name matches this list is running (comma-separated).
ambientFade false Dim the screen and lower the volume before the action.
fadeMinutes 3 How long before the deadline the ambient fade starts.
webhookUrl `` Optional http(s) URL; after the action fires, POST a small JSON body.
reducedMotion false Static icon, no progress-bar easing.

The dry run switch is not a setting but a file (<state>/action-override): while it holds a command, the daemon runs <command> <action> instead of the power command. Toggle it from the menu (Advanced → Dry run) or with control.sh override echo|off — the honest way to let a one-minute timer reach zero without powering the machine off.

omarchy bar set honor.shutdown-timer language ru
omarchy bar set honor.shutdown-timer overlaySeconds 60 --json

How it works

One plugin, two kinds (manifest.json: bar-widget and overlay):

Panel.qml      the bar mark and its popup
Overlay.qml    the full-screen countdown (PanelWindow + WlrLayershell, IPC target honor.shutdown-timer:overlay)
Service.qml    polls state.json, exposes set/cancel/pause/…, and tr()
Model.js       formatting and the string table (STRINGS, t(), resolveLang())
TimerIcon.qml  the power mark, drawn as a vector
daemon.sh      owns the timer, writes state.json, fires the notification, summons the overlay
control.sh     the CLI, and the fallback the overlay uses if the daemon is unreachable

State lives in ~/.local/state/omarchy/plugins/shutdown-timer/: state.json, daemon.log, daemon.pid, control, settings.json, schedules.tsv.

The daemon is a small bash process. control.sh ensure starts it after a crash; Service.qml restarts it if it is not there. A single flock guarantees one daemon — the pid file is only a hint, the lock is the truth. Stopping follows the same rule: daemon-stop signals the process that holds the lock, so a pid left behind by a killed daemon (and later reused by an unrelated program) is never mistaken for the daemon and never signalled.

Robustness

The daemon owns the countdown, so it is written to survive whatever lands on its doorstep:

  • The command channel is a file, not a socket: any process in the session can write into it. Every command is therefore validated by the daemon itself (not only by control.sh): minutes must be 1..1440, the action one of poweroff|reboot|suspend|hibernate|lock, HH:MM in range, the snooze count a positive number, and schedule ids [0-9A-Za-z]+ with weekdays 1..7. Anything else is logged and ignored — it used to be able to kill the daemon outright, and with it a pending shutdown.
  • state.json is written atomically (tmp + mv), so a reader never sees a half-written file and a kill -9 in the middle leaves the previous state intact. An overdue timer re-opens the countdown window on restart instead of firing silently.
  • settings.json, state.json and schedules.tsv are re-read on every tick, so a half-written or hand-edited file cannot take the timer down: numeric settings are validated and clamped to their documented range, every state field falls back to a safe default, and junk lines in the schedule file are skipped. Covered by tests/test_state_files.sh.
  • No network access by default and no eval / curl | bash: the plugin is the files it ships plus bash. If you set webhookUrl, the daemon makes one outbound POST with curl after the action fires (5 s cap, URL validated, body built from a fixed action name); with no URL nothing leaves the machine.

Debug IPC

omarchy-shell honor.shutdown-timer status          # state + action + time left
omarchy-shell honor.shutdown-timer debugLayout     # bar/popup/hero geometry numbers
omarchy-shell honor.shutdown-timer debugOverflow   # children spilling out of the popup
omarchy-shell honor.shutdown-timer:overlay cancel  # same path as the overlay button

debugOverflow returns {"count":0,"items":[]} in every state when the layout is clean; anything listed there is a real overflow, with the item path and side.

Tests

bash tests/run_all.sh              # every test, one verdict: SUITE: ALL GREEN
bash tools/acceptance.sh           # the acceptance list, for a human
python3 tools/contrast_report.py   # text against the theme surface, 4.5:1

The suite covers cancellation races, the absolute-time parser, the daemon's validation, schedules, state files, sleep and resume, and a performance budget. Most of it runs without a live shell, so it works over SSH.

Safety

  • A new timer always overwrites the previous one — no confirmation dialog.
  • Every path that executes a power action goes through two checks: the daemon writes the consumed IDLE state to disk first, and a final gate re-reads the control channel and state.json immediately before dispatch. A cancel, a pause or a re-armed timer that arrives before that read wins; after the consumed state is committed the one-shot is spent, by design.
  • To test without powering off: wait for COUNTDOWN, then cancel and check state.json is back at IDLE — or flip the dry-run switch (Advanced → Dry run) and let the timer actually reach zero.
  • A deadline that passes while the machine is suspended opens the countdown window on wake instead of firing into a black screen.
  • A one-shot fires at most once, and only after the consumed state is on disk: IDLE is written first, and if that write fails the action does not run (the daemon retries) — so a shutdown or reboot in the middle cannot leave an expired timer for the next boot, and a full disk cannot power the machine off twice.
  • Cancel, pause and snooze are requests that must reach the disk: the overlay closes and the fade returns only after the new state is committed, and while a request is pending the daemon refuses to fire and retries it every tick. The request itself is stored in pending.transition, so it survives a daemon restart; a later command replaces it instead of clearing the hold. A full disk cannot silently turn a cancel into a shutdown.
  • A schedule arms only after its last-fired stamp is saved. If the stamp cannot be written the occurrence is skipped and retried later; it is never re-armed after its first countdown.

Files

honor.shutdown-timer/
├── manifest.json    declaration: two kinds, the settings schema (incl. language)
├── Panel.qml        the bar mark and the popup
├── Overlay.qml      the full-screen countdown
├── Service.qml      polls state.json, exposes set/cancel/pause/…, tr()
├── Model.js         formatting and i18n (STRINGS, t(), resolveLang())
├── TimerIcon.qml    the power mark (canonical MDI geometry, bevel copies)
├── daemon.sh        the timer daemon
├── control.sh       the CLI
├── assets/          plugin-store icons, SVG twins of the mark, screenshots
├── tests/           the suite behind tests/run_all.sh
└── tools/           dev scripts: screenshots, geometry checks, contrast report

License

MIT — see LICENSE. Not affiliated with Omarchy; a plugin for it.

About

Shutdown, reboot, suspend or hibernate on a countdown you can always cancel — a bar plugin for Omarchy with a full-screen warning

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages