VSIDO Community

VSIDO Support => Scripts and How To's => Scripts => Topic started by: hakerdefo on January 29, 2017, 01:37:09 PM

Title: vsido-exit (systemd based logout script for VSIDO)
Post by: hakerdefo on January 29, 2017, 01:37:09 PM

Edit Begins - 10-02-2017

Development continues on GitHub. For always up-to-date version of this (now known as lepo-logout) visit the GitHub page,

lepo-logout on GitHub (https://github.com/hakerdefo/lepo-logout)

Cheers!!!

Edit Ends - 10-02-2017


First VSIDO's default "~/.fluxbox/init" will need a slight modification,
Open it,
Code: [Select]
medit ~/.fluxbox/init

And change the following line,
Code: [Select]
session.screen0.allowRemoteActions: false

To,
Code: [Select]
session.screen0.allowRemoteActions: true

Save the file. Logout and login or restart fluxbox.

Add an extra package if it's not installed,
Code: [Select]
sudo apt-get install hicolor-icon-theme

Next Download the attached exit-vsido.tar.gz (http://vsido.org/index.php?action=dlattach;topic=1273.0;attach=468) archive. Extract the contents of archive into a directory and open that directory in terminal-emulator and run the following commands,
Code: [Select]
sudo cp vsido-exit /usr/local/bin/
Code: [Select]
sudo chmod 755 /usr/local/bin/vsido-exit
Code: [Select]
sudo cp logout_exit.png logout_logo.png logout_reboot.png logout_shutdown.png logout_suspend.png logout_window.png /usr/share/pixmaps/

Add a menu entry for vsido-exit. Test it  :)

Cheers!!!
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: PackRat on January 29, 2017, 05:09:48 PM
Code: [Select]
sudo cp vsido-exit /usr/local/bin/
Probably want to give it a different name, and/or back up the original vsido-exit in case this script has some bugs.

Code: [Select]
fluxbox-remote exit
The "Logout" option will only work with fluxbox, something like "pkill x" will be window-manager agnostic.
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: hakerdefo on January 29, 2017, 06:49:53 PM
...The "Logout" option will only work with fluxbox...
If a user adds extra DE or WM then it becomes his-her task to know howto logout of that DE-WM.
If we want to do that then we will require a session-manager to be installed and that would mean extra dependencies and complications.
And "vsido-exit" won't even be visible in other DE-WM. Remember it's a menu item visible only in Fluxbox menu ;)
And you can't manage beforehand what a user might decide do with his-her VSIDO install. We should only care about Fluxbox and other VSIDO defaults.
Just my two cents :)
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: PackRat on January 29, 2017, 07:39:50 PM
Everything works on my system.

Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: hakerdefo on January 29, 2017, 07:45:53 PM
Everything works on my system.
That's great!
Now RatMan please check-out your VSIDO forum inbox. Need your help :)
Cheers!!!
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: PackRat on January 29, 2017, 09:09:40 PM
^ I saw that. Can get to it tomorrow.

One other item. The "Suspend" worked, but I could just resume (this is a desktop, not a laptop) when I hit "Enter". Can that command be set up to prompt for user password?

I just changed the command to "slock" (part of the suckless-tools) in the script and that worked - but obviously not suspend, some added security for those that want it.
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: VastOne on January 29, 2017, 11:34:16 PM
CAN WE PLEASE NOT USE PM TO DISCUSS TECH ANSWERS and SOLUTIONS!!!!!

Too many people miss out!
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: VastOne on January 29, 2017, 11:51:48 PM
Have not tested functionality yet... only a look at how it looks

The first image is what hakerdefo created .. the logo you see is not centered

