diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-08-12 11:44:34 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-08-12 11:44:34 -0400 |
commit | 3ee306d3d4bda52268f07df874070b65d171694e (patch) | |
tree | 4ed6a83a2e4358b0dd0ff4a0a5c62108a99286c2 /UI.hs | |
parent | a58aea595a780c91bbbe26d2d24a63abcd835994 (diff) | |
download | keysafe-3ee306d3d4bda52268f07df874070b65d171694e.tar.gz |
add --gui option
Diffstat (limited to 'UI.hs')
-rw-r--r-- | UI.hs | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -10,5 +10,18 @@ import Control.Monad import UI.Zenity import UI.Readline -availableUI :: IO [UI] -availableUI = filterM isAvailable [zenityUI, readlineUI] +availableUIs :: IO [UI] +availableUIs = filterM isAvailable [zenityUI, readlineUI] + +selectUI :: Bool -> IO UI +selectUI needgui + | needgui = do + ok <- isAvailable zenityUI + if ok + then return zenityUI + else error "zenitty is not installed, GUI not available" + | otherwise = do + l <- availableUIs + case l of + (u:_) -> return u + [] -> error "Neither zenity nor the readline UI are available" |