5 Commits (master)

Author SHA1 Message Date
Damien Goutte-Gattat 25ce49ce6d
Spawn a shell if no command is specified.
Instead of requiring the user to always specifying a command to launch,
default to spawning a shell (/bin/sh) if no command has been specified.
7 months ago
Damien Goutte-Gattat 01362fa150
Add `-p` and `-r` options.
Add two options to allow specifying the name of the program requesting
the inhibition and the reason for the request.

Move the command line parsing code to a dedicated function that takes
care of exiting the program if needed (if one of the `-v` or `-h`
options has been used, or if the command line is invalid), so that the
main function only deals with the core task it has to perform.
7 months ago
Damien Goutte-Gattat 7f1f714a57
Introduce basic command line parser.
Start using the QCommandLineParser class to allow for options later.
At the very least, we'll have an option to set a user-defined reason for
the inhibition request.
7 months ago
Damien Goutte-Gattat 94d5e050ab
Support old PowerManagement.Inhibit interface as fallback.
Encapsulate the code dealing with requesting an inhibitor lock in a
dedicated Inhibitor class. The lock is acquired in the constructor and
released in the destructor.

The constructor first tries to acquire the lock using the modern
"org.freedesktop.login1.Manager" interface, then tries the previous
"org.freedesktop.PowerManagement.Inhibit" interface as a fallback.
7 months ago
Damien Goutte-Gattat 144b1bb14a
Initial commit.
This is pm-inhibit, a systemd-inhibit replacement for systems without
systemd. It's a tool that allows to run a program while power management
features of the underlying desktop environment are inhibited.
7 months ago