XMonad.Hooks.WallpaperSetter

xmonad-contrib-0.13: Third party extensions for xmonad

Copyright | (c) Anton Pirogov 2014
License | BSD3
Maintainer | Anton Pirogov <anton.pirogov@gmail.com>
Stability | unstable
Portability | unportable
Safe Haskell | None
Language | Haskell98

XMonad.Hooks.WallpaperSetter

Contents

- Usage
- TODO

Description

Log hook which changes the wallpapers depending on visible workspaces.

Synopsis

- wallpaperSetter :: WallpaperConf -> X ()
- data WallpaperConf = WallpaperConf {
  - wallpaperBaseDir :: FilePath
  - wallpapers :: WallpaperList
  }
- data Wallpaper
  - = WallpaperFix FilePath
  - | WallpaperDir FilePath
- newtype WallpaperList = WallpaperList [(WorkspaceId, Wallpaper)]
- defWallpaperConf :: WallpaperConf
- defWPNames :: [WorkspaceId] -> WallpaperList

# Usage

This module requires imagemagick and feh to be installed, as these are utilized for the required image transformations and the actual setting of the wallpaper.

This was especially tested with multi-head setups - if you have two monitors and swap the workspaces, the wallpapers will be swapped too, scaled accordingly and rotated if necessary (e.g. if you are using your monitor rotated but only have wide wallpapers).

Add a log hook like this:

    myWorkspaces = ["1:main","2:misc","3","4"]
    ...
    main = xmonad $ defaultConfig {
      logHook = wallpaperSetter defWallpaperConf {
                                   wallpapers = defWPNames myWorkspaces
                                             <> WallpaperList [("1:main",WallpaperDir "1")]
                                }
      }
    ...

wallpaperSetter :: WallpaperConf -> X () #

Add this to your log hook with the workspace configuration as argument.

data WallpaperConf #

Complete wallpaper configuration passed to the hook

Constructors

WallpaperConf |
Fields wallpaperBaseDir :: FilePath Where the wallpapers reside (if empty, will look in ~/.wallpapers/) wallpapers :: WallpaperList List of the wallpaper associations for workspaces

Instances

Read WallpaperConf # |
Methods readsPrec :: Int -> ReadS WallpaperConf # readList :: ReadS [WallpaperConf] # readPrec :: ReadPrec WallpaperConf # readListPrec :: ReadPrec [WallpaperConf] #
Show WallpaperConf # |
Methods showsPrec :: Int -> WallpaperConf -> ShowS # show :: WallpaperConf -> String # showList :: [WallpaperConf] -> ShowS #
Default WallpaperConf # |
Methods def :: WallpaperConf #

data Wallpaper #

Represents a wallpaper

Constructors

WallpaperFix FilePath | Single, fixed wallpaper
WallpaperDir FilePath | Random wallpaper from this subdirectory

Instances

Eq Wallpaper # |
Methods (==) :: Wallpaper -> Wallpaper -> Bool # (/=) :: Wallpaper -> Wallpaper -> Bool #
Read Wallpaper # |
Methods readsPrec :: Int -> ReadS Wallpaper # readList :: ReadS [Wallpaper] # readPrec :: ReadPrec Wallpaper # readListPrec :: ReadPrec [Wallpaper] #
Show Wallpaper # |
Methods showsPrec :: Int -> Wallpaper -> ShowS # show :: Wallpaper -> String # showList :: [Wallpaper] -> ShowS #

newtype WallpaperList #

Constructors

WallpaperList [(WorkspaceId, Wallpaper)] |

Instances

Read WallpaperList # |
Methods readsPrec :: Int -> ReadS WallpaperList # readList :: ReadS [WallpaperList] # readPrec :: ReadPrec WallpaperList # readListPrec :: ReadPrec [WallpaperList] #
Show WallpaperList # |
Methods showsPrec :: Int -> WallpaperList -> ShowS # show :: WallpaperList -> String # showList :: [WallpaperList] -> ShowS #
Monoid WallpaperList # |
Methods mempty :: WallpaperList # mappend :: WallpaperList -> WallpaperList -> WallpaperList # mconcat :: [WallpaperList] -> WallpaperList #

defWallpaperConf :: WallpaperConf #

default configuration. looks in ~/.wallpapers/ for WORKSPACEID.jpg

defWPNames :: [WorkspaceId] -> WallpaperList #

returns the default association list (maps name to name.jpg, non-alphanumeric characters are omitted)

# TODO

- implement a kind of image cache like in wallpaperd to remove or at least reduce the lag
- find out how to merge multiple images from stdin to one (-> for caching all pictures in memory)