aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Prompt/Theme.hs
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@unibz.it>2008-02-16 12:41:59 +0100
committerAndrea Rossato <andrea.rossato@unibz.it>2008-02-16 12:41:59 +0100
commit9bebda0dc13ee465b9f5ee86fdc6ddc8132598ec (patch)
tree76839aa29e2e5c37e085aeb6a914da04d80dc736 /XMonad/Prompt/Theme.hs
parentcb871d8812a9966551211325495f564d98028ea3 (diff)
downloadXMonadContrib-9bebda0dc13ee465b9f5ee86fdc6ddc8132598ec.tar.gz
XMonadContrib-9bebda0dc13ee465b9f5ee86fdc6ddc8132598ec.tar.xz
XMonadContrib-9bebda0dc13ee465b9f5ee86fdc6ddc8132598ec.zip
Prompt.Theme: display all theme information and handle completion accordingly
darcs-hash:20080216114159-32816-3a53fcae3f880fcd243f0ed2f967dc0f5a506068.gz
Diffstat (limited to '')
-rw-r--r--XMonad/Prompt/Theme.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/XMonad/Prompt/Theme.hs b/XMonad/Prompt/Theme.hs
index a1f25be..cf67a36 100644
--- a/XMonad/Prompt/Theme.hs
+++ b/XMonad/Prompt/Theme.hs
@@ -20,6 +20,7 @@ module XMonad.Prompt.Theme
import Control.Arrow ( (&&&) )
import qualified Data.Map as M
import Data.Maybe ( fromMaybe )
+import Data.List
import XMonad
import XMonad.Prompt
import XMonad.Layout.Decoration
@@ -43,10 +44,15 @@ data ThemePrompt = ThemePrompt
instance XPrompt ThemePrompt where
showXPrompt ThemePrompt = "Select a theme: "
+ commandToComplete _ c = c
+ nextCompletion _ c l = l !! idx
+ where idx = case c `elemIndex` l of
+ Just i -> if i >= length l - 1 then 0 else i + 1
+ Nothing -> 0
themePrompt :: XPConfig -> X ()
-themePrompt c = mkXPrompt ThemePrompt c (const . return . map themeName $ listOfThemes) changeTheme
+themePrompt c = mkXPrompt ThemePrompt c (const . return . map ppThemeInfo $ listOfThemes) changeTheme
where changeTheme t = sendMessage . SetTheme . fromMaybe defaultTheme $ M.lookup t mapOfThemes
mapOfThemes :: M.Map String Theme
-mapOfThemes = M.fromList . uncurry zip . (map themeName &&& map theme) $ listOfThemes
+mapOfThemes = M.fromList . uncurry zip . (map ppThemeInfo &&& map theme) $ listOfThemes