[xmonad] exiting: asking for confirmation (or a four-key combination)

wagnerdm at seas.upenn.edu wagnerdm at seas.upenn.edu
Thu Nov 10 20:45:55 CET 2011


How about this?

import Control.Monad
import System.Exit
import XMonad.Util.Run

promptExit = do
     response <- runProcessWithInput "dmenu" ["-p", "Really quit?"] "yes\nno\n"
     when (response == "yes") (io (exitWith ExitSuccess))

Then you can add a keybinding like ((modMask, xK_q), promptExit). You  
might also look into XMonad.Prompt; somebody who's a bit more expert  
in that module can probably suggest how to do the analogous thing.

~d

Quoting Ramon Diaz-Uriarte <rdiaz02 at gmail.com>:

>
> Dear All,
>
> Occasionally, I do something silly and by mistake type
>
> modMask + shift + q
>
> and xmonad, as it should, immediately exits. When done accidentally, this
> is a pain. So:
>
> a) is there a way to get xmonad to ask for confirmation to exit?
>
> b) alternatively, can I define four (of five) key combinations, so I need
> to do something really contrived to exit?
>
> I've searched both answers without success, and my attempts at four-key
> combinations have not worked (even if I get xmonad --recompile to run).
>
>
> Thanks,
>
>
> R.
> --
> Ramon Diaz-Uriarte
> Department of Biochemistry, Lab B-25.
> Facultad de Medicina (UAM)
> Arzobispo Morcillo, 2
> 28029 Madrid
> Spain
>
>
> Phone: +34-91-497-2412
>
> Email: rdiaz02 at gmail.com
>        ramon.diaz at iib.uam.es
>
> http://ligarto.org/rdiaz
>
>
> _______________________________________________
> xmonad mailing list
> xmonad at haskell.org
> http://www.haskell.org/mailman/listinfo/xmonad
>
>





More information about the xmonad mailing list