Closed yusi1 closed 1 year ago
Closing since this is not really an issue.
There should be a way to control caffeine via the cli (especially for desktops with a tray).
I have checked if people have done this, but it was with separate bash scripts (not that I have a problem with using bash scripts) but if there was a more streamlined way of doing this it would be helpful.
I ended up writing a little toggle script since I couldn't find one online. For some reason, killall and pgrep couldn't find caffeine-ng in the running processes, but pidof worked so I used that. I use zsh but I'm pretty sure it's compatible with bash as well.
#!/usr/bin/env zsh
caffeinePID=$(pidof caffeine-ng) || caffeine -a
[[ -z "$caffeinePID" ]] || kill -15 $caffeinePID
If it can't find caffeine's PID, it starts it, and if it can, it kills it. I'm not sure if it's POSIX compliant and it could potentially be compressed into a one-liner.
Still, I have it bound to a keyboard shortcut in i3 and it works fine. Hopefully this saves someone else the time of figuring out a script until this feature is implemented.
I keep coming back to this problem and thinking of exposing some API, but I fear having yet-another-inhibition API:
I think I'm going to have caffeine expose the existing inhibition D-Bus API, and cli client to operate on that.
However, this needs to be well though-through in order to avoid shadowing any actual service already exposing that API.
This seems a little bit like what I wanted in #39 -- a way to just manually turn inhibition on and off, with absolutely no auto-detection or the like at all. This is, in fact, a dealbreaker to me, and I've been using an app called Wakefull in the meantime, in the hopes that eventually the pre-version-2.5 behavior of Caffeine would be re-implemented. It really seems like a "stupid mode" or "manual mode" ought to be an option, somehow.
Also there is currently no way to change caffeine settings without indicator panel.
This project has moved to codeberg.
Follow-up for this issue is at https://codeberg.org/WhyNotHugo/caffeine-ng/issues/71
My window manager supports launching commands with shortcuts such as ALT + F9 for example.
Is there any way to toggle Caffeine's inhibitor, I tried to bind
caffeine -a &
andcaffeine -d &
to separate shortcuts, but by running them commands, the output was that Caffeine was already running. Is there a way to toggle Caffeine from the command line, if there was a way to toggle it on and off it would also mean that I would only have to use one shortcut, instead of two.I have checked if people have done this, but it was with separate bash scripts (not that I have a problem with using bash scripts) but if there was a more streamlined way of doing this it would be helpful.
But I have to also say how useful this program is when I just want the computer to not sleep, thank you for making this program.