Caffeinate: Keep computer awake (Block sreensaver, lockscreen when presenting or long running tasks)
What do you need?
When I have a presentation, or if I want to run a long running backup without the system to sleep, lock or turn on screen saver, on MacOS I had an app Lungo, but there are many others like Caffeinate, etc.
Also when I run a Google Meet meeting, after a couple of time, my screen will freeze, get black for 4-6 seconds, and then go back (for the participans on the other end, my video freezes quickly. Audio works always). It feels like the screen saver interupts (as I might not have moved anything) - but I not 100%. So I'd like to have an awakening SW to try this.
I was wondering, what is the best way to do this in Omarchy?
Here some options I found when I researched, but not sure what's the best way we should use? I'm sure many are doing already something like this manually?
Options
pkill hypridle # disable
hypridle & # re-enable
or systemd-inhibit as said on reddit?
systemd-inhibit --what=idle --who=Caffeine --why=Caffeine --mode=block sleep inf
Or caffeine-ng (GUI app, most Mac-like)
yay -S caffeine-ng
My first attempt
I tried something with small shell script https://github.com/sspaeti/dotfiles/commit/c0ee87d689c5109dd03f8c293eb47e52de303a9b - not sure if that is correct, but I will revert how it's going over the next weeks. But just a showcase how I'd like to use it. But I'm sure you know better ways?
❯ caffeinate status
Caffeinate is not active
❯ caffeinate 30
Caffeinate enabled for 30 minutes
❯ caffeinate status
Caffeinate is currently active:
sspaeti 104802 0.0 0.0 16032 6652 pts/40 S 09:18 0:00 systemd-inhibit --what=sleep:idle:handle-lid-switch sleep 1800
❯ caffeinate status
❯ caffeinate off
Caffeinate disabled
❯ caffeinate status
Caffeinate is not active
Hi! There is already a script and keybind that does this :D https://github.com/basecamp/omarchy/blob/master/bin/omarchy-toggle-idle
It's also already bound to the keybinding:
default/hypr/bindings/utilities.conf:
23:bindd = SUPER CTRL, I, Toggle locking on idle, exec, omarchy-toggle-idle
Hi! There is already a script and keybind that does this :D
master/bin/omarchy-toggle-idleIt's also already bound to the keybinding:
default/hypr/bindings/utilities.conf: 23:bindd = SUPER CTRL, I, Toggle locking on idle, exec, omarchy-toggle-idle
This is amazing, I didn't even notice. Thanks for mentioning it. Does this avoid the screensaver as well? And everything e.g. when a long-running task is in the background or during a meeting? Did you test that?
If this works, this can be closed, except if we want to add the option to disable for X minutes, which is what I usually use.
Yes, this script kills hypridle. It's hypridle that invokes omarchy-launch-screensaver, lock-screen and screen offs.
I also personally changed the timings in $HOME/.config/hypr/hypridle.conf because for me, 2.5 minutes before screensaver is too fast on pc.
Oh, this is great. Then I will close this issue, and anybody who wants the 30 minutes to turn off or similar can check above script at https://github.com/sspaeti/dotfiles/blob/8521da38db20b5ff1ffa66703b63a353cbb81c79/zsh/.dotfiles/helpers/bin/caffeinate#L9.
Would be great to have this script by default in Omarchy and perhaps even in the menus!
Would be great to have this script by default in Omarchy and perhaps even in the menus!
Yeah, I thought the above one was enough, but I noticed I always have the need to unlock for a period of time, never forever, as I'm afraid of forgetting to turn it off.
I am reopening this, and letting people chime in on whether I should add a PR for it. Also, if people have better suggestions than then my claude-code version of it: https://github.com/sspaeti/dotfiles/blob/8521da38db20b5ff1ffa66703b63a353cbb81c79/zsh/.dotfiles/helpers/bin/caffeinate#L9
It would be nice to be able to put this into the waybar
I believe this is currently in the menu under Trigger > Toggle > Idle Lock.
I believe this is currently in the menu under
Trigger>Toggle>Idle Lock.[...] except if we want to add the option to disable for
X minutes, which is what I usually use.
Yes, simply toggle it, but only the X minutes is not, which is how I use it. I don't idle unlimited, I always know, OK, I need two hours now for this task, and then I idle for 2 hours. So that would be the only addition, but yeah, easy to just add using the linked script.