aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@unibz.it>2008-02-07 19:43:21 +0100
committerAndrea Rossato <andrea.rossato@unibz.it>2008-02-07 19:43:21 +0100
commit9e4008c009a9e3bf991b509e53fc39dfb4e97201 (patch)
treed40bea939295b0de86722085caad67ce348cbb63
parentf69a95f16230d70edf6d1ad9778a94f6d9980786 (diff)
downloadXMonadContrib-9e4008c009a9e3bf991b509e53fc39dfb4e97201.tar.gz
XMonadContrib-9e4008c009a9e3bf991b509e53fc39dfb4e97201.tar.xz
XMonadContrib-9e4008c009a9e3bf991b509e53fc39dfb4e97201.zip
Add Prompt.Theme: a prompt for dynamically applying a theme to the current workspace
darcs-hash:20080207184321-32816-90de355649c2e7190726ee5f0de2ca99a0b19bdc.gz
-rw-r--r--XMonad/Prompt/Theme.hs52
-rw-r--r--xmonad-contrib.cabal1
2 files changed, 53 insertions, 0 deletions
diff --git a/XMonad/Prompt/Theme.hs b/XMonad/Prompt/Theme.hs
new file mode 100644
index 0000000..6392f41
--- /dev/null
+++ b/XMonad/Prompt/Theme.hs
@@ -0,0 +1,52 @@
+-----------------------------------------------------------------------------
+-- |
+-- Module : XMonad.Prompt.Theme
+-- Copyright : (C) 2007 Andrea Rossato
+-- License : BSD3
+--
+-- Maintainer : andrea.rossato@unibz.it
+-- Stability : unstable
+-- Portability : unportable
+--
+-- A prompt for chnaging the theme of the current workspace
+--
+-----------------------------------------------------------------------------
+
+module XMonad.Prompt.Theme
+ ( -- * Usage
+ -- $usage
+ themePrompt,
+ ) where
+
+import Control.Arrow ( (&&&) )
+import qualified Data.Map as M
+import Data.Maybe ( fromMaybe )
+import XMonad
+import XMonad.Prompt
+import XMonad.Layout.Decoration
+import XMonad.Util.Themes
+
+-- $usage
+-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
+--
+-- > import XMonad.Prompt
+-- > import XMonad.Prompt.Theme
+--
+-- in your keybindings add:
+--
+-- > , ((modMask x .|. controlMask, xK_t), themePrompt defaultXPConfig)
+--
+-- For detailed instruction on editing the key binding see
+-- "XMonad.Doc.Extending#Editing_key_bindings".
+
+data ThemePrompt = ThemePrompt
+
+instance XPrompt ThemePrompt where
+ showXPrompt ThemePrompt = "Select a theme: "
+
+themePrompt :: XPConfig -> X ()
+themePrompt c = mkXPrompt ThemePrompt c (const $ return (map fst $ M.toList mapOfThemes)) 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 \ No newline at end of file
diff --git a/xmonad-contrib.cabal b/xmonad-contrib.cabal
index e872f04..66eae72 100644
--- a/xmonad-contrib.cabal
+++ b/xmonad-contrib.cabal
@@ -143,6 +143,7 @@ library
XMonad.Prompt.Man
XMonad.Prompt.Shell
XMonad.Prompt.Ssh
+ XMonad.Prompt.Theme
XMonad.Prompt.Window
XMonad.Prompt.Workspace
XMonad.Prompt.XMonad