summaryrefslogtreecommitdiffhomepage
path: root/Plugins/XMonadLog.hs
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-12-21 02:36:35 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-12-21 02:36:35 +0100
commite3853a9cb2a9a2cffa174d1334e2ca8ba610f151 (patch)
tree13aa04faea320afe85636e23686280386c1c2910 /Plugins/XMonadLog.hs
parent598bfe5deeff079280e8513c55dc7bda3e8cf9a0 (diff)
downloadxmobar-e3853a9cb2a9a2cffa174d1334e2ca8ba610f151.tar.gz
xmobar-e3853a9cb2a9a2cffa174d1334e2ca8ba610f151.tar.bz2
Haskell sources moved to src/ to unclutter toplevel
Diffstat (limited to 'Plugins/XMonadLog.hs')
-rw-r--r--Plugins/XMonadLog.hs72
1 files changed, 0 insertions, 72 deletions
diff --git a/Plugins/XMonadLog.hs b/Plugins/XMonadLog.hs
deleted file mode 100644
index 3461e26..0000000
--- a/Plugins/XMonadLog.hs
+++ /dev/null
@@ -1,72 +0,0 @@
-{-# LANGUAGE CPP #-}
-
------------------------------------------------------------------------------
--- |
--- Module : Plugins.StdinReader
--- Copyright : (c) Spencer Janssen
--- License : BSD-style (see LICENSE)
---
--- Maintainer : Spencer Janssen <spencerjanssen@gmail.com>
--- Stability : unstable
--- Portability : unportable
---
--- A plugin to display information from _XMONAD_LOG, specified at
--- http://code.haskell.org/XMonadContrib/XMonad/Hooks/DynamicLog.hs
---
------------------------------------------------------------------------------
-
-module Plugins.XMonadLog (XMonadLog(..)) where
-
-import Control.Monad
-import Graphics.X11
-import Graphics.X11.Xlib.Extras
-import Plugins
-#ifdef UTF8
-#undef UTF8
-import Codec.Binary.UTF8.String as UTF8
-#define UTF8
-#endif
-import Foreign.C (CChar)
-import XUtil (nextEvent')
-
-
-data XMonadLog = XMonadLog | XPropertyLog String
- deriving (Read, Show)
-
-instance Exec XMonadLog where
- alias XMonadLog = "XMonadLog"
- alias (XPropertyLog atom) = atom
-
- start x cb = do
- let atom = case x of
- XMonadLog -> "_XMONAD_LOG"
- XPropertyLog a -> a
- d <- openDisplay ""
- xlog <- internAtom d atom False
-
- root <- rootWindow d (defaultScreen d)
- selectInput d root propertyChangeMask
-
- let update = do
- mwp <- getWindowProperty8 d xlog root
- maybe (return ()) (cb . decodeCChar) mwp
-
- update
-
- allocaXEvent $ \ep -> forever $ do
- nextEvent' d ep
- e <- getEvent ep
- case e of
- PropertyEvent { ev_atom = a } | a == xlog -> update
- _ -> return ()
-
- return ()
-
-decodeCChar :: [CChar] -> String
-#ifdef UTF8
-#undef UTF8
-decodeCChar = UTF8.decode . map fromIntegral
-#define UTF8
-#else
-decodeCChar = map (toEnum . fromIntegral)
-#endif