Scripts quick access edit this

Synopsis Edit

Closing windows gracefully.

Description Edit

This module contains one function (shutdown) which shuts down each window listed in the configuration variable *shutdown-windows*. It does this by sending the configured keypress to the window matching the given regular expression, and then waiting for that window to be destroyed. This means that, for example, Opera can be shutdown cleanly on logout, and won't complain when you start back up again.

Installation Edit

  1. Save shutdown.jl in your load-path.
  2. Add the following line to your ~/.sawfishrc:
    (require 'shutdown)

Configuration Edit

The windows you want to be closed cleanly are stored in the *shutdown-windows* variable along with their respective closing shortcuts. Here's an example for Opera (Control-q) and Firefox (Control-Shift-w). Put it into your ~/.sawfishrc to make it work.

(setq *shutdown-windows*
  '(("Opera " . "C-q")
    ("Firefox" . "C-W"))  

You can use the shutdown function wherever you have your log-out functionality. Sample code for ~/.sawfish/rc:

(nconc root-menu '(("_Quit" (shutdown quit))))

This adds a "Quit" option to the root menu, and calls shutdown and then (quit) with that menu option. Notice the continuation-style handling of what to call once the windows have been destroyed.

Community content is available under CC-BY-SA unless otherwise noted.