Home | News | Download | Packages | Forum | Wiki | Github

[solved] Upower question


(Nonico) #1

Hi everyone. I have a question regarding upower. I like to tinker at times and make some of my own “applications” with yad. Long ago, I made a Log Out application (for lack of a better term) that looks similar to the lxsession-logout window. Normally, I’m very simple and only use Logout, Restart, and Shutdown in the script so that only those three items show in the window.
Today, I thought I’d try adding Suspend and Hibernate just to see if I could get them to work.

  1. I installed upower.
  2. I wasn’t sure if I needed to, but I went ahead and tried to start its service.

Neither Suspend or Hibernate work. I looked in /etc/sv/ for upower…it wasn’t there. However, it is in /etc/ and shown as UPower…not upower.

I then looked in /var/service/ and my attempt to start the service was there, but it’s not working as far as I can tell.

So, my questions are…

  1. Does upower have to be started as a service?
  2. If so, since it’s not appearing in /etc/sv/, would I use the following command to do so (please note that I’m writing this as it appears in the /etc/ folder…

ln -s /etc/UPower /var/service/

Thanks for any input (I’m still learning :slight_smile: )


(Nonico) #2

I don’t know if this will help, but here’s my script and a screenshot of it.

#!/bin/sh

yad --form --width=165 --borders=5 --height=320 --undecorated --skip-taskbar --image=/home/dan/Pictures/logout.png --image-on-top --center \
--field="  Log Out!gnome-logout!Log Out":fbtn "openbox --exit" \
--field="  Hibernate!gnome-session-hibernate!Hibernate":fbtn "dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Hibernate" \
--field="  Suspend!gnome-session-suspend!Suspend":fbtn "slimlock & dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend" \
--field="  Restart!system-reboot!Restart":fbtn "dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart" \
--field="  Shut Down!gnome-shutdown!Shut Down":fbtn "dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop" \
--button=gtk-cancel \

Screenshot%20from%202018-04-10%2016-44-19


#3

I think you can do that using zzz / ZZZ
Take a look at:

$ man zzz

:wink:


(Nonico) #4

WOW! Thank you! What other glorious hidden treasures lie waiting for me to discover!?!?!

I looked at the man page…

Zzzz… yawn.
The system has woken up again. Everything is fine. You feel
refreshed.

:rofl:

Thank you cr6.