diff --git a/hypr/hypridle.conf b/hypr/hypridle.conf index 5a35b93..f78e0d8 100644 --- a/hypr/hypridle.conf +++ b/hypr/hypridle.conf @@ -2,18 +2,18 @@ # for more configuration options, refer https://wiki.hyprland.org/Hypr-Ecosystem/hypridle general { - lock_cmd = pidof hyprlock || hyprlock # avoid starting multiple hyprlock instances. - before_sleep_cmd = loginctl lock-session # lock before suspend. - after_sleep_cmd = hyprctl dispatch dpms on # to avoid having to press a key twice to turn on the display. + lock_cmd = ~/.config/dotfiles/hypr/hyprscript start-hyprlock + before_sleep_cmd = ~/.config/dotfiles/hypr/hyprscript lock-session + after_sleep_cmd = hyprctl dispatch dpms on } listener { - timeout = 300 # 5min. - on-timeout = loginctl lock-session # lock screen when timeout has passed. + timeout = 300 + on-timeout = ~/.config/dotfiles/hypr/hyprscript lock-session } listener { - timeout = 330 # 5.5min. - on-timeout = hyprctl dispatch dpms off # screen off when timeout has passed. - on-resume = hyprctl dispatch dpms on # screen on when activity is detected after timeout has fired. + timeout = 350 + on-timeout = hyprctl dispatch dpms off + on-resume = hyprctl dispatch dpms on } diff --git a/hypr/hyprlock.conf b/hypr/hyprlock.conf index eed85da..fb488e9 100644 --- a/hypr/hyprlock.conf +++ b/hypr/hyprlock.conf @@ -93,15 +93,3 @@ label { halign = right valign = top } - -label { - monitor = - text = $LAYOUT[en,ru] - font_size = 24 - onclick = hyprctl switchxkblayout all next - - position = 250, -20 - halign = center - valign = center -} - diff --git a/hypr/hyprscript b/hypr/hyprscript index 054e98a..35213a6 100755 --- a/hypr/hyprscript +++ b/hypr/hyprscript @@ -239,6 +239,17 @@ def monitor_stats(): ) +def start_hyprlock(): + proc = subprocess.run(['pidof', 'hyprloc']) + if proc.returncode != 0: + subprocess.run(['hyprlock']) + + +def lock_session(): + if os.environ.get('HYPR_DISABLE_LOCK', None) is None: + subprocess.run(['loginctl', 'lock-session']) + + def main(): if len(sys.argv) < 2: return @@ -277,6 +288,12 @@ def main(): elif sys.argv[1] == 'stat': monitor_stats() + elif sys.argv[1] == 'start-hyprlock': + start_hyprlock() + + elif sys.argv[1] == 'lock-session': + lock_session() + else: print(f'Command not found: {sys.argv[1]}', file=sys.stderr) sys.exit(1)