summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@ing.unitn.it>2007-06-19 19:40:06 +0200
committerAndrea Rossato <andrea.rossato@ing.unitn.it>2007-06-19 19:40:06 +0200
commit2b650e23f080abaad4053f7dac51af315109d5f5 (patch)
tree9695785417da9811fbb1c4660516e2dc6e4a445f
parent37c2ce906137f4e9f8d5d11fc44082083e77abe2 (diff)
downloadxmobar-2b650e23f080abaad4053f7dac51af315109d5f5.tar.gz
xmobar-2b650e23f080abaad4053f7dac51af315109d5f5.tar.bz2
added a refresh rate configuration option
darcs-hash:20070619174006-d6583-810248e638d7062b41fd7ae771b625ac1a5164c5.gz
-rw-r--r--xmobar.config-sample1
-rw-r--r--xmobar.hs4
2 files changed, 5 insertions, 0 deletions
diff --git a/xmobar.config-sample b/xmobar.config-sample
index 69b068c..289af9b 100644
--- a/xmobar.config-sample
+++ b/xmobar.config-sample
@@ -5,4 +5,5 @@ Config { fonts = "-misc-fixed-*-*-*-*-*-*-*-*-*-*-*-*"
, yPos = 0
, width = 1024
, hight = 15
+ , refresh = 10
}
diff --git a/xmobar.hs b/xmobar.hs
index 00e85be..7b0360e 100644
--- a/xmobar.hs
+++ b/xmobar.hs
@@ -44,6 +44,7 @@ import Graphics.X11.Xlib.Misc
import Text.ParserCombinators.Parsec
import Control.Monad
+import Control.Concurrent
import System.Environment
-- $config
@@ -58,6 +59,7 @@ data Config =
, yPos :: Int -- ^ y Window position
, width :: Int -- ^ Window width
, hight :: Int -- ^ Window hight
+ , refresh :: Int -- ^ Refresh rate in tenth of seconds
} deriving (Eq, Show, Read, Ord)
defaultConfig :: Config
@@ -69,6 +71,7 @@ defaultConfig =
, yPos = 0
, width = 1024
, hight = 15
+ , refresh = 10
}
-- $main
@@ -131,6 +134,7 @@ drawInWin config (dpy, win) str = do
freeGC dpy gc
sync dpy True
-- back again: we are never ending
+ threadDelay $ 100000 * refresh config
eventLoop config