This commit is contained in:
Thomas Forgione 2025-07-09 14:20:11 +02:00
parent a0ade97e52
commit c901996ca0
3 changed files with 25 additions and 20 deletions

View File

@ -2,18 +2,18 @@
# for more configuration options, refer https://wiki.hyprland.org/Hypr-Ecosystem/hypridle # for more configuration options, refer https://wiki.hyprland.org/Hypr-Ecosystem/hypridle
general { general {
lock_cmd = pidof hyprlock || hyprlock # avoid starting multiple hyprlock instances. lock_cmd = ~/.config/dotfiles/hypr/hyprscript start-hyprlock
before_sleep_cmd = loginctl lock-session # lock before suspend. before_sleep_cmd = ~/.config/dotfiles/hypr/hyprscript lock-session
after_sleep_cmd = hyprctl dispatch dpms on # to avoid having to press a key twice to turn on the display. after_sleep_cmd = hyprctl dispatch dpms on
} }
listener { listener {
timeout = 300 # 5min. timeout = 300
on-timeout = loginctl lock-session # lock screen when timeout has passed. on-timeout = ~/.config/dotfiles/hypr/hyprscript lock-session
} }
listener { listener {
timeout = 330 # 5.5min. timeout = 350
on-timeout = hyprctl dispatch dpms off # screen off when timeout has passed. on-timeout = hyprctl dispatch dpms off
on-resume = hyprctl dispatch dpms on # screen on when activity is detected after timeout has fired. on-resume = hyprctl dispatch dpms on
} }

View File

@ -93,15 +93,3 @@ label {
halign = right halign = right
valign = top valign = top
} }
label {
monitor =
text = $LAYOUT[en,ru]
font_size = 24
onclick = hyprctl switchxkblayout all next
position = 250, -20
halign = center
valign = center
}

View File

@ -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(): def main():
if len(sys.argv) < 2: if len(sys.argv) < 2:
return return
@ -277,6 +288,12 @@ def main():
elif sys.argv[1] == 'stat': elif sys.argv[1] == 'stat':
monitor_stats() monitor_stats()
elif sys.argv[1] == 'start-hyprlock':
start_hyprlock()
elif sys.argv[1] == 'lock-session':
lock_session()
else: else:
print(f'Command not found: {sys.argv[1]}', file=sys.stderr) print(f'Command not found: {sys.argv[1]}', file=sys.stderr)
sys.exit(1) sys.exit(1)