LinuxCommandLibrary

kde-inhibit

Inhibit KDE power management and screen locking

TLDR

Inhibit power management

$ kde-inhibit --power [command] [command_arguments]
copy

Inhibit screen saver
$ kde-inhibit --screenSaver [command] [command_arguments]
copy

Launch VLC, and inhibit color correction (night mode) while it's running
$ kde-inhibit --colorCorrect [vlc]
copy

SYNOPSIS

kde-inhibit [options] [command...]

PARAMETERS

-h, --help
    Display help information and exit.

-v, --version
    Display version information and exit.

-S, --sleep
    Inhibit automatic system sleep or suspend.

-L, --screen-locker
    Inhibit the screen from automatically locking.

-P, --power-save
    Inhibit power-saving features like screen blanking or dimming.

-s, --session
    Inhibit session logout or shutdown actions.

-f, --fire-and-forget
    Do not wait for the specified command to exit. kde-inhibit will exit immediately after launching the command, but the inhibition will remain active.

-W , --window
    Apply the inhibition only when the specified window (identified by its XID) is active.

-A , --application
    Apply the inhibition only when the specified application (identified by its .desktop ID) is active.

-D, --dialog
    Display a dialog allowing the user to override the inhibition.

-t , --reason
    Provide a human-readable reason for the inhibition, which might be displayed to the user.

-u , --uri
    Associate a URI with the inhibition (primarily for KWin rules or specific D-Bus contexts).

DESCRIPTION


kde-inhibit is a command-line utility for KDE Plasma environments that allows users to temporarily prevent certain session management actions like screen locking, system sleep, or power-saving features. It's commonly used when running a long-running task, watching a video, or giving a presentation, ensuring the system doesn't unexpectedly go to sleep or lock the screen.

The inhibition can be applied globally or tied to the lifespan of a specific command. When used with a command, kde-inhibit runs the command and automatically releases the inhibition when the command exits. It leverages D-Bus to communicate with KDE's power management and screen locking services.

CAVEATS

  • Requires a KDE Plasma desktop environment for full functionality, as it interacts directly with KDE's D-Bus services (e.g., PowerDevil, KScreenLocker).
  • Does not prevent manual user actions (e.g., explicitly pressing the power button to shut down).
  • The effectiveness of inhibition depends on the configured KDE power management policies and may be subject to system-wide settings or PolicyKit rules.
  • If kde-inhibit is killed or crashes, the inhibition will be released.

COMMON USE CASES


kde-inhibit is particularly useful for scenarios where uninterrupted system operation is crucial. For example, running
kde-inhibit --sleep --screen-locker your_long_command
will prevent the system from sleeping or locking the screen while your_long_command is executing. Similarly,
kde-inhibit --power-save vlc movie.mp4
ensures the screen remains active during video playback without user interaction.

D-BUS INTERACTION


Underneath, kde-inhibit communicates via D-Bus with KDE services. It acts as a client requesting an inhibition lock. When the command exits (or if --fire-and-forget is used), kde-inhibit releases this lock, allowing normal power management and screen locking behavior to resume.

HISTORY


kde-inhibit is an integral part of the KDE Plasma desktop environment, specifically designed to interact with KDE's session management components like PowerDevil (for power management) and KScreenLocker (for screen locking). Its development parallels the evolution of KDE Plasma's power and session management capabilities, providing a user-friendly command-line interface to D-Bus inhibition mechanisms. It was introduced to offer a KDE-specific alternative to more generic tools like systemd-inhibit that integrates seamlessly with Plasma's user experience.

SEE ALSO

systemd-inhibit(1), qdbus(1), kscreenlocker_manual_lock(1)

Copied to clipboard