module XMonad.Wallpaper where
import XMonad.Core
import XMonad.Wallpaper.Find
import XMonad.Wallpaper.Expand
import Control.Applicative
import System.Random
setRandomWallpaper :: [String] -> IO ()
setRandomWallpaper [String]
filepaths = do
rootPaths <- (String -> IO String) -> [String] -> IO [String]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM String -> IO String
expand [String]
filepaths
candidates <- findImages rootPaths
wallpaper <- ((!!) candidates) <$> getStdRandom (randomR (0, length candidates - 1))
spawn $ "feh --bg-scale " ++ wallpaper