vsido-exit (systemd based logout script for VSIDO)

Snap

#45
Quote@Snap I don't know french so I'll take it as a joke ;)

Ooops... Don't know what happened. I don't know french either. The picture stopped working for some reason...  ::)

For the record, It was a scrot of the window made smaller without any icons, just like the original one. A simple row of plain buttons.

Gotta test V3 after breakfast.

hakerdefo

One of the very first thing a person who has just started using computer learns is,

Quote
Click on the "x" icon at the top corner of a window or a diaog box to close the window or cancel the operation.

And an advanced user using one of those fancy tiling manager without window decorations knows how to close any open window via keyboard.

This is the logic behind the missing "Cancel" button.

Cheers!!!
You Can't Always Git What You Want

VastOne

I don't believe there is a single person on this site that needs a history lesson or help on how to use a computer, we all will agree to that

I personally think the icons ruin the overall look of this simple script and have no use for them
VSIDO      VSIDO Change Blog    

    I dev VSIDO

hakerdefo

I wasn't giving anyone a history lesson nor was I offering a how-to on using computers. There are people on this forum whose knowledge on using computers no doubt is far superior than mine. I was a bit surprised by the demand for a dedicated "Cancel" button.
And as far as icons look is concerned it's a matter of personal taste. User can easily replace them with icons of his/her choice or make them not to appear at all on the buttons.
The script adds a "Screen Lock" function which many users might consider a necessity. And the script requires far less dependencies than Philip's exit script currently used in VSIDO.
Cheers!!!
You Can't Always Git What You Want

PackRat

Quote from: VastOne on January 31, 2017, 02:21:41 AM
The more and more I search about images and yad the more I think they do not coexist well at all

Plain Jane is my vote for a 5 button with:

Cancel Logout Suspend Reboot Shutdown

Like this -



Version 3 of hackerdefo's script (which works as advertised on my system) with the buttons rearanged, Cancel button added, icons and window dec's removed.
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

VastOne

@PackRat

That's perfect.. beam up the code Scotty, please...   8)
VSIDO      VSIDO Change Blog    

    I dev VSIDO

PackRat

#51
I'll post it tomorrow morning - I want to look at it one last time.

It's a bit of a hack - I read the yad man page, but still not sure about a couple items (i.e. I removed the decor with the ~./.fluxbox/apps file). All the buttons work without setting off the fire alarm though, so it should be good to go.

Change of plans - someone in the know can clean it up. The main thing to proof is that I have the command for the cancel button correct. I added "undecorate" to remove the title and buttons, and "skip taskbar" to the settings, as well as, changing button style to "spread".

