Xfce Forum

Sub domains
 

You are not logged in.

#1 2018-05-21 22:36:41

AdbekunkusMX
Member
Registered: 2018-05-21
Posts: 2

[Solved] Edit the target of buttons on xfce4-session-logout

Hi all.

Whenever I press the 'Hibernate' button on the Logout dialog the system hibernates fine; however on resuming I find that although the screen is locked, there is no screensaver. There is supposed to be, since I enabled the following code as a service:

[Unit]
Description=LightLocker
Before=sleep.target

[Service]
User=guajardo
Type=forking
Environment=DISPLAY=:0
ExecStart=/usr/bin/xscreensaver-command -lock

[Install]
WantedBy=sleep.target

This doesn't happen when I type 'systemctl hibernate' or 'xfce4-session-logout --hibernate' on a terminal. Is it possible to edit the target of the button "Hibernate" on the Logout dialog so as to execute the first one? I understand that pressing the button executes the second one.

Thanks!

Last edited by AdbekunkusMX (2018-05-21 23:14:16)


Quid non intellegas aut tace aut disce.

Offline

#2 2018-05-21 23:00:31

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,485

Re: [Solved] Edit the target of buttons on xfce4-session-logout

Hello and welcome.

One way is to override the xfce4-session-logout executable. Create the file /usr/local/bin/xfce4-session-logout with the following content:

#!/bin/bash

case $1 in
        "--hibernate")
                systemctl hibernate
        ;;
        *)
                /usr/bin/xfce4-session-logout "$1"
        ;;
esac

exit 0

...and make it executable. When Xfce executes xfce4-session-logout, this executable will run first (because the folder is earlier in your PATH) and will act differently if "--hibernate" is passed as a parameter. Otherwise it passes it on to the real xfce4-session-logout executable.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2018-05-21 23:13:53

AdbekunkusMX
Member
Registered: 2018-05-21
Posts: 2

Re: [Solved] Edit the target of buttons on xfce4-session-logout

ToZ wrote:

Hello and welcome.

One way is to override the xfce4-session-logout executable. Create the file /usr/local/bin/xfce4-session-logout with the following content:

#!/bin/bash

case $1 in
        "--hibernate")
                systemctl hibernate
        ;;
        *)
                /usr/bin/xfce4-session-logout "$1"
        ;;
esac

exit 0

...and make it executable. When Xfce executes xfce4-session-logout, this executable will run first (because the folder is earlier in your PATH) and will act differently if "--hibernate" is passed as a parameter. Otherwise it passes it on to the real xfce4-session-logout executable.

Thanks! Works perfectly! Many kudos to you.


Quid non intellegas aut tace aut disce.

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.012 seconds, 7 queries executed - Memory usage: 521.23 KiB (Peak: 522.07 KiB) ]