From c8fe2bb1419960b5d539e73326158d1ee4381e5e Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Wed, 4 Feb 2015 20:02:04 +0100 Subject: lib/Confirm: Add simple confirmation with grid select. --- lib/Confirm.hs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 lib/Confirm.hs diff --git a/lib/Confirm.hs b/lib/Confirm.hs new file mode 100644 index 0000000..47e3388 --- /dev/null +++ b/lib/Confirm.hs @@ -0,0 +1,11 @@ +module Confirm (confirm) where + +import Control.Monad + +import XMonad.Core +import XMonad.Actions.GridSelect + +confirm :: GSConfig Bool -> String -> X() -> X() +confirm config string action = do + res <- gridselect config [(string, True), ("No", False)] + whenJust res (\x -> when x action) -- cgit v1.2.3