(https://i.imgur.com/lczCBTAm.png) (https://i.imgur.com/lczCBTA)

This is the image I prefer to be the logo image.. this really shows the image is not centered

(https://i.imgur.com/n6TJkyUm.png) (https://i.imgur.com/n6TJkyU)

Stellar work as usual hakerdefo... you and RatMan are certainly working out the technical side

pmss delivered scrots!
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: VastOne on January 29, 2017, 11:58:39 PM
I have tested everything except suspend and it all works perfectly..

Great Work!

As soon as the image centering is fixed and confirmation on suspend works I will add this as the new logout / exit script in VSIDO
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: PackRat on January 30, 2017, 12:49:34 AM
As soon as the image centering is fixed and confirmation on suspend works I will add this as the new logout / exit script in VSIDO

I think the suspend is working. The monitor blanks and loses signal. Not sure if there is an actual powerdown of the computer. Someone with VSIDO on a laptop can confirm that.

As far as having the user issue their password to resume, the proper sysremd way to do that may be to write suspend.service and resume.service files - Arch Wiki systemd power management. (https://wiki.archlinux.org/index.php/Power_management#Suspend.2Fresume_service_files)
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: Snap on January 30, 2017, 08:51:05 AM
Huh, the exit script is significantly smaller than the usual ck/python version. Good job, hackerdefo. It's nice when you see small scripts doing big jobs.

BTW; hicolor is in the default Vsido-lite packages (at least in the 24jan2017 test iso), so nothing extra to install.
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: PackRat on January 30, 2017, 01:45:31 PM
Everything works on my system.
That's great!
Now RatMan please check-out your VSIDO forum inbox. Need your help :)
Cheers!!!

Code: [Select]
loginctl session-status | head -n 1 | awk '{print $1}'

gives a number - which changes with each log in (7, 12)

plugging the number into $output of:

Code: [Select]
loginctl terminate-session $output
terminates the X-session and returns to lightdm login screen; I can log back in.

running:

Code: [Select]
loginctl terminate-session "$XDG_SESSION_ID"
termintes the X-session and returns to lightdm login screen; I can log back in.

running:

Code: [Select]
systemctl --user exit
gives the error message:

Code: [Select]
Failed to start exit.target: Process org.freedesktop.systemd1 exited with status 1
See user logs and 'systemctl --user status exit.target' for details.
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: hakerdefo on January 30, 2017, 03:20:33 PM
vsido-exit V2 is here. Thanks PackRat for inspiring me to write a DE-WM agnostic logout option. You are the man my friend  8)
Hopefully this will resolve the image scaling problem mentioned by VastOne  :)
Here are the steps to install this thing.
First download the attached exit-vsido.tar.gz (http://vsido.org/index.php?action=dlattach;topic=1273.0;attach=469) archive.
Next extract the contents into a directory.
Now open that directory in a terminal-emulator. And run the following commands.

Code: [Select]
sudo cp vsido-exit /usr/local/bin/
Code: [Select]
sudo chmod 755 /usr/local/bin/vsido-exit

Code: [Select]
sudo cp vs-session-manager.desktop /usr/share/applications/

Code: [Select]
sudo cp logout_exit.png logout_logo.png logout_reboot.png logout_shutdown.png logout_suspend.png logout_window.png vs-session-manager.png /usr/share/pixmaps/

You can manually add an entry for "vsido-exit" in Fluxbox menu.
It will also autometically show as "vs-session-manager" in the main menu of any other freedesktop.org compliant DE or WM.

Test It. Feedback welcome  8)

Cheers!!!
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: VastOne on January 30, 2017, 03:36:30 PM
It was not about scale, it was about centering ... it can be smaller for sure and it still did not center

