Closed alecandido closed 4 years ago
Could you post your entire xidlehook script? I'm having trouble understanding what your intentions are, sorry
xidlehook \
`# Don't lock when there's a fullscreen application` \
--not-when-fullscreen \
`# Don't lock when there's audio playing` \
--not-when-audio \
`# Dim the screen after 60 seconds, undim if user becomes active` \
--timer $TIME_DIM \
'xrandr --output "$PRIMARY_DISPLAY" --brightness .1' \
'xrandr --output "$PRIMARY_DISPLAY" --brightness 1' \
`# Undim & lock after 10 more seconds` \
--timer $TIME_LOCK \
'xrandr --output "$PRIMARY_DISPLAY" --brightness 1; eval $LOCKER;' \
'' \
--timer $TIME_DIM_LOCK \
'xrandr --output "$PRIMARY_DISPLAY" --brightness .1' \
'xrandr --output "$PRIMARY_DISPLAY" --brightness 1' \
`# Finally, suspend 20 minutes after it locks` \
--timer $TIME_SUSPEND \
'systemctl suspend' \
'' &
Right, I see. Yeah, unfortunately I'm not sure how I'd solve this. Is there a good way to detect if a thing is locked? Maybe some lockers could be supported by having it rely on the blocking of each lockscreen (like slock
doesn't return until you've unlocked it)...
I guess you could already use xidlehook-client
to disable the first few timers as your locker script, and re-enable them after your lock command has returned. Like
`# Undim & lock after 10 more seconds` \
--timer $TIME_LOCK \
'xrandr --output "$PRIMARY_DISPLAY" --brightness 1; ./my-locker.sh &' \
'' \
where my-locker.sh
is something like the following:
xidlehook-client control --timer 0 1 --action disable
eval $LOCKER # assuming the locker doesn't return until it's unlocked
xidlehook-client control --timer 0 1 --action enable
What do you think? Is this a good solution, or is this something which should potentially be built-in behavior in xidlehook?
First of all thank you very much for your support! Second: before considering which implementation is the best let's just be sure about the problem. My desired behavior is:
$TIME_DIM
seconds, but if I am active again it restores full luminosity$TIME_LOCK
seconds and restores full luminosity
(up to this step everything it's working great)$TIME_SUSPEND
seconds more from the last interaction it will suspendConsider that if I unlock I would like everything to be reset and start again from the beginning.
This is what I would like to obtain, and it's almost what I already have (thanks to your xidlehook
), but the problem it's when I try to revert the second dimming action, and it is trying to dim again.
Instead if I would do as you suggest everything probably will work as before (depending on locker capabilities) but disabling the timer it would not dim again nor suspend this time, and in order to do this I would need to launch a second instance of xidlehook
.
Instead if I would do as you suggest everything probably will work as before (depending on locker capabilities) but disabling the timer it would not dim again nor suspend this time, and in order to do this I would need to launch a second instance of xidlehook.
@AleCandido It should, the idea was to disable the 2 first timers (dim + lock) and only run dim + suspend until you unlock.
Ok sorry, now I've understood the role of --timer
option, my bad.
Still the main issue was the dependency on locker behaviour, and this prevents me to adopt the proposed solution (thanks the same for your effort!).
Oh, so there's nothing xidlehook could do regardless, I think? You might need to check the docs for whatever your $LOCKER
is set to, and try to hook it up to re-enable things after unlocking there
Ok, thank you very much. I will search a little bit more. I will close this issue, but we can still reopen if ever someone will find something interesting.
I'm sorry to fire an issue for a problem that maybe it is only due to me not understanding how
xidlehook
operates, if it's not a real issue you can classify as a documentation request.I'm using
xidlehook
to lock my screen (it's not the only use of course, but probably the main one as you know), and until now I was using really the same example written in the README.Now I would like to try dim the screen after locking, waiting another while, and I added a timer. But as for the first time I want the restore the brightness of the screen if an activity is detected, so I replicated the first timer in the example, namely:
The problem is that when he tries to restore brightness seems to step back at the beginning, retrying also to lock the screen, that is already locked.
How can I avoid this? Is it possible to put the
xidlehook
'position' after the second timer (the locking one) instead of restarting from the beginning?