suspend and shutdown shortcut directly on Desktop

Post here if you are a new Porteus member and you're looking for some help.
Testuser
Samurai
Samurai
Posts: 137
Joined: 26 May 2021, 15:11
Distribution: Porteus-v5.0-64-LXDE

suspend and shutdown shortcut directly on Desktop

Post#1 by Testuser » 15 Oct 2021, 18:39

Hi Team,

Could you please assist in creating a suspend and shutdown shortcut directly on Desktop?

I have tried couple of things and it did not worked. :x :( :wall:

Thanks in advance.

User avatar
ncmprhnsbl
DEV Team
DEV Team
Posts: 3924
Joined: 20 Mar 2012, 03:42
Distribution: v5.0-64bit
Location: australia
Contact:

suspend and shutdown shortcut directly on Desktop

Post#2 by ncmprhnsbl » 16 Oct 2021, 22:14

which desktop are we talking about? (kde(plasma), cinnamon, mate, xfce, lxde, lxqt, openbox)
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44

Testuser
Samurai
Samurai
Posts: 137
Joined: 26 May 2021, 15:11
Distribution: Porteus-v5.0-64-LXDE

suspend and shutdown shortcut directly on Desktop

Post#3 by Testuser » 17 Oct 2021, 19:19

Hi ncmprhnsbl ,

Thanks much for the reply.

Sorry not to mention that, its LXDE.

Will be greatful if I can get that for XFCE as well.

Thanks

Testuser
Samurai
Samurai
Posts: 137
Joined: 26 May 2021, 15:11
Distribution: Porteus-v5.0-64-LXDE

suspend and shutdown shortcut directly on Desktop

Post#4 by Testuser » 30 Oct 2021, 13:52

Hi Team,

Was able to create shortcuts with DBus commands.

Thanks

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

suspend and shutdown shortcut directly on Desktop

Post#5 by Rava » 02 Nov 2021, 14:29

Testuser wrote:
30 Oct 2021, 13:52
Was able to create shortcuts with DBus commands.
can you please share the info for the lurkers?

Testuser
Samurai
Samurai
Posts: 137
Joined: 26 May 2021, 15:11
Distribution: Porteus-v5.0-64-LXDE

suspend and shutdown shortcut directly on Desktop

Post#6 by Testuser » 03 Nov 2021, 16:28

Hi Rava,

Sure will love to share the info.

Found the info on the below github site

https://gist.github.com/reporter123/1635661 - Suspend, hibernate, restart or shutdown the computer without sudo!

Can use the script or directly use the commands to create shortcuts.

Hope this is helpful :) :celebrate3:

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

suspend and shutdown shortcut directly on Desktop

Post#7 by Rava » 03 Nov 2021, 19:58

Testuser wrote:
03 Nov 2021, 16:28
Hope this is helpful :) :celebrate3:
Sure is. ImageImage
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

suspend and shutdown shortcut directly on Desktop

Post#8 by Ed_P » 04 Nov 2021, 04:50

I think I'm missing something.

Code: Select all

guest@porteus:~$ ./power.sh restart
Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.ConsoleKit was not provided by any .service files
guest@porteus:~$ 
Ed

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

suspend and shutdown shortcut directly on Desktop

Post#9 by Rava » 04 Nov 2021, 05:02

Ed_P wrote:
04 Nov 2021, 04:50
I think I'm missing something.
Probably this:
Testuser wrote:
17 Oct 2021, 19:19
its LXDE.
Will be greatful if I can get that for XFCE as well.
Or am I mistaken and you, Ed_P, either did test it under LXDE or XFCE?

I - running XFCE - get a different error:

Code: Select all

$ ./power.sh suspend
Error org.freedesktop.DBus.Error.UnknownMethod: No such method “Suspend”
My XFCE "Log out" window gives me the “Suspend” option, and via XFCE whiskermenu, Suspend works.

Either org.freedesktop.DBus.Error.UnknownMethod is mistaken or for XFCE the code needs altering?

Testuser, did ./power.sh work for you in XFCE as well?
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

suspend and shutdown shortcut directly on Desktop

Post#10 by Ed_P » 04 Nov 2021, 05:25

Rava wrote:
04 Nov 2021, 05:02
Or am I mistaken and you, Ed_P, either did test it under LXDE or XFCE?
Actually I tested it in Cinnamon. So where/how does one find the DE's service name?
Ed

User avatar
ncmprhnsbl
DEV Team
DEV Team
Posts: 3924
Joined: 20 Mar 2012, 03:42
Distribution: v5.0-64bit
Location: australia
Contact:

suspend and shutdown shortcut directly on Desktop

Post#11 by ncmprhnsbl » 04 Nov 2021, 08:28

if you're using RC2 or 3 anything using consolekit will not work, because consolekit has been replaced with elogind (whose commands are simply: loginctl poweroff (or reboot or suspend))
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

suspend and shutdown shortcut directly on Desktop

Post#12 by Rava » 04 Nov 2021, 10:29

^
thanks for the reminder, I integrated that into my suspend.sh script, but its only on my rc3 x86-64 machine, not on my 4.0 i586 one… so I forgot to look up the code I utilised many moons ago.
Back then it was also you who told me about loginctl suspend. :beer:
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

suspend and shutdown shortcut directly on Desktop

Post#13 by Ed_P » 04 Nov 2021, 14:45

So for Cinnamon I tweaked the code to use loginctl. :)

Code: Select all

    THINGY_CINNAMON=loginctl
    case $1 in
        suspend)
            $THINGY_CINNAMON suspend
        ;;
        hibernate)
            $THINGY_CINNAMON hibernate
        ;;
        restart)
            $THINGY_CINNAMON reboot
        ;;
        shutdown)
            $THINGY_CINNAMON poweroff
        ;;
        *)
            usage
        ;;
    esac
Added in 8 minutes 2 seconds:
All work for me except hibernate but that's because I don't use disk until I shutdown.
Ed

Testuser
Samurai
Samurai
Posts: 137
Joined: 26 May 2021, 15:11
Distribution: Porteus-v5.0-64-LXDE

suspend and shutdown shortcut directly on Desktop

Post#14 by Testuser » 07 Dec 2021, 18:57

Hi Team,

Sorry for late reply.

I found a harder and longer command for new RC3 OS.

dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.Suspend boolean:true

loginctl also works for me

loginctl hybrid-sleep - Good option will hibernate, but if power is not down then immediately turn on like suspend.

Thanks everybody. :)

Post Reply