LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Alternative power manager for Slackware (https://www.linuxquestions.org/questions/slackware-14/alternative-power-manager-for-slackware-4175641147/)

olear 10-25-2018 06:34 PM

Alternative power manager for Slackware
 
Hello fellow slackers!

I'm not a particularly big fan of KDE or Xfce (no disrespect, just my taste), so I usually end up with Openbox (or similar). This serves me well on a workstation (for the most part), but on a laptop for work and daily use this is lacking. I need a power manager that takes care of my computer, but I don't want to include/install KDE or Xfce, so I started making my own power manager.

I have been working on the first stable release for a while now, and have come to a point where I'm satisfied with the features and stability. So, without further adieu I introduce powerkit 1.0.0 RC1.

powerkit is a lightweight full featured power manager for Slackware, for use with alternative desktop environments and window managers, like Fluxbox, Blackbox, FVWM, WindowMaker, Openbox, Lumina and others.

* Enables applications to inhibit the screen saver (org.freedesktop.ScreenSaver)
* Enables applications to inhibit suspend actions (org.freedesktop.PowerManagement)
* (Hybrid)Sleep/Hibernate/Shutdown/Lock screen on lid action
* Inhibit lid action if external monitor(s) is connected
* Automatically suspend ((hybrid)sleep/hibernate)
* Hibernate/Shutdown on critical battery
* Simple configuration GUI
* XScreenSaver support
* Backlight support

Basically it implements the "fancy" (power) features that exists in KDE/Xfce, but for any WM/DE, with minimal requirements (within reason).

I hope this application/project will be useful for Slackware and it's users. Remember to read the documentation before usage (https://github.com/rodlie/powerkit/b...ster/README.md). Report any issues in this thread or on Github/Gitlab, all feedback is appreciated.

* https://github.com/rodlie/powerkit
* https://gitlab.com/rodlie/powerkit

* [source] https://github.com/rodlie/powerkit/r....0.0rc1.tar.xz
* [package 64bit] https://github.com/rodlie/powerkit/r..._slack14.2.tgz
* [package 32bit] https://github.com/rodlie/powerkit/r..._slack14.2.tgz


Enjoy :)

Ole-André Rodlie

montagdude 10-25-2018 06:49 PM

Sounds interesting. I will give it a try. I also use Openbox and have created some scripts for power management, which serve me well, but I am always willing to test new stuff. Thanks for sharing! (And this is clearly more complete than my scripts, anyway.)

olear 10-25-2018 07:49 PM

I started out with scripts too, but after a while I wanted/needed features that wasn't feasible to do with scripts, so here we are. I hope you like the application (if not tell me why, and maybe I can improve something).

zakame 10-25-2018 11:48 PM

Nice, I'll give this a spin on my -current with Fluxbox (its running with xfce-power-manager currently but I found it rather clunky in some parts.) Thanks!

montagdude 10-26-2018 08:53 AM

Well, not a great first result:

Code:

dan@Thinkpad-T430:~$ powerkit
Segmentation fault (core dumped)

I will try building from source now and see if that makes any difference or reveals an issue.

montagdude 10-26-2018 09:15 AM

I rebuilt it from source with debug flags. Here is the backtrace for the segfault:

Code:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff5f5b580 in QVariant::QVariant(QVariant const&) () from /usr/lib64/qt/lib/libQtCore.so.4
(gdb) bt
#0  0x00007ffff5f5b580 in QVariant::QVariant(QVariant const&) ()
    at /usr/lib64/qt/lib/libQtCore.so.4
#1  0x00007ffff7248da8 in QDBusPendingReplyData::argumentAt(int) const ()
    at /usr/lib64/qt/lib/libQtDBus.so.4
#2  0x00007ffff7bcabdd in QDBusPendingReply<QString, void, void, void, void, void, void, void>::argumentAt<0>() const (this=0x7fffffffd7d8) at /usr/lib64/qt/include/QtDBus/qdbuspendingreply.h:176 
#3  0x00007ffff7bc9a99 in QDBusPendingReply<QString, void, void, void, void, void, void, void>::value() const (this=0x7fffffffd7d8) at /usr/lib64/qt/include/QtDBus/qdbuspendingreply.h:181         
#4  0x00007ffff7bc5ef0 in PowerKit::find() (this=0x6e5660) at powerkit.cpp:177
#5  0x00007ffff7bc745c in PowerKit::scan() (this=0x6e5660) at powerkit.cpp:283
#6  0x00007ffff7bc6fbc in PowerKit::setup() (this=0x6e5660) at powerkit.cpp:268
#7  0x00007ffff7bc4a8d in PowerKit::PowerKit(QObject*) (this=0x6e5660, parent=0x7fffffffdd20)
    at powerkit.cpp:26
