omarchy/bin/omarchy-launch-screensaver
Manuel 5381185121
Feature/screensaver toggle instead of launch (#784)
* sceensaver-toggle and run if enabled using state file

* replace commands in menu and hyperidle

* migration file

* sed corrections

* added backup of changed files in migration

* review comments implemented

* hypridle config restore

* Use normal path style

* Use nerdfont icon for notification

* Make executable

* Allow a force start of screensaver so it can run even when disabled when manually triggered

* Add screensaver to system menu now that the toggle actually means toggle

* Known path without expansion spaces

* It should be an error return when it doesn't start

---------

Co-authored-by: Manuel <manuel.ramsaier@gmail.com>
Co-authored-by: David Heinemeier Hansson <david@hey.com>
2025-08-22 13:10:01 +02:00

22 lines
662 B
Bash
Executable File

#!/bin/bash
# Exit early if screensave is already running
pgrep -f "alacritty --class Screensaver" && exit 0
# Allow screensaver to be turned off but also force started
if [[ -f ~/.local/state/omarchy/toggles/screensaver-off ]] && [[ $1 != "force" ]]; then
exit 1
fi
focused=$(hyprctl monitors -j | jq -r '.[] | select(.focused == true).name')
for m in $(hyprctl monitors -j | jq -r '.[] | .name'); do
hyprctl dispatch focusmonitor $m
hyprctl dispatch exec -- \
alacritty --class Screensaver \
--config-file ~/.local/share/omarchy/default/alacritty/screensaver.toml \
-e omarchy-cmd-screensaver
done
hyprctl dispatch focusmonitor $focused