(https://i.imgur.com/BJ5AjYrm.png) (https://i.imgur.com/BJ5AjYr)

(https://i.imgur.com/pIxcM9Ym.png) (https://i.imgur.com/pIxcM9Y)

For everything else it looks great

Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: VastOne on January 30, 2017, 03:37:18 PM
Huh, the exit script is significantly smaller than the usual ck/python version. Good job, hackerdefo. It's nice when you see small scripts doing big jobs.

BTW; hicolor is in the default Vsido-lite packages (at least in the 24jan2017 test iso), so nothing extra to install.


Yes snap you are correct... hicolor is a default in VSIDO
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: PackRat on January 30, 2017, 04:42:29 PM
with version 2 -

I can log out from fluxbox and spectrwm, and then log back into either.
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: hakerdefo on January 30, 2017, 04:53:15 PM
@PackRat Does the centering problem that VastOne mentioned appear on your system?
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: PackRat on January 30, 2017, 05:11:21 PM
It's centered, but it's not showing as the orb that vastone wants as the logo.
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: VastOne on January 30, 2017, 05:15:07 PM
I know it is not centered..  On my 32 inch screen where sizes are much larger it is very clear it is NOT centered..  Ask yourself this,  how can one be centered and the other is not using the same exact code but a different image?
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: hakerdefo on January 30, 2017, 05:19:58 PM
The orb is far too small and YAD will allign image to the left. There is no option to center the image. All you can do is make an image that fits the created window.
And why it is not centering at Vasty's end? Your screen resolution VastOne?
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: VastOne on January 30, 2017, 05:29:52 PM
My resolution is 1920x1200 and is not the issue...

If text will center but an image will not, lets use text.. if text and an image will not center then both images and text should not be used

Possibly a solid line could be used to separate or just nothing at all..
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: PackRat on January 30, 2017, 05:39:18 PM
I know it is not centered..  On my 32 inch screen where sizes are much larger it is very clear it is NOT centered..  Ask yourself this,  how can one be centered and the other is not using the same exact code but a different image?

this is how I see it at 3 different resolutions:

(https://i.imgur.com/YOlatFqm.png) (https://i.imgur.com/YOlatFq)

I don't know why you're seeing a shift to the left.


Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: PackRat on January 30, 2017, 05:40:23 PM
The orb is far too small and YAD will allign image to the left. There is no option to center the image. All you can do is make an image that fits the created window.
And why it is not centering at Vasty's end? Your screen resolution VastOne?

You can change the canvas size in gimp and have the image centered; but the image is too small to get a larger size in focus.

(https://i.imgur.com/laYZ2Ncm.png) (https://i.imgur.com/laYZ2Nc)
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: hakerdefo on January 30, 2017, 05:48:02 PM
@PackRat Someone with a bit of Gimp'ing talent can create an empty transparent canvas of around 550 x 225 and put the VSIDO orb on top of it and merge the layers. The resulting image then can be manipulated into YAD window.
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: VastOne on January 30, 2017, 05:50:28 PM
Using the same code seems impossible that one is centered and one is not

How large in inches is the size of the logout popup on your screen?

On mine it is a full 7.5 inches wide.. this is it in full reference

(https://i.imgur.com/pPgTGnlm.png) (https://i.imgur.com/pPgTGnl)

I digress though.. there is no need for an image. The current has never had an image and has worked fine. That suits me fine
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: VastOne on January 30, 2017, 05:58:12 PM
Here it is without an image.. I removed the image line and reduced the height from 275 to 75

Looks great

(https://i.imgur.com/cEBUfTum.png) (https://i.imgur.com/cEBUfTu)
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: VastOne on January 30, 2017, 06:00:37 PM
Also, in the original there was a Cancel button.. I think that it is important to keep a cancel button
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: hakerdefo on January 30, 2017, 06:46:17 PM
It's about midnight here and I got to go now so V3 will have to wait till tomorrow. In the meantime please keep testing V2 and post suggestions-problems that you would like to be addressed in V3.
Cheers!!!
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: VastOne on January 30, 2017, 06:54:05 PM
Just for testing I threw it all up on a big 65 inch screen ...  :D ??? ::)

(http://en.zimagez.com/miniature/img20170130124317.jpg) (http://en.zimagez.com/zimage/img20170130124317.php)
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: PackRat on January 30, 2017, 07:11:54 PM
Also, in the original there was a Cancel button.. I think that it is important to keep a cancel button

+1
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: PackRat on January 30, 2017, 08:12:31 PM
Quote
Using the same code seems impossible that one is centered and one is not

I don't understand that either. As a wild guess, I tried a bunch of different gtk themes in case there is something broken there; no changes.

Quote
How large in inches is the size of the logout popup on your screen?

It's the 543x275 pixels as specified by the yad script; approximately 7.5 x 4 inches (gimp print size).

Remembered there is a larger image in the ~/images -

(https://i.imgur.com/bpSGFsVm.png) (https://i.imgur.com/bpSGFsV)
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: ozitraveller on January 30, 2017, 08:37:07 PM
Would this dialog normally need to be maximised or minimised? I fact, would it need a title either?

Just my 2 cents. :)
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: VastOne on January 30, 2017, 09:35:24 PM
The old one did not and I think plain Jane is quite nice.. :D
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: ozitraveller on January 30, 2017, 09:56:13 PM
I quite like plain Jane!  ;D
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: PackRat on January 31, 2017, 01:24:43 AM
version #2:

Code: [Select]
#!/usr/bin/env bash
vslo_menu (){
vslo_ttle="vs-session-manager"
vslo_clas="$vslo_ttl"
vslo_wico="/usr/share/pixmaps/logout_window.png"
vslo_logo="/usr/share/pixmaps/logout_logo.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"
vslo_main=$(yad --title="$vslo_ttle" --class="$vslo_clas" --window-icon="$vslo_wico" --width="543" --height="275" --image="$vslo_logo" --center --fixed --on-top --buttons-layout=center --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=$?

Is that a typo on line 4? Should it read:

Code: [Select]
vslo_clas="$vslo_ttle"
to match line #3 so that the class name will be "vs-session-manager"
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: VastOne on January 31, 2017, 02:02:39 AM
@PackRat Someone with a bit of Gimp'ing talent can create an empty transparent canvas of around 550 x 225 and put the VSIDO orb on top of it and merge the layers. The resulting image then can be manipulated into YAD window.

The first one is the requested size of 550x225

The second one is 675 x 200 to accommodate for a fifth (Cancel) button

The third one is 675 x 225 for consistency.. I think 200 height will be fine but we shall see
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: 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
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: Snap on January 31, 2017, 08:21:17 AM
^ Agreed. I like it plain too.
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: Snap on January 31, 2017, 09:55:27 AM
I like this even better ;)

(http://en.zimagez.com/full/5bec6bb57c96db2c817defaa1cf6b75421f994cbed3636a26924c0fb25bf0a9d6ee9081ac8e5c777bdfa1d3105585330454207c0ecb31960.php)
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: hakerdefo on January 31, 2017, 11:01:45 AM
@Snap I don't know french so I'll take it as a joke ;)
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: hakerdefo on January 31, 2017, 11:08:53 AM
The more and more I search about images and yad the more I think they do not coexist well at all

Code: [Select]
man yad | grep "image"

Quote
Set the dialog image which appears on the left side of dialog. IMAGE might be file name or icon name from current icon theme.

As I already said in one of my previous posts yad always allign image on the left side of dialog.
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: hakerdefo on January 31, 2017, 11:14:19 AM
Is that a typo on line 4?
RatMan as I keep repeating in this forum you are the man!
That is a typo! Thanks for the pointer!
Cheers!!!
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: hakerdefo on January 31, 2017, 11:19:59 AM
Would this dialog normally need to be maximised or minimised? I fact, would it need a title either?

Just my 2 cents. :)
Hi there mate,
The titlebar is necessary as it provides the 'cancel' option via the close button. And perhaps you didn't try the script otherwise you would have noticed the window is fixed-size. It wouldn't maximize. In a good window manager theme the maximize button would remain hidden or disabled.
Just my two cents ;)
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: PackRat on January 31, 2017, 02:22:57 PM
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

You mean like this?

(http://en.zimagez.com/miniature/slim-exit.png) (http://en.zimagez.com/zimage/slim-exit.php)

I didn't see a "border only" type option for yad in the man page so you can put this in the ~/.fluxbox/apps

Code: [Select]
[app] (name=yad) (class=vs-session-manager)
  [Shaded] {no}
  [Deco] {BORDER}       # change {BORDER} to {0x627} for titlebar, borders, close button only
  [Minimized] {no}
  [Maximized] {no}
  [Fullscreen] {no}
  [Layer] {2}
  [Alpha] {255}
[end]
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: hakerdefo on January 31, 2017, 08:48:56 PM
Here is V3 as promised. A new feature and new icons  8)
What is the new feature? "Screen Lock" is the new feature.
It allows you to quickly lock your session when need be.
This option will only be visible in the dialog if you have any one of the following installed,
Code: [Select]
lightdm
suckless-tools
i3lock
light-locker
xscreensaver

The script will prefer the "Screen Lock" helper application in the above order.
If none of the above is installed the "Screen Lock" button won't appear in the dialog menu.

I have decided to rename the script to "vs-session-manager" to avoid any conflict with the current "vsido-exit" script.

So here is how to install V3,
Download the attached vs-session-manager.tar.gz (http://vsido.org/index.php?action=dlattach;topic=1273.0;attach=476) archive. Extract its contents into a directory.
Open that directory in terminal emulator.
Run the following commands,

Code: [Select]
sudo cp vs-session-manager /usr/local/bin/
Code: [Select]
sudo chmod 755 /usr/local/bin/vs-session-manager

Code: [Select]
sudo cp vs-session-manager.desktop /usr/share/applications/
Code: [Select]
sudo chmod 644 /usr/share/applications/vs-session-manager.desktop

Code: [Select]
sudo cp logout_exit.png logout_lock.png logout_reboot.png logout_shutdown.png logout_suspend.png vs-session-manager.svg /usr/share/pixmaps/

You can manually add an entry for "vs-session-manager" in Fluxbox menu.
It will autometically show as "vs-session-manager" in the main menu of any freedesktop.org compliant DE or WM.

Feedback welcome  :)

Here is a scrot of "vs-session-manager" in action,

(http://i.imgur.com/Lu3BEhm.png) (http://imgur.com/Lu3BEhm)

Cheers!!!
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: Snap on February 01, 2017, 05:27:25 AM
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.
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: hakerdefo on February 01, 2017, 08:52:57 AM
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!!!
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: VastOne on February 01, 2017, 03:23:09 PM
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
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: hakerdefo on February 01, 2017, 06:42:23 PM
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!!!
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: PackRat on February 02, 2017, 12:43:14 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 -

(http://en.zimagez.com/miniature/scrot-shot-wed11485995835.jpg) (http://en.zimagez.com/zimage/scrot-shot-wed11485995835.php)

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.
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: VastOne on February 02, 2017, 12:55:38 AM
@PackRat
 
That's perfect.. beam up the code Scotty, please...   8)
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: PackRat on February 02, 2017, 02:20:16 AM
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".

Code: [Select]
#!/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.
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: VastOne on February 02, 2017, 02:54:20 AM
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!

(https://i.imgur.com/HPI6IePm.png) (https://i.imgur.com/HPI6IeP)

and this is the code

Code: [Select]
#!/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/
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: ozitraveller on February 02, 2017, 03:31:46 AM
Looks good, just need to build yad for debian jessie.

Awesome!

:)

Ozi
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: hakerdefo on February 02, 2017, 04:07:09 PM
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 (http://vsido.org/index.php?action=dlattach;topic=1273.0;attach=477) archive.
Extract its contents into a directory.
Open that directory in a terminal emulator.
Run following commands,

Code: [Select]
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.

Code: [Select]
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!!!
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: ozitraveller on February 02, 2017, 09:09:25 PM
Works for me on jessie too!  Backported yad from testing.

Looks great!

Thanks hakerdefo!

Ozi
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: PackRat on February 02, 2017, 11:44:31 PM
^ 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?
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: ozitraveller on February 03, 2017, 03:23:07 AM
Jwm.  I did a quick build this morning before work.
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: hakerdefo on February 03, 2017, 06:09:05 AM
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!!!
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: Snap on February 03, 2017, 07:54:54 AM
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.
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: hakerdefo on February 03, 2017, 09:03:50 AM
Hi there Snap,
Thanks for the feedback. As I mentioned in my previous post I'll shortly be moving this over to GitHub and there I'll update the instruction on screen-lock helpers to reflect your suggestion.
Cheers!!!
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: PackRat on February 03, 2017, 02:02:42 PM
Quote
I know it works with spectrwm, I'm curious if it works with dwm. Did you try it with your dwm build?

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

I installed dwm, the script works as intended; good deal, dwm doesn't always work well with session management tools.
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: hakerdefo on February 03, 2017, 07:56:04 PM
Quote
I know it works with spectrwm, I'm curious if it works with dwm. Did you try it with your dwm build?

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

I installed dwm, the script works as intended; good deal, dwm doesn't always work well with session management tools.

That's fantabulous  8)

I would again say this script wouldn't have been possible without PackRat.
It was his idea (Remember, he started the thread at code challenge).
And when I was happy and content with,
Code: [Select]
fluxbox-remote exitfor logout, it was PackRat who pushed me further  8)
And not to forget all the testing he has done  8)
Thanks a metric ton PackRat  :)

Cheers!!!
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: PackRat on February 04, 2017, 03:50:38 PM
^ thanks, nice work writing the script.

Some simple tweaking - a bit of over-engineering for a script like this, but I wanted some practice.

Two changes:

the logout command is now:

Code: [Select]
loginctl terminate-session "$XDG_SESSION_ID
so no more parsing through awk. And the commands are now set up as variables so all a user/administrator has to do is change the variable to whatever custom command they want to use.

Code: [Select]
#!/usr/bin/env bash

LOGOUT="loginctl terminate-session "$XDG_SESSION_ID""
SUSPEND="systemctl suspend"
REBOOT="systemctl reboot"
POWEROFF="systemctl poweroff"

vslo_menu (){
vslo_ttle="vsido-logout"
vslo_clas="$vslo_ttle"
vslo_wico="/usr/share/pixmaps/logout_window_small.png"
vslo_wico_big="/usr/share/pixmaps/logout_window_big.png"
type xtrlock >/dev/null 2>&1
RETVAL=$?
if ! [[ "$RETVAL" == 0 ]]; then
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 --class="$vslo_clas" --title="$vslo_ttle" --window-icon="$vslo_wico" --center --fixed --on-top --buttons-layout=center --button="Cancel!!Cancel:1" --button="Logout!!Logout of VSIDO:3" --button="Suspend!!Suspend VSIDO:4" --button="Reboot!!Reboot VSIDO:5" --button="Shutdown!!Shutdown VSIDO:6")
fi
fi
fi
fi
fi
fi
vslo_main=$(yad --class="$vslo_clas" --title="$vslo_ttle" --window-icon="$vslo_wico" --center --fixed --on-top --buttons-layout=center --button="Cancel!!Cancel:1" --button="Lock Screen!!Lock the screen:2" --button="Logout!!Logout of VSIDO:3" --button="Suspend!!Suspend VSIDO:4" --button="Reboot!!Reboot VSIDO:5" --button="Shutdown!!Shutdown VSIDO:6")
vslo_main=$?
case "$vslo_main" in
1)
exit 1
;;
2)
type xtrlock >/dev/null 2>&1
RETVAL=$?
if [[ "$RETVAL" == 0 ]]; then
xtrlock -b
exit 0
fi
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
fi
fi
xscrsav_user=$(ps -p "$active_xscrsav" -o ruser=)
xscrsav_user_id=$(id -u "$xscrsav_user")
current_user_id=$(id -u)
if [[ "$xscrsav_user_id" == "$current_user_id" ]]; then
xscreensaver-command -lock
exit 0
fi
if [[ "$current_user_id" == 0 ]]; then
su "$xscrsav_user" -c "xscreensaver-command -lock"
exit 0
fi
yad --title="$vslo_ttle" --class="$vslo_clas" --window-icon="$vslo_wico" --borders=20 --center --fixed --image="$vslo_wico_big" --on-top --button=gtk-ok --text="xscreensaver was started by another user.\nso current user can't use the lock function.\nauto-start xscreensaver with your session.\n"
exit 0
;;
3)
$LOGOUT
exit 0
;;
4)
$SUSPEND
exit 0
;;
5)
$REBOOT
exit 0
;;
6)
$POWEROFF
exit 0
;;
130)
exit 1
;;
252)
exit 1
;;
esac
}
while :
do
vslo_menu
done

