From fa002c5cebdc6e5d3e020c02ab974958c9f37f5b Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Sun, 10 Sep 2023 03:26:19 -0700 Subject: [PATCH] Fix swayidle-lock-screen --- swayidle-lock-screen | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/swayidle-lock-screen b/swayidle-lock-screen index 8ed258a..2f3a3cc 100755 --- a/swayidle-lock-screen +++ b/swayidle-lock-screen @@ -1,8 +1,16 @@ #!/usr/bin/env zsh -swayidle -d -w -C /dev/null \ - timeout 15 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' & -local swayidle_pid="$!" -swaylock -kill "${swayidle_pid}" -hyprctl dispatch dpms on +function run { + swayidle -w -C /dev/null \ + timeout 15 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' & + local swayidle_pid="$!" + swaylock + kill "${swayidle_pid}" + hyprctl dispatch dpms on +} + +if [[ "${1}" == '-f' ]]; then + run & +else + run +fi