Close All (or Shutdown Script) ... How?

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
markfilipak
Level 6
Level 6
Posts: 1173
Joined: Sun Mar 10, 2013 8:08 pm
Location: Mansfield, Ohio

Close All (or Shutdown Script) ... How?

Post by markfilipak »

Preamble: Somehow this thread got renamed from "Close All (or Shutdown Script) ... How?" to "How to clear Xfce remembering the session at shutdown?". I did not change it, but I've now changed it back.

I'm trying to find a setting that closes all apps on every shutdown so that when I boot, nothing is running.

OR

I'm trying to create a shutdown script that closes all apps so that the next time I boot, nothing is running.

I've searched but could only find remote scripts for server shutdown or explanations that were so cryptic I couldn't understand them. There is a "Session and Startup" settings application of course, but it says
"Below is the list of applications that will be started
automatically when you login to your Xfce desktop, in addition
to the applications that were saved when you logged out last
time."
Well, you see, I don't want "in addition to the applications that were saved when you logged out last time." I don't want anything running.

Anyone got any ideas?

Thank You.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 3 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
xenopeek
Level 25
Level 25
Posts: 29507
Joined: Wed Jul 06, 2011 3:58 am

Re: Close All (or Shutdown Script) ... How?

Post by xenopeek »

There's no script needed for this; you just need to configure your preferences for saving sessions.

Open Session and Startup from your menu or from Settings Manager. Clear the "Automatic save session on logout" flag on the General tab. Click "Clear saved sessions" on the Session tab.

When you next shutdown or reboot your computer, or logout, make sure also there the "Save sessions for future logins" is cleared.
Image
markfilipak
Level 6
Level 6
Posts: 1173
Joined: Sun Mar 10, 2013 8:08 pm
Location: Mansfield, Ohio

Re: Close All (or Shutdown Script) ... How?

Post by markfilipak »

xenopeek wrote:Open Session and Startup from your menu or from Settings Manager. Clear the "Automatic save session on logout" flag on the General tab.
I already had that unset.
Click "Clear saved sessions" on the Session tab.
Done.

When I rebooted, all the above failed and I still had everything reopen that had been previously open.
When you next shutdown or reboot your computer, or logout, make sure also there the "Save sessions for future logins" is cleared.
Where is this setting?
User avatar
xenopeek
Level 25
Level 25
Posts: 29507
Joined: Wed Jul 06, 2011 3:58 am

Re: Close All (or Shutdown Script) ... How?

Post by xenopeek »

Depends. If you're using the Linux Mint 17 default Xfce menu (Whisker), it's right there in the shutdown/reboot/logout dialog.
Image
markfilipak
Level 6
Level 6
Posts: 1173
Joined: Sun Mar 10, 2013 8:08 pm
Location: Mansfield, Ohio

Re: Close All (or Shutdown Script) ... How?

Post by markfilipak »

xenopeek wrote:Depends. If you're using the Linux Mint 17 default Xfce menu (Whisker), it's right there in the shutdown/reboot/logout dialog.
"Shutdown/reboot/logout dialog"? Never seen one.
User avatar
xenopeek
Level 25
Level 25
Posts: 29507
Joined: Wed Jul 06, 2011 3:58 am

Re: Close All (or Shutdown Script) ... How?

Post by xenopeek »

Erm... The icon in the top right corner of the Whisker menu; the one looking like a power button...
Image
markfilipak
Level 6
Level 6
Posts: 1173
Joined: Sun Mar 10, 2013 8:08 pm
Location: Mansfield, Ohio

Re: Close All (or Shutdown Script) ... How?

Post by markfilipak »

Surfer - Whiskers Menu .png
xenopeek, my friend. I'm afraid you're going to have to point it out to me.
User avatar
xenopeek
Level 25
Level 25
Posts: 29507
Joined: Wed Jul 06, 2011 3:58 am

Re: Close All (or Shutdown Script) ... How?

Post by xenopeek »

Your menu looks different than mine... The bottom right icon. The circle with a dash through it on the right side.
Image
markfilipak
Level 6
Level 6
Posts: 1173
Joined: Sun Mar 10, 2013 8:08 pm
Location: Mansfield, Ohio

Re: Close All (or Shutdown Script) ... How?

Post by markfilipak »

