Xfce Forum

Sub domains
 

You are not logged in.

#1 2012-06-22 16:45:49

Digger
Member
Registered: 2012-01-18
Posts: 26
Website

Want to Run a Script Before Shutdown

Hello all,

I'm running Xfce 4.6.2 (Debian Squeeze (stable)).

If I want to shut down my desktop computer from the Xfce screen, I can call up the "Log out" dialog in one of two ways:

1. By calling up the Menu and clicking "Log Out".

2. By clicking on the log out icon on the panel.

In both cases, said action displays the "Log out" dialog, whereupon I am given the choice of five actions ("Log Out", "Restart", "Shut Down", "Suspend", or "Hibernate").

Here's what I am trying to do:  If I click "Shut Down", I'd like to have a dialog box pop up on the screen (I use zenity for this).  In my case, said dialog box would ask me a question.  If I answer "Yes", I'd like the machine to shut down.  If I answer "No", I'd like to exit the shutdown process altogether, so I can manually perform some required actions.

So, what I need to do is to figure out how to get the required script to run after I click the "Shut Down" button.

I've spent the better part of a morning researching how to do this and am still stumped!  The best lead I could find is here:

http://mail.xfce.org/pipermail/xfce/200 … 24843.html

However, I don't think this quite helps me.

Does anyone have any ideas how to do this?  I'm have a feeling I'm missing something obvious and easy......


Xfce 4.6.2; Debian Squeeze

Offline

#2 2012-06-23 01:35:33

gnome_refugee
Member
Registered: 2010-01-15
Posts: 169

Re: Want to Run a Script Before Shutdown

Offline

#3 2012-06-23 02:37:14

Digger
Member
Registered: 2012-01-18
Posts: 26
Website

Re: Want to Run a Script Before Shutdown

gnome_refugee wrote:

Hi gnome....thanks for your help.

Actually, I did view that site during my research.  What he is proposing is not really what I want to do, since it looks like his method invokes the script before the "Log Out" dialog appears.

What I'm looking for is a method whereby I can call up the "Log Out" dialog, click "Shut Down", then have the script invoked before the machine actually shuts down.  Said script would give me a chance to abort the impending shut down if I wanted to do so.

I suspend my machine several times a day and then shut it down before I go to bed.  I don't want the script invoked unless I'm intending to shut the machine down.

Thanks for trying, though.  Any other ideas out there?


Xfce 4.6.2; Debian Squeeze

Offline

#4 2012-06-23 03:10:18

gnome_refugee
Member
Registered: 2010-01-15
Posts: 169

Re: Want to Run a Script Before Shutdown

Hi, digger.

Sorry, didn't read your post carefully. (And I'm the 'he' of the FSM article.)

How about this? Put a launcher in your panel which does xfce4-session-logout --suspend. You hit that during the day when you want to suspend, then go to the usual logout dialog when you go to bed, to shut down. You could even give the launcher the usual shut-down icon, so it looks like the real thing. But put it somewhere on your panel away from that real thing!

Offline

#5 2012-06-23 03:20:54

Digger
Member
Registered: 2012-01-18
Posts: 26
Website

Re: Want to Run a Script Before Shutdown

gnome_refugee wrote:

Hi, digger.

Sorry, didn't read your post carefully. (And I'm the 'he' of the FSM article.)

How about this? Put a launcher in your panel which does xfce4-session-logout --suspend. You hit that during the day when you want to suspend, then go to the usual logout dialog when you go to bed, to shut down. You could even give the launcher the usual shut-down icon, so it looks like the real thing. But put it somewhere on your panel away from that real thing!

Gnome,

Actually, what you propose is currently my "fallback" plan, a workaround that I'll use if a more elegant solution is not possible.

Thanks!


Any other ideas out there, anybody?


Xfce 4.6.2; Debian Squeeze

Offline

#6 2012-06-23 12:40:12

secipolla
Member
Registered: 2012-01-15
Posts: 393

Re: Want to Run a Script Before Shutdown

That should be hard-coded so for what you want I think you would have to change the code of xfce4-session to change the action for "xfce4-session-logout --halt" then rebuild it.
Just my guess.

Offline

#7 2012-06-23 15:50:08

Digger
Member
Registered: 2012-01-18
Posts: 26
Website

Re: Want to Run a Script Before Shutdown

secipolla wrote:

That should be hard-coded so for what you want I think you would have to change the code of xfce4-session to change the action for "xfce4-session-logout --halt" then rebuild it.
Just my guess.

Ooopers!

sec, if you're correct, then that is a little rich for my blood!

Looks like I may be settling for a dirty workaround (see above).  :-(


Xfce 4.6.2; Debian Squeeze

Offline

Board footer

Powered by FluxBB