Files
omarchy/bin/omarchy-system-shutdown
T
ZacharyZhang-NY a9b39710a2 Add Simplified Chinese as a system language
The installer asks for the language before the keyboard, and
Setup > Language (omarchy language en|zh) switches it later. Under
zh_CN the menu reads its labels from omarchy-menu.zh-cn.jsonc, the
shell from I18nZh.js through I18n.tr, and notifications are worded
by their sender through omarchy-text, which reads the same table.
User text is never translated.
2026-10-12 02:56:40 -04:00

33 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# omarchy:summary=Shut down after closing application windows
# omarchy:examples=omarchy shutdown | omarchy system shutdown
# omarchy:aliases=omarchy shutdown
if [[ ${1:-} == "--inhibited" ]]; then
# Close windows in the background so they cannot delay power-off.
(
omarchy-osd -i shutdown -m "$(omarchy-text "Shutting down")" -d 5000
omarchy-state clear re*-required
omarchy-hyprland-window-close-all
) &
sleep 2 # Allow apps like Chrome to shut down correctly
systemctl poweroff --no-wall
elif [[ ${1:-} == "--inhibit" ]]; then
# Report failures from inside the service, independently of the launching terminal.
# Block lid handling explicitly: it ignores high-level sleep inhibitors.
systemd-inhibit --what=sleep:idle:handle-lid-switch \
--who=Omarchy --why="Shutdown in progress" --mode=block \
"$0" --inhibited || {
status=$?
omarchy-notification-send -u critical "$(omarchy-text "Shutdown failed")" "$(omarchy-text "Could not complete shutdown. Please try again.")"
exit "$status"
}
else
# Schedule the shutdown in the user manager so closing the terminal's systemd
# scope cannot terminate it before it runs.
systemd-run --user --collect --quiet --property=Type=exec --property=RuntimeMaxSec=30s \
"$OMARCHY_PATH/bin/omarchy-system-shutdown" --inhibit
fi