That is a logout button that invokes '/usr/bin/xfce4-session-logout'. I don't use it. When clicked, it closes the current session, then displays a Login prompt that floats over a slide show of various nature scenes. There is no "Shutdown/reboot/logout dialog" associated with it.

What I seek is a method to automatically close all applications so that on next boot, there are no running applications. Alternatively, some means to simply suppress the launching of applications prior to me opening Whiskers would be acceptable.

The desired end result is that upon booting, Xfce comes up as a blank desktop. That way, I avoid a traffic jamb in which Firefox & Thunderbird jostle for the Internet (which usually causes Firefox to give up and post an error).

Thank You.
User avatar
xenopeek
Level 25
Level 25
Posts: 29507
Joined: Wed Jul 06, 2011 3:58 am

Re: Close All (or Shutdown Script) ... How?

Post by xenopeek »

I'm not that familiar with Whisker menu. That button triggers xfce4-session-logout here also. Perhaps you changed some other configuration related to this?

This is the default menu:
Image
And the shutdown dialog when you click on that icon in the top right:
Image
Image
markfilipak
Level 6
Level 6
Posts: 1173
Joined: Sun Mar 10, 2013 8:08 pm
Location: Mansfield, Ohio

Re: Close All (or Shutdown Script) ... How?

Post by markfilipak »

xenopeek,

If this were Windows, at this point I'd be editing the Registry and finding a way to uncheck "[_] Save session for future logins" without running the dialog. That of course assumes that the problem I'm having is related to "[_] Save session for future logins", which is not at all certain.

Isn't there a single place where this is set?

Thank You.

PS: I'll bet your task bar is at the bottom. Mine's along the left side, that's why my Whiskers Menu looks different to you.

Also, I'll bet your Mint is multi-user. That's why a menu is coming up when you logout.

Are these clues good enough? Is there a workaround for me?

Is there a way to provoke that dialog from Terminal?
markfilipak
Level 6
Level 6
Posts: 1173
Joined: Sun Mar 10, 2013 8:08 pm
Location: Mansfield, Ohio

Re: Close All (or Shutdown Script) ... How?

Post by markfilipak »

Hello All,

I've not found how to boot clean (that is, without any applications, specifically without the applications that were running when previously shut down).

So it appears the only way I'm going to be able to boot clean is to create a shutdown script that "Terminates" the running applications.

1, Where should the script be stored?
2, What scripting languages are accepted?
3, How do I bind the script to the shutdown process?
4, How do I get a list of the running applications?

What questions am I failing to ask?

Thank You.

PS: I've found some answers:

1, The script could be (would be) '/etc/rc6.d/K10applications'.
2, Maybe bash? -- somewhat depends on #4 I imagine.
3, See #1 above.
4, ?
Last edited by markfilipak on Mon Jan 26, 2015 12:45 am, edited 2 times in total.
markfilipak
Level 6
Level 6
Posts: 1173
Joined: Sun Mar 10, 2013 8:08 pm
Location: Mansfield, Ohio

Re: Close All (or Shutdown Script) ... How?

Post by markfilipak »

xenopeek wrote:I'm not that familiar with Whisker menu. That button triggers xfce4-session-logout here also. Perhaps you changed some other configuration related to this?
I have run every application & fiddled with every setting listed in the menu system. I have looked at everything listed in MenuLibre. I can find nothing that will force the shutdown dlalog you so kindly illustrated.
User avatar
xenopeek
Level 25
Level 25
Posts: 29507
Joined: Wed Jul 06, 2011 3:58 am

Re: Close All (or Shutdown Script) ... How?

Post by xenopeek »

Check whether the file /etc/xdg/xfce4/kiosk/kioskrc exists. If you're running in kiosk mode, certain things are more limited like the shutdown dialog.
Image
markfilipak
Level 6
Level 6
Posts: 1173
Joined: Sun Mar 10, 2013 8:08 pm
Location: Mansfield, Ohio

Re: Close All (or Shutdown Script) ... How?

Post by markfilipak »

xenopeek wrote:Check whether the file /etc/xdg/xfce4/kiosk/kioskrc exists.
The 'kiosk' directory doesn't exist.

Good try, XP. It would be nice if I knew where the missing setting is stored. The settings file is probably plain text (maybe XML).
Buzzsaw
Level 6
Level 6
Posts: 1318
Joined: Sat Aug 23, 2014 12:53 pm

