diff options
-rw-r--r-- | XMonad/Prompt/Theme.hs | 10 |
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 |