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>
This commit is contained in:
parent
2a840ea085
commit
5381185121
@ -3,6 +3,11 @@
|
||||
# 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
|
||||
|
@ -117,7 +117,7 @@ show_screenrecord_menu() {
|
||||
|
||||
show_toggle_menu() {
|
||||
case $(menu "Toggle" " Screensaver\n Nightlight\n Idle Lock\n Top Bar") in
|
||||
*Screensaver*) omarchy-launch-screensaver ;;
|
||||
*Screensaver*) omarchy-toggle-screensaver ;;
|
||||
*Nightlight*) omarchy-toggle-nightlight ;;
|
||||
*Idle*) omarchy-toggle-idle ;;
|
||||
*Bar*) pkill -SIGUSR1 waybar ;;
|
||||
@ -327,8 +327,9 @@ show_update_config_menu() {
|
||||
}
|
||||
|
||||
show_system_menu() {
|
||||
case $(menu "System" " Lock\n Suspend\n Relaunch\n Restart\n Shutdown") in
|
||||
case $(menu "System" " Lock\n Screensaver\n Suspend\n Relaunch\n Restart\n Shutdown") in
|
||||
*Lock*) omarchy-lock-screen ;;
|
||||
*Screensaver*) omarchy-launch-screensaver force ;;
|
||||
*Suspend*) systemctl suspend ;;
|
||||
*Relaunch*) uwsm stop ;;
|
||||
*Restart*) systemctl reboot ;;
|
||||
|
12
bin/omarchy-toggle-screensaver
Executable file
12
bin/omarchy-toggle-screensaver
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
STATE_FILE=~/.local/state/omarchy/toggles/screensaver-off
|
||||
|
||||
if [[ -f $STATE_FILE ]]; then
|
||||
rm -f $STATE_FILE
|
||||
notify-send " Screensaver enabled"
|
||||
else
|
||||
mkdir -p "$(dirname $STATE_FILE)"
|
||||
touch $STATE_FILE
|
||||
notify-send " Screensaver disabled"
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user