diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2011-01-27 00:39:37 +0100 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2011-01-27 00:39:37 +0100 |
commit | ed50d0cb4b1e46a6fa531e610c0d8025d12a62ae (patch) | |
tree | 507ce92bdc30de14417d99cb2e0df05cc23071d3 /scripts | |
parent | 8c8f4e1dc6706146655e1ca8fc8784324350f056 (diff) | |
download | xmobar-ed50d0cb4b1e46a6fa531e610c0d8025d12a62ae.tar.gz xmobar-ed50d0cb4b1e46a6fa531e610c0d8025d12a62ae.tar.bz2 |
xmonadpropwrite.hs back to the source package
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/xmonadpropwrite.hs | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/scripts/xmonadpropwrite.hs b/scripts/xmonadpropwrite.hs deleted file mode 100644 index f3f4a5d..0000000 --- a/scripts/xmonadpropwrite.hs +++ /dev/null @@ -1,41 +0,0 @@ --- Copyright Spencer Janssen <spencerjanssen@gmail.com> --- Tomas Janousek <tomi@nomi.cz> --- BSD3 (see LICENSE) --- --- Reads from standard input and writes to an X propery on root window. --- To be used with XPropertyLog: --- Add it to commands: --- Run XPropertyLog "_XMONAD_LOG_CUSTOM" --- Add it to the template: --- template = "... %_XMONAD_LOG_CUSTOM% ..." --- Run: --- $ blah blah | xmonadpropwrite _XMONAD_LOG_CUSTOM - -import Control.Monad -import Graphics.X11 -import Graphics.X11.Xlib.Extras -import qualified Data.ByteString as B -import Foreign.C (CChar) -import System.IO -import System.Environment - -main = do - atom <- flip fmap getArgs $ \args -> case args of - [a] -> a - _ -> "_XMONAD_LOG" - - d <- openDisplay "" - xlog <- internAtom d atom False - ustring <- internAtom d "UTF8_STRING" False - - root <- rootWindow d (defaultScreen d) - - forever $ do - msg <- B.getLine - changeProperty8 d root xlog ustring propModeReplace (encodeCChar msg) - sync d True - - return () - -encodeCChar :: B.ByteString -> [CChar] -encodeCChar = map fromIntegral . B.unpack |