From e140badbb2635f097a3ed8908b51b5869567973a Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 21 Feb 2026 15:16:15 +0100 Subject: [PATCH] Make suspend opt-out rather than opt-in --- bin/omarchy-menu | 8 ++++---- bin/omarchy-toggle-suspend | 9 ++++----- migrations/1771683296.sh | 13 +++++++++++++ 3 files changed, 21 insertions(+), 9 deletions(-) create mode 100644 migrations/1771683296.sh diff --git a/bin/omarchy-menu b/bin/omarchy-menu index 69d042d5..912ab554 100755 --- a/bin/omarchy-menu +++ b/bin/omarchy-menu @@ -264,10 +264,10 @@ show_setup_config_menu() { show_setup_system_menu() { local options="" - if [[ -f ~/.local/state/omarchy/toggles/suspend-on ]]; then - options="$options󰒲 Disable Suspend" - else + if [[ -f ~/.local/state/omarchy/toggles/suspend-off ]]; then options="$options󰒲 Enable Suspend" + else + options="$options󰒲 Disable Suspend" fi if omarchy-hibernation-available; then @@ -567,7 +567,7 @@ show_about() { show_system_menu() { local options="󱄄 Screensaver\n Lock\n󰍃 Logout" - [[ -f ~/.local/state/omarchy/toggles/suspend-on ]] && options="$options\n󰒲 Suspend" + [[ ! -f ~/.local/state/omarchy/toggles/suspend-off ]] && options="$options\n󰒲 Suspend" omarchy-hibernation-available && options="$options\n󰤁 Hibernate" options="$options\n󰜉 Restart\n󰐥 Shutdown" diff --git a/bin/omarchy-toggle-suspend b/bin/omarchy-toggle-suspend index a2464528..3c5b0491 100755 --- a/bin/omarchy-toggle-suspend +++ b/bin/omarchy-toggle-suspend @@ -1,13 +1,12 @@ #!/bin/bash -STATE_FILE=~/.local/state/omarchy/toggles/suspend-on +STATE_FILE=~/.local/state/omarchy/toggles/suspend-off -if [[ ! -f $STATE_FILE ]]; then - mkdir -p "$(dirname $STATE_FILE)" - touch $STATE_FILE +if [[ -f $STATE_FILE ]]; then + rm -f $STATE_FILE notify-send "󰒲 Suspend now available in system menu" else mkdir -p "$(dirname $STATE_FILE)" - rm -f $STATE_FILE + touch $STATE_FILE notify-send "󰒲 Suspend removed from system menu" fi diff --git a/migrations/1771683296.sh b/migrations/1771683296.sh new file mode 100644 index 00000000..5a7b9543 --- /dev/null +++ b/migrations/1771683296.sh @@ -0,0 +1,13 @@ +echo "Migrate suspend toggle from opt-in to opt-out" + +SUSPEND_ON=~/.local/state/omarchy/toggles/suspend-on +SUSPEND_OFF=~/.local/state/omarchy/toggles/suspend-off + +if [[ -f $SUSPEND_ON ]]; then + # User had suspend enabled, remove old file (suspend is now on by default) + rm -f $SUSPEND_ON +else + # User had suspend disabled, create opt-out file to preserve their choice + mkdir -p "$(dirname $SUSPEND_OFF)" + touch $SUSPEND_OFF +fi