powerkit - Desktop independent power manager for Linux
powerkit [--config]
[--set-brightness-up]
[--set-brightness-down]
[--sleep]
[--hibernate]
[--lock]
Desktop independent power manager for use with alternative X11 desktop environments and window managers on Linux.
- Implements
org.freedesktop.ScreenSaver
service - Implements
org.freedesktop.PowerManagement.Inhibit
service - Automatic actions on lid, idle and low battery
- Sleep
- Hibernate
- HybridSleep
- Suspend then Hibernate
- Shutdown
- Screen saver support
- Screen lid support
- Screen locking support
- Screen backlight support
- Notification support (can use
org.freedesktop.Notifications
if available)
powerkit should be started during the X11 user session. Consult the documentation for your desktop environment or window manager for launching startup applications.
- In Fluxbox add
powerkit &
to the~/.fluxbox/startup
file - In Openbox add
powerkit &
to the~/.config/openbox/autostart
file.
Do use powerkit if your desktop environment or window manager already has a power manager or screen saver service running.
Settings are available directly from the system tray icon or run powerkit --config
. You should also be able to lauch the powerkit settings from your desktop application menu (if available).
powerkit implements a basic screen saver to handle screen blanking, poweroff and locking feature.
Locking feature depends on xsecurelock
.
You can override the lock command with screensaver_lock_cmd=<command>
in ~/.config/powerkit/powerkit.conf
. Note that the command must not contain spaces.
The current display brightness (on laptops and supported displays) can be adjusted with the mouse wheel on the system tray icon or through the system tray menu.
powerkit also supports the following commands that can be used for global shortcuts, scripts etc:
powerkit --set-brightness-up
: Set default display brightness up.
powerkit --set-brightness-down
: Set default display brightness down.
On Fluxbox you can add the commands to the ~/.fluxbox/keys
file:
XF86MonBrightnessUp :Exec powerkit --set-brightness-up
XF86MonBrightnessDown :Exec powerkit --set-brightness-down
If hibernate works depends on your system, a swap partition (or file) is needed by the kernel to support hibernate.
Consult your system documentation regarding hibernation.
powerkit will use the existing icon theme from the running desktop environment or window manager.
You can override the icon theme in the ~/.config/powerkit/powerkit.conf
file, use icon_theme=<theme_name>
.
The preferred way to inhibit the screen saver from an application is to use the org.freedesktop.ScreenSaver specification. Any application that uses org.freedesktop.ScreenSaver will work with powerkit.
Popular applications that uses this feature is Mozilla Firefox, Google Chrome, VideoLAN VLC and many more.
The preferred way to inhibit suspend actions from an application is to use the org.freedesktop.PowerManagement specification. Any application that uses org.freedesktop.PowerManagement will work with powerkit.
Common use cases are audio playback, downloading, rendering and similar.
Chrome does not use org.freedesktop.ScreenSaver or org.freedesktop.PowerManagement until it detects a supported desktop environment. Add the following to ~/.bashrc
or the google-chrome
launcher if you don't run a supported desktop environment:
export DESKTOP_SESSION=xfce
export XDG_CURRENT_DESKTOP=xfce
This is an issue with Firefox (missing feature). Use a different browser or open a request on the Firefox issue tracker.
Firefox should inhibit the power manager during audio playback (regardless of video) and during download (active queue). Currently Firefox only inhibit the screen saver during video playback. Chrome/Chromium does this correctly.
powerkit requires the following dependencies:
- X11
- libXss
- libXrandr
- Qt 5.15 (Core/DBus/Gui/Widgets)
- logind (or compatible service)
- UPower (or compatible service)
- xsecurelock
First make sure you have the required dependencies installed, then review the most common build options:
CMAKE_INSTALL_PREFIX=</usr/local>
- Install target./usr
recommended.CMAKE_BUILD_TYPE=<Release/Debug>
- Build type.Release
recommended
Now configure powerkit with CMake and build:
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release ..
make -j4
All you need is the powerkit
binary located in the build directory, you can run it from any location.
Use regular make install
with optional DESTDIR
:
make DESTDIR=<package_directory> install
or make a native package:
cpack -G DEB
cpack -G RPM
- Recommended locker is
xsecurelock
- Added support for "modern" logind
- Removed support for ConsoleKit
- Removed support for XScreenSaver
- Added basic screen saver
- Easier to use (minimal/no setup)
- New UI
- Major code changes
--config
: Launch configuration.
--set-brightness-up
: Set default display brightness up.
--set-brightness-down
: Set default display brightness down.
--sleep
: Suspend computer now. Can be combined with --hibernate
for suspend then hibernate after X amount of time.
--hibernate
: Hibernate computer now. Can be combined with --sleep
for suspend then hibernate after X amount of time.
--lock
: Lock screen.
~/.config/powerkit/powerkit.conf
: Per user configuration file.
xsecurelock
(1), UPower
(7), systemd-logind
(8)
See https://github.com/rodlie/powerkit/issues.
Copyright (c) Ole-André Rodlie <https://github.com/rodlie>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.