aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Actions
diff options
context:
space:
mode:
authorAdam Vogt <vogt.adam@gmail.com>2009-10-20 18:59:24 +0200
committerAdam Vogt <vogt.adam@gmail.com>2009-10-20 18:59:24 +0200
commit739184db607b9fe1b1ffe0c7dcf10149e875eba4 (patch)
tree4f9d5be84f6331ce45ad4116cfd2212c9c178459 /XMonad/Actions
parent6ef8cbb56a4416473674c8a84600a18be4c7da07 (diff)
downloadXMonadContrib-739184db607b9fe1b1ffe0c7dcf10149e875eba4.tar.gz
XMonadContrib-739184db607b9fe1b1ffe0c7dcf10149e875eba4.tar.xz
XMonadContrib-739184db607b9fe1b1ffe0c7dcf10149e875eba4.zip
Share one StdGen between RGB channels in A.RandomBackground
Ignore-this: 15eef05c9a73d578f5513550757bb8bb darcs-hash:20091020165924-1499c-f6e8db74e8d4ad712435f1f4a54913c416ef52ad.gz
Diffstat (limited to 'XMonad/Actions')
-rw-r--r--XMonad/Actions/RandomBackground.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/XMonad/Actions/RandomBackground.hs b/XMonad/Actions/RandomBackground.hs
index 8634a97..c0bbe56 100644
--- a/XMonad/Actions/RandomBackground.hs
+++ b/XMonad/Actions/RandomBackground.hs
@@ -24,7 +24,7 @@ module XMonad.Actions.RandomBackground (
import XMonad(X, XConf(config), XConfig(terminal), io, spawn,
MonadIO, asks)
import System.Random
-import Control.Monad(replicateM,liftM)
+import Control.Monad(liftM)
import Numeric(showHex)
-- $usage
@@ -55,7 +55,7 @@ randPermutation xs g = swap $ zip (randoms g) xs
-- | @randomBg'@ produces a random hex number in the form @'#xxyyzz'@
randomBg' :: (MonadIO m) => RandomColor -> m String
-randomBg' (RGB l h) = liftM toHex $ replicateM 3 $ io $ randomRIO (l,h)
+randomBg' (RGB l h) = io $ liftM (toHex . take 3 . randomRs (l,h)) newStdGen
randomBg' (HSV s v) = io $ do
g <- newStdGen
let x = (^(2::Int)) $ fst $ randomR (0,sqrt $ pi / 3) g