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

Ramon Diaz-Uriarte rdiaz02 at gmail.com
Sat Nov 12 14:43:13 CET 2011



Thanks to both Daniel Wagner and Brandon Allbery for their
suggestions. 

I've ended up using Daniel's one because it seemed more similar to what I
was thinking. I only changed the order of "yes\nno\n", to make the default
be "no" since I very, very rarely exit xmonad (on purpose).


Best,

R.


On Thu, 10 Nov 2011 14:45:55 -0500,wagnerdm at seas.upenn.edu wrote:
> 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
> >
> >



> _______________________________________________
> xmonad mailing list
> xmonad at haskell.org
> http://www.haskell.org/mailman/listinfo/xmonad
-- 
Ramon Diaz-Uriarte
Department of Biochemistry, Lab B-25.
Facultad de Medicina (UAM)
Arzobispo Morcillo, 4
28029 Madrid
Spain


Phone: +34-91-497-2412

Email: rdiaz02 at gmail.com
       ramon.diaz at iib.uam.es

http://ligarto.org/rdiaz




More information about the xmonad mailing list