command line utility to list session power inhibitors for Linux Gnome users.
Inspired by https://askubuntu.com/a/1239194/152287 from Alexis Wilke (https://www.m2osw.com/)
Install Tips
The pip install adds an executable to your path (see usage).
This script assumes you are using Gnome.
Prerequisite packages
The python package PyGObject is a prerequisite. Installation is automatic, but certain system packages must be installed, according to the requirements of PyGObject
For Ubuntu 20.10:
sudo apt install python3-pip libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-3.0
for other distributions, see https://pygobject.readthedocs.io/en/latest/getting_started.html
You may get a warning that ~/.local/bin is not on your path.
When you next login, this will be fixed.
Usage
inhibitors list
Example
With the Gnome Shell plugin Caffeine activate, and a Google Meet running in Firefox:
$ inhibitors list
Listing inhibitors reported by dbus:
Inhibitor: firefox audio-playing
Inhibitor: user Inhibit by Caffeine
Comparison with systemd
we can do
$ systemd-inhibit --list
which on my desktop gives:
WHO UID USER PID COMM WHAT WHY MODE
ModemManager 0 root 2222 ModemManager sleep ModemManager needs to reset devices delay
NetworkManager 0 root 1912 NetworkManager sleep NetworkManager needs to turn off networks delay
UPower 0 root 2654 upowerd sleep Pause device polling delay
Unattended Upgrades Shutdown 0 root 2449 unattended-upgr shutdown Stop ongoing upgrades or perform upgrades before shutdown delay
GNOME Shell 1000 tim 5039 gnome-shell sleep GNOME needs to lock the screen delay
Telepathy 1000 tim 5156 mission-control shutdown:sleep Disconnecting IM accounts before suspend/shutdown... delay
gnome-tweak-tool-lid-inhibitor 1000 tim 5325 python3 handle-lid-switch user preference block
tim 1000 tim 5255 gsd-media-keys handle-power-key:handle-suspend-key:handle-hibernate-key GNOME handling keypresses block
tim 1000 tim 5020 gnome-session-b shutdown:sleep user session inhibited block
tim 1000 tim 5255 gsd-media-keys sleep GNOME handling keypresses delay
tim 1000 tim 5257 gsd-power sleep GNOME needs to lock the screen delay
The Caffeine plugin inhibit is the third line from the bottom. However, it is not obvious. I am sure in this case, because when I deactivate caffeine, the third line disappears.
The Google Meet inhibitor is not even listed at all. However, it is definitely an inhibitor.
Building and uploading
python3 -m build
python3 -m twine upload --skip-existing dist/*
Metadata
Release files for list-session-inhibitors 0.9.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| list_session_inhibitors-0.9.8.tar.gz | 4.3 kB | Without provenance | Details for list_session_inhibitors-0.9.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| list_session_inhibitors-0.9.8-py3-none-any.whl | Python 3 | none | any | Details for list_session_inhibitors-0.9.8-py3-none-any.whl |
Total release size: 8.6 kB
Release files / list_session_inhibitors-0.9.8.tar.gz
| Download URL | list_session_inhibitors-0.9.8.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
001d1573ddcd672a02688f1a384cf2d6ab8e11d83b938030d948350702b6d7ff
|
|
BLAKE2b-256 checksum How to use checksums |
5e4469f9e4f43873b587dcbae06c583976989894920b2dde35eb2e029b181d85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.6
|
Release files / list_session_inhibitors-0.9.8-py3-none-any.whl
| Download URL | list_session_inhibitors-0.9.8-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0a228184900982c4857660e2eef1c13e51ffb685cfc917a94f6be65848d525fb
|
|
BLAKE2b-256 checksum How to use checksums |
42ae8e21420fa95cab885d4d4d00c590b99e7e1a5d62d5e7f0a434347dfe1306
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.6
|
Security for list-session-inhibitors 0.9.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.