Re: How to clear Xfce remembering the session at shutdown?

Post by Buzzsaw »

In your screenshot, there's a shutdown icon on the bottom-left.

Your problem might be caused by a bug. I had the same problem in Xubuntu 13.10. No matter what the settings were set to, it always remembered my running programs after it rebooted.
markfilipak
Level 6
Level 6
Posts: 1173
Joined: Sun Mar 10, 2013 8:08 pm
Location: Mansfield, Ohio

Re: How to clear Xfce remembering the session at shutdown?

Post by markfilipak »

Buzzsaw wrote:In your screenshot, there's a shutdown icon on the bottom-left.
Yes. I put it there. It shuts down immediately and without the Log out dialog that xenopeek shows here:
http://forums.linuxmint.com/viewtopic.p ... 35#p973785
Though I unset 2 or 3 settings that, by their names, implied they controlled whether open applications were remembered, XP thinks that the '[_] Save session for future logins' check box on the Log out dialog also needs to be cleared. The problem is: That dialog doesn't make an appearance -- it's a no-show.

The setting that controls whether the prior session is restored on log in must be stored in a file somewhere. If this was Windows, I'd look in the Windows Registry. But I don't know Linux architecture, so I don't know what the Linux equivalent(s) of the Windows Registry is (and apparently, no one else knows, either).
Buzzsaw wrote:Your problem might be caused by a bug. I had the same problem in Xubuntu 13.10. No matter what the settings were set to, it always remembered my running programs after it rebooted.
So, you couldn't find where the setting is stored either, eh?
raptir

Re: How to clear Xfce remembering the session at shutdown?

Post by raptir »

Under "Session and Startup" make sure "Prompt on logout" is checked. The description is not very clear but if you have it unchecked you will not be prompted to standy/reboot/logout when you click the power button.

http://docs.xfce.org/xfce/xfce4-session/preferences

Edit: To clarify, this would explain the behavior you see when you click on the logout button from Whisker Menu. When you have it unchecked, it will just log you out. When it is checked, you will see the prompt that xenopeek posted.
Habitual

Re: How to clear Xfce remembering the session at shutdown?

Post by Habitual »

you can also clean up the leftover stuff from saving those sessions by opening a terminal as yourself and running

Code: Select all

rm -fr ~/.cache/sessions
markfilipak
Level 6
Level 6
Posts: 1173
Joined: Sun Mar 10, 2013 8:08 pm
Location: Mansfield, Ohio

Re: Close All (or Shutdown Script) ... How?

Post by markfilipak »

I got Mint-Xfce to behave properly one time. Now it's misbehaving again. This is a very strange story...

As suggested by
raptir wrote:Under "Session and Startup" make sure "Prompt on logout" is checked...
this successfully exposed the 'Logout' dialog shown by xenopeek. However, the '[_] Save session for future logins' option was not set (and had never been set). However, just having that 'Logout' dialog open caused the system to behave as expected. That is, upon reboot the previous session's running applications did not reappear.

However, that worked only one time. In an attempt to determine whether the correct behavior was consistently associated with whether the 'Logout' dialog was enabled, I turned "Prompt on logout" on and off several times, rebooting in between, but I could not conclude anything because the system consistently misbehaved from then on.

I don't know if the following is related:
You all know about '/usr/bin/xfce4-session-logout'. Well, it is just for logout, not shutdown. I wanted to find other commands or scripts that had "session" in their name, so I performed a global filename search for "session", starting from '/'. Wait until you hear what happened...

I used GNOME Commander for the filename search. Things went fine for about 30 or 40 seconds and GC was finding files with names having "session" in them until GNOME Commander suddenly disappeared! The GNOME Commander window closed on its own initiative and without warning or error leaving me staring at the desktop.

Now when I attempt to perform any search using GNOME Commander, it immediately disappears. (That is, I fill in the "Search for" text box, then click the [Find] button and -- Poof! -- GNOME Commander immediately disappears.)

This story gets even stranger...
Now, when I startup Linux, no matter what was left open in the previous session, the new session opens with GNOME Commander running.

I didn't know that Linux could be so exciting.

PS (update): I deleted '~/.cache/sessions/*' as suggested and now when I reboot, though my system is still misbehaving, at least GNOME Commander is not running.
Locked

Return to “Xfce”