#!/usr/bin/env bash
vslo_menu (){
vslo_ttle="VSIDO Logout"
vslo_clas="$vslo_ttle"
# uncomment for icons on buttons and remove --undecorated ==============
#vslo_wico="/usr/share/pixmaps/vs-session-manager.svg"
#vslo_butl="/usr/share/pixmaps/logout_lock.png"
#vslo_bute="/usr/share/pixmaps/logout_exit.png"
#vslo_buts="/usr/share/pixmaps/logout_suspend.png"
#vslo_butr="/usr/share/pixmaps/logout_reboot.png"
#vslo_butq="/usr/share/pixmaps/logout_shutdown.png"
#=======================================================================
type dm-tool >/dev/null 2>&1
RETVAL=$?
if ! [[ "$RETVAL" == 0 ]]; then
type slock >/dev/null 2>&1
RETVAL=$?
if ! [[ "$RETVAL" == 0 ]]; then
type i3lock >/dev/null 2>&1
RETVAL=$?
if ! [[ "$RETVAL" == 0 ]]; then
type light-locker >/dev/null 2>&1
RETVAL=$?
if ! [[ "$RETVAL" == 0 ]]; then
type xscreensaver >/dev/null 2>&1
RETVAL=$?
if ! [[ "$RETVAL" == 0 ]]; then
vslo_main=$(yad --title="$vslo_ttle" --class="$vslo_clas" --window-icon="$vslo_wico" --undecorated --skip-taskbar --center --fixed --on-top --buttons-layout=spread --button="Cancel!$void_icon!Cancel Logout of Void Linux:2" --button="Logout!$vslo_bute!Logout of VSIDO:3" --button="Suspend!$vslo_buts!Suspend VSIDO:4" --button="Reboot!$vslo_butr!Reboot VSIDO:5" --button="Shutdown!$vslo_butq!Shutdown VSIDO:6")
fi
fi
fi
fi
fi
vslo_main=$(yad --title="$vslo_ttle" --class="$vslo_clas" --window-icon="$vslo_wico" --undecorated --skip-taskbar --center --fixed --on-top --buttons-layout=spread --button="Cancel!$void_icon!Cancel Logout of Void Linux:2" --button="Logout!$vslo_bute!Logout of VSIDO:3" --button="Lock Screen!$vslo_butl!Lock the screen:4" --button="Suspend!$vslo_buts!Suspend VSIDO:5" --button="Reboot!$vslo_butr!Reboot VSIDO:6" --button="Shutdown!$vslo_butq!Shutdown VSIDO:7")
vslo_main=$?
case "$vslo_main" in
1)
exit 1
;;
2)
SIGUSR1
exit 1
;;
3)
id_of_session=$(loginctl session-status | head -n 1 | awk '{print $1}')
loginctl terminate-session "$id_of_session"
exit 0
;;
4)
type dm-tool >/dev/null 2>&1
RETVAL=$?
if [[ "$RETVAL" == 0 ]]; then
dm-tool lock
exit 0
fi
type slock >/dev/null 2>&1
RETVAL=$?
if [[ "$RETVAL" == 0 ]]; then
slock
exit 0
fi
type i3lock >/dev/null 2>&1
RETVAL=$?
if [[ "$RETVAL" == 0 ]]; then
i3lock
exit 0
fi
type light-locker >/dev/null 2>&1
RETVAL=$?
if [[ "$RETVAL" == 0 ]]; then
light-locker-command -l
exit 0
fi
type xscreensaver >/dev/null 2>&1
RETVAL=$?
if [[ "$RETVAL" == 0 ]]; then
xscrsav=$(which xscreensaver)
active_xscrsav=$(pidof "$xscrsav")
if [[ -z "$active_xscrsav" ]]; then
xscreensaver -no-splash &
sleep 1
xscreensaver-command -lock
exit 0
else
xscrsav_user=$(ps aux | grep xscreensaver | grep -v grep | grep "$active_xscrsav" | awk '{print $1}')
su "$xscrsav_user" -c 'xscreensaver-command -lock'
exit 0
fi
fi
;;
5)
systemctl suspend
exit 0
;;
6)
systemctl reboot
exit 0
;;
7)
systemctl poweroff
exit 0
;;
130)
exit 1
;;
252)
exit 1
;;
esac
}
while :
do
vslo_menu
done


I ported this over to Void rather easily, so Ozi should be able to fix it up for his non-systemd disto easy enough. To that end, it probably needs the GPL preamble attached to it and author credits.

I checked iot with the default dark theme, still legible.
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

VastOne

#52
This is a cleaned up version of V2 that hakerdefo created that has all the buttons and no icons and a cancel.. I also changed the title

Looks like this - Plain Jane Version - 34 Lines of code with 821 characters and all functional - A thing of beauty IMO thank you hakerdefo!



and this is the code

#!/usr/bin/env bash
vslo_menu (){
vslo_ttle="What would you like to do?"
vslo_clas="$vslo_ttle"
vslo_wico="/usr/share/icons/icon.png"
vslo_main=$(yad --title="$vslo_ttle" --class="$vslo_clas" --window-icon="$vslo_wico" --width="543" --height="45" --center --fixed --on-top --buttons-layout=center  --button="Cancel!! Cancel:1" --button="Logout!$vslo_bute!Logout of VSIDO:2" --button="Suspend!$vslo_buts!Suspend VSIDO:3" --button="Reboot!$vslo_butr!Reboot VSIDO:4" --button="Shutdown!$vslo_butq!Shutdown VSIDO:5")
vslo_main=$?
case "$vslo_main" in
1 | 252)
exit 1
;;
2)
id_of_session=$(loginctl session-status | head -n 1 | awk '{print $1}')
loginctl terminate-session "$id_of_session"
exit 0
;;
3)
systemctl suspend
exit 0
;;
4)
systemctl reboot
exit 0
;;
5)
systemctl poweroff
exit 0
;;
esac
}
while :
do
vslo_menu
done


