Simple Haskell Daemon for Setting Wallpapers
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

30 lines
757 B

{-# LANGUAGE OverloadedStrings #-}
module Wallpapers
( getWallPapers
, setBackground
, loopBackgrounds
) where
import System.Directory
import System.Process
import Control.Applicative
import Control.Concurrent
import Download
fiveMinutes = 300000000
getWallPapers = do
home <- getHomeDirectory
setCurrentDirectory (home ++ "/wallpapers")
wallpapers <- (listDirectory $ home ++ "/wallpapers")
sequence $ makeAbsolute <$> wallpapers
setBackground :: FilePath -> IO ()
setBackground path = callCommand $ "/usr/bin/feh --bg-scale " ++ path
loopBackgrounds images = forkIO $ loopBackgrounds' (cycle images) where
loopBackgrounds' (image:images) = do
setBackground image
threadDelay fiveMinutes
loopBackgrounds' images