Page 1 of 1

suspend and shutdown shortcut directly on Desktop

Posted: 15 Oct 2021, 18:39
by Testuser
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.

suspend and shutdown shortcut directly on Desktop

Posted: 16 Oct 2021, 22:14
by ncmprhnsbl
which desktop are we talking about? (kde(plasma), cinnamon, mate, xfce, lxde, lxqt, openbox)

suspend and shutdown shortcut directly on Desktop

Posted: 17 Oct 2021, 19:19
by Testuser
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

suspend and shutdown shortcut directly on Desktop

Posted: 30 Oct 2021, 13:52
by Testuser
Hi Team,

Was able to create shortcuts with DBus commands.

Thanks

suspend and shutdown shortcut directly on Desktop

Posted: 02 Nov 2021, 14:29
by Rava
Testuser wrote:
30 Oct 2021, 13:52
Was able to create shortcuts with DBus commands.
can you please share the info for the lurkers?

suspend and shutdown shortcut directly on Desktop

Posted: 03 Nov 2021, 16:28
by Testuser
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:

suspend and shutdown shortcut directly on Desktop

Posted: 03 Nov 2021, 19:58
by Rava
Testuser wrote:
03 Nov 2021, 16:28
Hope this is helpful :) :celebrate3:
Sure is. ImageImage

suspend and shutdown shortcut directly on Desktop

Posted: 04 Nov 2021, 04:50
by Ed_P
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:~$ 

suspend and shutdown shortcut directly on Desktop

Posted: 04 Nov 2021, 05:02
by Rava
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?

suspend and shutdown shortcut directly on Desktop

Posted: 04 Nov 2021, 05:25
by Ed_P
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?

suspend and shutdown shortcut directly on Desktop

Posted: 04 Nov 2021, 08:28
by ncmprhnsbl
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))

suspend and shutdown shortcut directly on Desktop

Posted: 04 Nov 2021, 10:29
by Rava
^
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:

suspend and shutdown shortcut directly on Desktop

Posted: 04 Nov 2021, 14:45
by Ed_P
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.

suspend and shutdown shortcut directly on Desktop

Posted: 07 Dec 2021, 18:57
by Testuser
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. :)