summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Confirm.hs11
-rw-r--r--lib/Pass.hs7
2 files changed, 16 insertions, 2 deletions
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)
diff --git a/lib/Pass.hs b/lib/Pass.hs
index f29df27..c9b70df 100644
--- a/lib/Pass.hs
+++ b/lib/Pass.hs
@@ -1,4 +1,3 @@
-
-----------------------------------------------------------------------------
-- |
-- Module : Pass
@@ -131,7 +130,11 @@ generatePassword passLabel = safeSpawn "pass" ["generate", "--force", passLabel,
getPasswords :: IO [String]
getPasswords = do
home <- getHomeDirectory
- files <- runProcessWithInput "find" [home ++ "/.password-store","-type", "f", "-name", "*.gpg", "-printf", "%P\n"] []
+ files <- runProcessWithInput "find" [
+ home ++ "/.password-store",
+ "-type", "f",
+ "-name", "*.gpg",
+ "-printf", "%P\n"] []
return $ map removeGpgExtension $ lines files
removeGpgExtension :: String -> String