This is now the default for VSIDO

Attached is also the icon used that supports this line "/usr/share/icons/icon.png"

Just save it to /usr/share/icons/
VSIDO      VSIDO Change Blog    

    I dev VSIDO

ozitraveller

Looks good, just need to build yad for debian jessie.

Awesome!

:)

Ozi

hakerdefo

#54
V4 is here.
A bit of a preamble.
In this particular thread at times there arose some dark clouds and some "lost-in-translation" moments.
I'll quote The Animas,

Quote
Baby, do you understand me now?
Sometimes I feel a little mad
But don't you know that no one alive can always be an angel
When things go wrong I feel real bad
I'm just a soul whose intentions are good
Oh Lord, please don't let me be misunderstood

In democracy majority rules.
So on popular mandate I present the V4

Please follow this steps even if you have installed previous versions cause a few things have changed so better start a fresh.
Download the attached vsido-logout.tar.gz archive.
Extract its contents into a directory.
Open that directory in a terminal emulator.
Run following commands,


sudo cp vsido-logout /usr/local/bin/
sudo chmod 755 /usr/local/bin/vsido-logout

sudo cp vsido-logout.desktop /usr/share/applications/
sudo chmod 644 /usr/share/applications/vsido-logout.desktop

sudo cp logout_window_big.png logout_window_small.png vsido-logout.svg /usr/share/pixmaps/


This version will use one of the following as a lock-screen helper if installed. It will pick the first one available.


xtrlock
lightdm
suckless-tools
i3lock
light-locker
xscreensaver


TIP:- Use xtrlock if possible as it is the most secure among the above.

I think this could very well be the release version if the members find it satisfactory.

Cheers!!!
You Can't Always Git What You Want

ozitraveller

Works for me on jessie too!  Backported yad from testing.

Looks great!

Thanks hakerdefo!

Ozi

PackRat

^ which window managers did you try it with Ozi?

I know it works with spectrwm, I'm curious if it works with dwm. Did you try it with your dwm build?
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

ozitraveller

#57
Jwm.  I did a quick build this morning before work.

hakerdefo

Quote from: ozitraveller on February 02, 2017, 09:09:25 PM
Works for me on jessie too!  Backported yad from testing.

Looks great!

Thanks hakerdefo!

Ozi
Whenever you get a pat on the back from someone like @ozitraveller, it makes your day :)
I would again thank @PackRat for the help and support on this :)
Still got a suggestion or a feature request?
Keep them coming. They are always welcome :)
This is perhaps the first logout-manager tool that takes advantage of systemd without relying on anything else. Great for light-weight distros-systems. Soon moving this to GitHub on a request or two. Some new features, an installer and as @PackRat mentioned, a licence so that the interested parties (at this moment a Debian testing based and an Arch based distro) can include it in their projects.
Cheers!!!
You Can't Always Git What You Want

Snap

#59
About testing it. Thanks so much for your effort, hackerdefo.

Just one question. The "locker" part needs suckless-tools (if going that route instead of the other locker options), or more specifically slock, But IIRC suckless-tools is a Debian only package (maybe Ubuntu too. Not sure).  For most other distros the suckless stuff are independent packages. Shouldn't slock be specifically mentioned in some way into the "dependencies" group or whatever they are called in this case?

I point this out because If an user decides to go with any different patched dmenu version than vanilla, which is quite common amongst Debian users (and usually my case too), suckless-tools is not an option because of that other independent dmenu package, and slock (or any other suckless tools bit) must be installed separately from source.