@hackerdefo - or anyone that likes to see the icons in the dialog box, I shrank the icons to 22x22 and think it looks better. The icons do not overpower the text in the dialog box.
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: hakerdefo on February 04, 2017, 05:17:39 PM
Thanks for the ideas PackRat. Assigning commands to variables can make editing the script easy. And I'm in the process of updating the script so these suggestions will be implemented in the new version.
Cheers!!!
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: ozitraveller on February 06, 2017, 05:41:06 AM
I just have one small comment to make:

Code: [Select]
130)
exit 1
;;
252)
exit 1
;;

Could we have a comment or variable to indicate what 130 and 252 mean, my memory isn't what it used to be.

:)

Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: PackRat on February 06, 2017, 02:16:42 PM
I think 130 is Script Terminated by CTL-c (http://www.tldp.org/LDP/abs/html/exitcodes.html#EXITCODESREF) - which I think a user would only see if the script is run from a terminal and CTL-c issued when the terminal - not the dialog box - has focus. That stanza may be superfluous.

I think 252 is so the close button will function if a user leaves the dialog window decorated. Can't verify that one though.
Edit - sort of verified it. Comment out that sections and the close button no longer functions.
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: jedi on February 06, 2017, 08:49:44 PM
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!

(https://i.imgur.com/HPI6IePm.png) (https://i.imgur.com/HPI6IeP)

This is now the default for VSIDO

Very Nice VastOne!!!  Just added love the looks of it.  Small is nice!  Works as advertised.  Thanks to everyone who worked on this...
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: ozitraveller on February 07, 2017, 12:23:19 AM
I think 130 is Script Terminated by CTL-c (http://www.tldp.org/LDP/abs/html/exitcodes.html#EXITCODESREF) - which I think a user would only see if the script is run from a terminal and CTL-c issued when the terminal - not the dialog box - has focus. That stanza may be superfluous.

I think 252 is so the close button will function if a user leaves the dialog window decorated. Can't verify that one though.
Edit - sort of verified it. Comment out that sections and the close button no longer functions.

Thanks PackRat!
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: hakerdefo on February 09, 2017, 08:29:29 PM
It is released to the public  8)

It is now known as lepo-logout  ;D

Many things have been improved  :)

Here is the link to the GitHub repo,

lepo-logout on GitHub (https://github.com/hakerdefo/lepo-logout)

Cheers!!!
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: PackRat on February 10, 2017, 03:23:47 PM
Many things have been improved  :)

Care to elaborate? There a changelog somewhere.

It works - well done. Just did a quick proof read. Looks like the big change are the yad boxes (?) asking for a password if a user needs use sudo to shutdown or reboot.
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: hakerdefo on February 10, 2017, 10:17:06 PM
It now better handles inhibition locks. Avoid them when it can and ask when it can't.
It also handles multiuser scenario a bit better. root or superuser can reboot-shutdown evenif other users are logged in.
It can now reboot-shutdown system even without polkit.
Many improvements, wouldn't you agree?
Cheers!!!
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: PackRat on March 04, 2018, 07:28:16 PM
Was cleaning up some other scripts so went ahead and added hibernate to the vsido-exit script should anyone want that. Haven't tested it, my harddrive with VSIDO bought the farm; should work though, standard systemctl command.

(https://s17.postimg.org/4vw58ig7f/vsido-exit_shot.png) (https://postimg.org/image/4vw58ig7f/)

Code: [Select]
#!/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="648" --height="48" --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="Hibernate!$vslo_buts!Hibernate VSIDO:4" --button="Reboot!$vslo_butr!Reboot VSIDO:5" --button="Shutdown!$vslo_butq!Shutdown VSIDO:6")
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 hibernate
exit 0
;;
5)
systemctl reboot
exit 0
;;
6)
systemctl poweroff
exit 0
;;
esac
}
while :
do
vslo_menu
done
Title: Re: vsido-exit (systemd based logout script for VSIDO)
Post by: PackRat on April 11, 2018, 12:19:19 AM
Was bored, reworked the session exit script to vertical:

Code: [Select]
#!/bin/sh

yad --form --class=VsidoExit --width=165 --borders=5 --height=320 --undecorated --skip-taskbar --image=/home/doug/temp/vsido.png --image-on-top --center \
--field="  Log Out!gnome-logout!Log Out":fbtn "pkill `wmctrl -m | awk '/Name/ {print tolower($2)}'`" \
--field="  Hibernate!gnome-session-hibernate!Hibernate":fbtn "systemctl hybernate" \
--field="  Suspend!gnome-session-suspend!Suspend":fbtn "systemctl suspend" \
--field="  Restart!system-reboot!Restart":fbtn "systemctl reboot" \
--field="  Shut Down!gnome-shutdown!Shut Down":fbtn "systemctl poweroff" \
--button=gtk-cancel \

Cropped logo -