#8  0x000000000040d5fe in  ()
#9  0x000000000040c89e in  ()
#10 0x00007ffff4f487d0 in __libc_start_main () at /lib64/libc.so.6
#11 0x000000000040c429 in  ()

Also, this is kind of strange, but when I built it from source (using your SlackBuild) with CONFIG+=debug and CFLAGS="-g -fPIC", I initially got an error loading the libPowerkit.so shared library. It seems it did not get installed properly. After manually installing it in /usr/lib64, I get this segfault. The strange thing is that it did not complain about the shared library when using the package you provided or when building it with CONFIG+=release and CFLAGS="-O2 -fPIC", even though as far as I can tell, libPowerkit.so was not installed then either.

I should note that I have a bit of a frankensystem right now, because awhile ago I was using Dlackware with systemd, then I removed Gnome, but I still have systemd because I haven't taken the time to do a proper reinstall yet. These issues don't seem related to that, but there's always a chance.

olear 10-26-2018 01:27 PM

Hmm, will look into this. Note that the library is built static on release (you an override with CONFIG+=install_lib), in debug the library is shared (for ease of development).

systemd could be a problem (I only test/support consolekit+upower on Slackware). The application checks for logind first, then consolekit, then upower. Does the logind D-Bus service work on your installation?

I have tested powerkit on slackware(64) 14.2 (consolekit+upower0.9), FreeBSD 11.2 (consolekit+upower0.9) and Ubuntu 18.04 (logind+upower0.99).

olear 10-26-2018 01:47 PM

@montagdude: The segfault has been fixed (in git 1.0/master), but there is something strange with your setup since powerkit can't get a proper response from upower. Could you list the installed version of systemd/logind/consolekit/upower so I can try to replicate this issue?

montagdude 10-26-2018 01:55 PM

Quote:

Originally Posted by olear (Post 5919476)
@montagdude: The segfault has been fixed (in git 1.0/master), but there is something strange with your setup since powerkit can't get a proper response from upower. Could you list the installed version of systemd/logind/consolekit/upower so I can try to replicate this issue?

I have systemd 231 and upower 0.9.23. However, I'm not sure if upower is working correctly with Dlackware systemd (or if it is even supposed to).

olear 10-26-2018 02:00 PM

Ok, systemd/logind requires upower 0.99.x to my knowledge. But upower should still work (but some features may not work). I will try to setup a installation with systemd (any SlackBuilds available?) and upower 0.9.x and see if I can do some workarounds.

montagdude 10-26-2018 02:02 PM

Quote:

Originally Posted by olear (Post 5919480)
Ok, systemd/logind requires upower 0.99.x to my knowledge. But upower should still work (but some features may not work). I will try to setup a installation with systemd (any SlackBuilds available?) and upower 0.9.x and see if I can do some workarounds.

Okay, but don't spend too much time on that just on my account, seeing I have an unsupported frankensystem and I'm planning to reinstall Slackware proper eventually anyway.

olear 10-26-2018 03:00 PM

You can check if upower is working with:
Code:

qdbus --system org.freedesktop.UPower /org/freedesktop/UPower/devices org.freedesktop.DBus.Introspectable.Introspect
You should get an XML with available devices, like:
Code:

<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
  <node name="battery_BAT1"/>
  <node name="line_power_ACAD"/>
</node>


montagdude 10-26-2018 03:26 PM

Nope, definitely not working.

Code:

dan@Thinkpad-T430:~$ qdbus --system org.freedesktop.UPower /org/freedesktop/UPower/devices org.freedesktop.DBus.Introspectable.Introspect                                                           
Error: org.freedesktop.systemd1.NoSuchUnit
Unit upower.service not found.

So yeah, blame my weirdo system for that.

Skaendo 10-27-2018 12:15 AM

This looks interesting, but I normally use desktop environments like Cinnamon and XFCE so I don't have a direct need for it and have not tested it since I don't have any alternative WM's installed.

HOWEVER, if it can suspend to RAM after a predetermined time of system inactivity while running within any DE/WM on a desktop PC, say like how a screensaver runs after a given amount of time, I could totally have a use for it. (and totally would be using it)

I find that this feature is lacking in any (of the few) Linux distros that I have tried, and is the only thing that is keeping me from completely ditching Windows for good is because I like my HTPC to suspend after not using it for say, 15 minutes.

SO, does your program have this feature, or could it be easily implemented?

olear 10-27-2018 12:27 AM

Auto suspend is of course supported :)


All times are GMT -5. The time now is 03:44 AM.