From 9bebda0dc13ee465b9f5ee86fdc6ddc8132598ec Mon Sep 17 00:00:00 2001 From: Andrea Rossato Date: Sat, 16 Feb 2008 12:41:59 +0100 Subject: Prompt.Theme: display all theme information and handle completion accordingly darcs-hash:20080216114159-32816-3a53fcae3f880fcd243f0ed2f967dc0f5a506068.gz --- XMonad/Prompt/Theme.hs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'XMonad/Prompt/Theme.hs') 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 -- cgit v1.2.3