packages feed

backdropper 1.1 → 1.2

raw patch · 6 files changed

+66/−15 lines, 6 filesdep +directorydep −Cabaldep ~base

Dependencies added: directory

Dependencies removed: Cabal

Dependency ranges changed: base

Files

− .Setup.hs.swp

binary file changed (4096 → absent bytes)

− .backdropper.cabal.swp

binary file changed (12288 → absent bytes)

README view
@@ -28,13 +28,19 @@ -------------------------------------------------------------------------------- -- Quick install guide -- -1 - Download qiv from http://www.klografx.net/qiv/ and install it.+1 - Download Imagemagick.  You need "display". +1.5 - Edit src/Rotating_backdrop_logic.hs to add the values you want to +    getPossition = "-1280-0"+    getResize = "1680>x1050<"+These are for my dual display, yours may vary.  Yes, those should be parameters +and will be in the next version.  Patches welcome ;>+ 2 - Create a file (~/.backdropper.list) which contains an image (with full path) per line. See sample_wallpaper_list for an example of how it should look like. -3 - Run "runhaskell Setup.hs configure".+3 - Run "runhaskell Setup.hs configure --user".  4 - Run "runhaskell Setup.hs build". @@ -46,7 +52,12 @@  8 - Run "backdropper_consol --config=$HOME/.backdropper.list --delay=900". +runhaskell Setup.hs configure --user --prefix=$HOME+runhaskell Setup.hs build+runhaskell Setup.hs haddock+runhaskell Setup.hs install +runhaskell Setup.hs configure --user --prefix=$HOME && runhaskell Setup.hs build && runhaskell Setup.hs install  -------------------------------------------------------------------------------- -- Future versions -- @@ -60,6 +71,10 @@ -------------------------------------------------------------------------------- -- Version release notes -- +v1.2 --+  * Added Don Stewart's patch to look up looking up the user's home+    directly and to make the tool build with ghc 6.6.+ v1.1 -- Thu Jun 19 2008 Second release for Hackage.   * Added hshaskell logging instead of normal IO ().    * Added comments so that haddock works.@@ -74,6 +89,9 @@ -------------------------------------------------------------------------------- -- Notes -- +Special thanks to Don Stewart for the first bug report and patch!+ Special thanks to the haskell-cafe list, in particular to Ketil Malde, Derek Elkins, Spencer Janssen, Bulat Ziganshin, Ryan Ingram and Lauri Alanko.+
backdropper.cabal view
@@ -1,19 +1,33 @@ Name:            backdropper-Version:         1.1-Cabal-Version:   >= 1.2+Version:         1.2 License:         GPL license-file:    LICENSE copyright:       (c) 2008, Yann Golanski. Author:          Yann Golanski <yann@kierun.org> maintainer:      yann@kierun.org-Synopsis:        Rotates backdrops for X11 displays using qiv.+Synopsis:        Rotates backdrops for X11 displays using Imagemagic.+Description:     Rotates backdrops for X11 displays using Imagemagic. Build-Type:      Simple+Cabal-Version:   >= 1.2 +flag small_base+  description: Choose the new smaller, split-up base package.+ Library   Exposed-Modules: Rotating_backdrop_logic   hs-source-dirs:  ./src  Executable backdropper_consol   Main-Is:         backdropper_consol.hs-  build-depends:   old-time, base, process, random, Cabal, haskell98, hslogger++  if flag(small_base)+        build-depends: base >= 2 && < 4,+                       old-time,+                       directory,+                       process,+                       random,+                       haskell98+  else+        build-depends: base >= 2 && < 4+  build-depends:       hslogger   hs-source-dirs:  ./src
src/Rotating_backdrop_logic.hs view
@@ -23,7 +23,7 @@ --  along with this program.  If not, see <http://www.gnu.org/licenses/>. -- module Rotating_backdrop_logic where-import Distribution.Simple.Utils+ import Control.Monad import System.Random import System.Process@@ -35,6 +35,13 @@ import System.Log.Handler.Syslog import Logger_logic +----- EDIT THESE VALUES TO FIT WHAT YOU WANTED --------------------------------+getPossition = "-1280-0"+getResize = "1680>x1050<"+---------------- STOP EDITING HERE --------------------------------------------+--+--+-- {------------------------------------------------------------------------------} --main = onlyOnce "/home/yann/.rotate_wallpaper_list" --main = doManyTimes "/home/yann/.rotate_wallpaper_list" 5@@ -100,9 +107,7 @@ -- | Reads a file and return a list those elements are lines. parseImageFile :: FilePath -- ^ The path/name to a configuration file.                 -> IO [String] -- ^ A list those elements are lines.-parseImageFile f = do inpStr <- readFile f-                      return $ filter (/="") (breaks (=='\n') inpStr)-+parseImageFile f = do { s <- readFile f ; return $ lines s }  {------------------------------------------------------------------------------} -- | Gets a random number.@@ -126,7 +131,18 @@ -- | Changes the desktop image using qiv: http://www.klografx.net/qiv/index2.html changeDesktop :: String -- ^ The path to an image.               -> IO ExitCode -- ^ An exit code from the shell running qiv.-changeDesktop img = do ph <- runProcess "/usr/local/bin/qiv" ["-x", "-t", img] Nothing Nothing Nothing Nothing Nothing+-- changeDesktop img = do ph <- runProcess "/usr/bin/qiv" ["-x", "-t", img] Nothing Nothing Nothing Nothing Nothing+--changeDesktop img = do ph <- runProcess "display" ["-window", "root", "-geometry", "-1280-0", "-resize", "1680>x1050<", img] Nothing Nothing Nothing Nothing Nothing+changeDesktop img = do ph <- runProcess "display" ["-window", "root", "-geometry", getPossition, "-resize", getResize, img] Nothing Nothing Nothing Nothing Nothing                        --waitForProcess ph >>= print                        waitForProcess ph ++-- Helper functions+breaks :: (a -> Bool) -> [a] -> [[a]]+breaks _ [] = []+breaks f xs = case span f xs of+                  (_, xs') ->+                      case break f xs' of+                          (v, xs'') ->+                              v : breaks f xs''
src/backdropper_consol.hs view
@@ -64,6 +64,7 @@ import System import IO import Control.Monad+import System.Directory import System.Log.Logger import System.Log.Handler.Syslog import Logger_logic@@ -71,10 +72,10 @@ {------------------------------------------------------------------------------} -- | New data type to hold the command line options. data Options = Options- { optInput :: Maybe FilePath+ { optInput  :: Maybe FilePath   ,optLogLvl :: Maybe String-  ,optDelay :: Int-  ,optGUI :: Bool+  ,optDelay  :: Int+  ,optGUI    :: Bool  } deriving Show  @@ -195,6 +196,8 @@           logger INFO "Backdropper started..."           let d = (optDelay opts)           case (optInput opts) of-            Nothing -> mainLoop "/home/yann/.rotate_wallpaper_list" d+            Nothing  -> do+                    home <- getHomeDirectory+                    mainLoop (home ++ "/.rotate_wallpaper_list") d             (Just p) -> mainLoop p d           exitWith ExitSuccess