LinuxCommandLibrary

kscreen-console

Configure screen settings from the command line

TLDR

Show all outputs and configuration files to attach to a bug report

$ kscreen-console bug
copy

Show paths to KScreen configuration files
$ kscreen-console config
copy

Show KScreen output information and configuration
$ kscreen-console outputs
copy

Monitor for changes
$ kscreen-console monitor
copy

Show the current KScreen configuration as JSON
$ kscreen-console json
copy

Display help
$ kscreen-console [[-h|--help]]
copy

Display help including Qt specific command-line options
$ kscreen-console --help-all
copy

SYNOPSIS

kscreen-console [options]

PARAMETERS

--lock
    Locks the screen immediately.

--unlock
    Unlocks the screen. Requires authentication if the screen is locked.

--status
    Displays the current status of the screen locker (e.g., "locked", "unlocked", "active", "inactive").

--active
    Checks if the screen locker is currently active (running).

--deactivate
    Deactivates the screen locker daemon. Use with caution as it might bypass security.

--version
    Shows the version information of kscreen-console.

--help
    Displays a help message with available options.

DESCRIPTION

kscreen-console is a command-line utility for interacting with the KDE Plasma screen locking daemon, kscreenlocker.
It provides a simple interface to programmatically lock or unlock the screen, query its current status, or activate/deactivate the locker. This tool is particularly useful for scripting, system administrators, or users who prefer command-line interactions over graphical interfaces for managing their session security within a KDE Plasma environment.
It communicates with kscreenlocker via D-Bus to perform its operations.

CAVEATS

This command is specific to KDE Plasma desktop environments and relies on the kscreenlocker daemon being installed and running.
Unlocking the screen with --unlock requires user authentication (password) if the screen is genuinely locked, mimicking the graphical unlock prompt.
It may not work as expected in non-KDE environments or if kscreenlocker is not functioning correctly.

D-BUS INTERFACE

kscreen-console interacts with kscreenlocker using D-Bus.
The specific D-Bus service is often org.kde.ScreenSaver and the path /ScreenSaver. Commands like --lock or --unlock translate into method calls on this D-Bus interface. This makes it possible for other applications or scripts to integrate with KDE's screen locking mechanism using D-Bus directly, if kscreen-console doesn't offer a specific function.

HISTORY

kscreen-console has been an integral part of the KDE Plasma desktop environment for many years, evolving alongside the screen locker daemon. Its purpose has remained consistent: to provide a programmatic interface for screen locking functionality.
It leverages D-Bus, a standard inter-process communication system, which has been central to KDE's architecture for a long time, particularly since KDE 4 and Plasma 5.

SEE ALSO

qdbus(1): A command-line tool for interacting with D-Bus services., dbus-send(1): Low-level D-Bus message sending utility., loginctl(1): Control the systemd login manager, which can also manage user sessions and screen locks (though not directly kscreenlocker).

Copied to clipboard