hypridle icon indicating copy to clipboard operation
hypridle copied to clipboard

[BUG] unlock_cmd is not triggered.

Open lvlick opened this issue 1 year ago • 5 comments
trafficstars

I'm using arch, hypridle and hyprlock. To lock the screen I use loginctl lock-session.

Currently the unlock_cmd is not being executed. My config looks like this:

general {
    lock_cmd = pidof hyprlock || /home/miep/lock.sh
    unlock_cmd = /home/miep/unlock.sh
    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.
}

listener {
    timeout = 10                                # 2.5min.
    on-timeout = brightnessctl -s set 10         # set monitor backlight to minimum, avoid 0 on OLED monitor.
    on-resume = brightnessctl -r                 # monitor backlight restore.
}

# turn off keyboard backlight, comment out this section if you dont have a keyboard backlight.
listener { 
    timeout = 10                                          # 2.5min.
    on-timeout = brightnessctl -sd rgb:kbd_backlight set 0 # turn off keyboard backlight.
    on-resume = brightnessctl -rd rgb:kbd_backlight        # turn on keyboard backlight.
}

listener {
    timeout = 20                                # 5min
    on-timeout = loginctl lock-session            # lock screen when timeout has passed
}

listener {
    timeout = 25                                 # 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.
}

listener {
    timeout = 1800                                # 30min
    on-timeout = systemctl suspend                # suspend pc
}

lvlick avatar Jul 19 '24 20:07 lvlick

I've been having the same issue. Sounds like a duplicate of #24.

bobby-the-epic avatar Jul 19 '24 21:07 bobby-the-epic

Not sure if it's the same issue, as nothing crashes for me, it just doesn't get triggered. Neither hypridle, hyprland, nor hyprlock crash, at least according to console output.

lvlick avatar Jul 19 '24 21:07 lvlick

Same here not even this works :/

general {
    lock_cmd = $lock_cmd
    before_sleep_cmd = loginctl lock-session
    unlock_cmd = notify-send "unlock!"
}

nonetrix avatar Sep 02 '24 07:09 nonetrix

general {
    lock_cmd = wpctl set-mute @DEFAULT_AUDIO_SINK@ 1 && pidof hyprlock || hyprlock && loginctl unlock-session
    unlock_cmd = wpctl set-mute @DEFAULT_AUDIO_SINK@ 0 
    before_sleep_cmd = loginctl lock-session
}

This works as a workaround(specifically the && loginctl unlock-session, but not sure why it's necessary.

gdiShun avatar Oct 13 '24 16:10 gdiShun

Same problem!

~/.config/hypr/hypridle.conf

general {
    lock_cmd = ~/.config/hypr/scripts/lock.sh
    unlock_cmd = hyprctl dispatch submap reset  # 😭 NOT WORKING !!!
    before_sleep_cmd = loginctl lock-session    # lock before suspend
    after_sleep_cmd = hyprctl dispatch dpms on
}

listener {
    timeout = 480                               # 8 min
    on-timeout = loginctl lock-session          # lock
}

listener {
    timeout = 600                               # 10 min
    on-timeout = hyprctl dispatch dpms off      # screen off
    on-resume = hyprctl dispatch dpms on
}

listener {
    timeout = 900                               # 15 mins
    on-timeout = systemctl suspend              # suspend
}

~/.config/hypr/scripts/lock.sh

#!/bin/zsh

hyprctl dispatch submap lockscreen # engage lockscreen keybinds

pidof hyprlock || hyprlock # engage hyprlock

hyprctl dispatch submap reset # reset the submap when hyprlock exits # 👈🏼 WORKAROUND!

~/.config/hypr/hyprlock.conf

source = colors.conf

general {
    ignore_empty_input = true
}

background {
    path = /home/hrigved/.cache/wallpaper-blur-dim
}
# TIME
label {
    monitor = 
    text = cmd[update:1000] echo "$(date +"%R")"
    color = $foreground
    font_size = 100
    font_family = JetBrainsMono Nerd Font ExtraBold
    position = 0, 400
    halign = center
    valign = center
}

# DATE
label {
    monitor =
    text = cmd[update:1000] echo "$(date +"%a, %d %b")"
    color = $foreground
    font_size = 22
    font_family = JetBrainsMono Nerd Font Bold
    position = 0, 300
    halign = center
    valign = center
}

# UPTIME
label {
    monitor =
    text = cmd[update:1000] echo "$(uptime -p | sed "s/u/U/")"
    color = $foreground
    font_size = 14
    font_family = JetBrainsMono Nerd Font
    position = 0, -500
    halign = center
    valign = center
}

# KEYBINDS LEGEND
label {
    monitor = 
    text = Shutdown  -> Win + S<br/>Reboot    -> Win + R<br/>Suspend   -> Win + U<br/>Exit      -> Win + X<br/>Hibernate -> Win + H
    color = $foreground
    font_size = 11
    font_family = JetBrainsMono Nerd Font Medium
    position = 50, 30
    halign = left
    valign = bottom
}

input-field {
    size = 200, 50
    outline_thickness = 2
    dots_size = 0.25
    dots_spacing = 0.15
    dots_center = true
    dots_rounding = -1 # -1 default circle, -2 follow input-field rounding
    outer_color = $foreground
    inner_color = $background
    font_color = $foreground
    fade_on_empty = true
    fade_timeout = 1500 # Milliseconds before fade_on_empty is triggered.
    placeholder_text = <i>Enter Password...</i> # Text rendered in the input box when it's empty.
    hide_input = false
    rounding = 15
    check_color = $color2
    fail_color = rgb(204, 34, 34) # if authentication failed, changes outer_color and fail message color
    fail_text = <i>$FAIL <b>($ATTEMPTS)</b></i> # can be set to empty
    fail_timeout = 2000 # milliseconds before fail_text and fail_color disappears
    fail_transition = 200 # transition time in ms between normal outer_color and fail_color
}

iamhrigved avatar Nov 16 '24 16:11 iamhrigved

I think the option you are looking for is on_unlock_cmd

ChrisHixon avatar May 28 '25 08:05 ChrisHixon