packages feed

xmonad-wallpaper 0.0.1.0 → 0.0.1.1

raw patch · 4 files changed

+41/−8 lines, 4 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- XMonad.Wallpaper.Expand: Literal :: String -> AST
- XMonad.Wallpaper.Expand: Variable :: String -> AST
- XMonad.Wallpaper.Expand: data AST
- XMonad.Wallpaper.Expand: interpolate :: AST -> IO [Char]
- XMonad.Wallpaper.Expand: isExpr :: Char -> Bool
- XMonad.Wallpaper.Expand: literal :: [Char] -> (AST, [Char])
- XMonad.Wallpaper.Expand: parse :: [Char] -> [AST]
- XMonad.Wallpaper.Expand: t0 :: IO ()
- XMonad.Wallpaper.Expand: variable :: [Char] -> (AST, [Char])
- XMonad.Wallpaper.Find: Directory :: FilePath -> UnixFile
- XMonad.Wallpaper.Find: RegularFile :: FilePath -> UnixFile
- XMonad.Wallpaper.Find: data UnixFile
- XMonad.Wallpaper.Find: findDir :: UnixFile -> IO [UnixFile]
- XMonad.Wallpaper.Find: findDirRecursive :: UnixFile -> IO [UnixFile]
- XMonad.Wallpaper.Find: isImage :: UnixFile -> StateT Magic IO Bool
- XMonad.Wallpaper.Find: mimetype :: FilePath -> StateT Magic IO String
- XMonad.Wallpaper.Find: runMimetypeDetection :: StateT Magic IO b -> IO b
- XMonad.Wallpaper.Find: toFilepath :: UnixFile -> FilePath
- XMonad.Wallpaper.Find: toUnixFile :: FilePath -> IO (Maybe UnixFile)
- XMonad.Wallpaper: setRandomWallpaper :: [[Char]] -> IO ()
+ XMonad.Wallpaper: setRandomWallpaper :: [String] -> IO ()
- XMonad.Wallpaper.Expand: expand :: [Char] -> IO [Char]
+ XMonad.Wallpaper.Expand: expand :: String -> IO String

Files

src/XMonad/Wallpaper.hs view
@@ -7,6 +7,30 @@ import Control.Applicative import System.Random +{- |+Example usage: (~/.xmonad/xmonad.hs)++> import XMonad+> import XMonad.Config.Desktop+> import XMonad.Wallpaper+> main = do+>     setRandomWallpaper ["paths-of-your choice", "$HOME/Pictures/Wallpapers"]+>     xmonad $ desktopConfig+>        { terminal    = "urxvt"+>        , modMask     = mod4Mask+>        }++Paths will be expanded using environment variables. +The following syntax are supported:++> epxand $HOME/Pictures+\/home\/user/Pictures++> expand ${HOME}ABC+\/home\/userABC++-}+ setRandomWallpaper filepaths = do     rootPaths  <- mapM expand filepaths     candidates <- findImages rootPaths
src/XMonad/Wallpaper/Expand.hs view
@@ -1,4 +1,4 @@-module XMonad.Wallpaper.Expand where+module XMonad.Wallpaper.Expand (expand) where  import Control.Monad.State import Data.List@@ -26,15 +26,21 @@     let (a, b) = variable as in a : parse b parse as =      let (a, b) = literal as in a : parse b-    -t0 = do-    let ast = parse "$HOME/Pictures/Wallpapers"-    values <- mapM interpolate ast-    putStrLn $ show values  interpolate (Variable var) = maybe "" id <$> getEnv var interpolate (Literal str) = return str +expand :: String -> IO String+{- |+Expand string using environment variables.+The following syntax are supported++> epxand $HOME/Pictures+\/home\/user/Pictures++> expand ${HOME}ABC+\/home\/userABC+-} expand str = do     let ast = parse str     concat <$> mapM interpolate ast
src/XMonad/Wallpaper/Find.hs view
@@ -1,4 +1,4 @@-module XMonad.Wallpaper.Find where+module XMonad.Wallpaper.Find (findImages) where  import System.Posix.Directory import System.Posix.Files@@ -73,6 +73,9 @@ isImage (RegularFile filepath) = isPrefixOf "image" <$> mimetype filepath isImage _ = return False +{- |+Recursively search supplied paths. Files are filtered by mimetypes, which is determined by magic bits. Duplicated paths will be removed.+-} findImages filepaths = do     paths  <- catMaybes <$> mapM toUnixFile filepaths     files  <- concat <$> mapM findDirRecursive paths
xmonad-wallpaper.cabal view
@@ -10,7 +10,7 @@ -- PVP summary:      +-+------- breaking API changes --                   | | +----- non-breaking API additions --                   | | | +--- code changes with no API change-version:             0.0.1.0+version:             0.0.1.1  -- A short (one-line) description of the package. synopsis: