You are not logged in.

#1 2020-12-06 21:50:50

sleekmason
zoom
Registered: 2018-05-22
Posts: 584

[Solved] How can I execute both commands in logout script

Good day!

I would like to use this exit script for both the lxsession logout and a fluxbox logout. This means executing the separate commands to logout.
You will see what I am trying to do in the third line down.  But, as usual.

#!/bin/bash
yad --form --title="Options" --window-icon=/usr/share/icons/ld-icons/exit.png --width=165 --borders=8 --height=365 --skip-taskbar --image=/usr/share/icons/ld-icons/pixmaps/Logout.png --image-on-top --center \
--field="       Lock Screen!/usr/share/icons/ld-icons/pixmaps/slock.png!Lock Screen":fbtn "slock" \
--field="             Log Out!/usr/share/icons/ld-icons/pixmaps/logout_exit.png!Log Out":fbtn "fluxbox-remote exit && pkill -SIGTERM -f lxsession" \
--field="            Suspend!/usr/share/icons/ld-icons/pixmaps/logout_suspend.png!Suspend":fbtn "systemctl suspend" \
--field="               Reboot!/usr/share/icons/ld-icons/pixmaps/logout_reboot.png!Restart":fbtn "systemctl reboot" \
--field="         Shut Down!/usr/share/icons/ld-icons/pixmaps/logout_shutdown.png!Shut Down":fbtn "systemctl poweroff" \
--button=gtk-cancel \

Last edited by sleekmason (2020-12-06 23:42:24)

Offline

#2 2020-12-06 22:12:32

damo
....moderator....
Registered: 2015-08-20
Posts: 6,660

Re: [Solved] How can I execute both commands in logout script

How about using a session test first, then

if fluxbox then run a fluxbox yad dialog
elif lxsession then run a lxsession dialog
fi

For the test I think you can do something like

pgrep -x "$window_manager"

Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#3 2020-12-06 22:29:23

sleekmason
zoom
Registered: 2018-05-22
Posts: 584

Re: [Solved] How can I execute both commands in logout script

damo wrote:

How about using a session test first, then

if fluxbox then run a fluxbox yad dialog
elif lxsession then run a lxsession dialog
fi

For the test I think you can do something like

pgrep -x "$window_manager"

Sorry, But I do not understand where to put these commands.

Offline

#4 2020-12-06 23:11:41

sleekmason
zoom
Registered: 2018-05-22
Posts: 584

Re: [Solved] How can I execute both commands in logout script

Assuming you mean a separate script to find the window manager then execute the right yad exit dialog?

but

pgrep -x "$window_manager"

in a terminal doesn't show anything.

edit* Yeah, no.  I'm lost.

Last edited by sleekmason (2020-12-06 23:16:30)

Offline

#5 2020-12-06 23:31:21

sleekmason
zoom
Registered: 2018-05-22
Posts: 584

Re: [Solved] How can I execute both commands in logout script

Maybe a generic code that works?

loginctl terminate-user $USER

This kinda does.
Removes decorations, thens sits for a minute or two until without warning, logs out.  Maybe a better one?

Offline

#6 2020-12-06 23:38:37

sleekmason
zoom
Registered: 2018-05-22
Posts: 584

Re: [Solved] How can I execute both commands in logout script

And, the answer for the win is:

pkill -KILL -u $USER

Thank you for your help and time:) pushed me in the right direction.

Offline

#7 2020-12-07 02:05:14

damo
....moderator....
Registered: 2015-08-20
Posts: 6,660

Re: [Solved] How can I execute both commands in logout script

sleekmason wrote:

Assuming you mean a separate script to find the window manager then execute the right yad exit dialog?

but

pgrep -x "$window_manager"

in a terminal doesn't show anything.

edit* Yeah, no.  I'm lost.

Maybe I should have explicitly said that it was pseudocode hmm


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

Board footer

Powered by FluxBB