summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Run
diff options
context:
space:
mode:
authorTomas Janousek <tomi@nomi.cz>2020-02-22 22:06:48 +0000
committerTomas Janousek <tomi@nomi.cz>2020-02-22 23:09:49 +0000
commite662431a5cef5eacd68b987610f2d434fa687844 (patch)
tree31c9fd4f7c57490438b565de3ace2d13b171020e /src/Xmobar/Run
parent32fc8214c567c7f4a4caad10fab98c760a1685b7 (diff)
downloadxmobar-e662431a5cef5eacd68b987610f2d434fa687844.tar.gz
xmobar-e662431a5cef5eacd68b987610f2d434fa687844.tar.bz2
Timer coalescing: gracefully uncoalesce slow timers
The first implementation assumed all timers (monitors) are fast and frequent (which happens to be the case in my configuration). This meant that a single on-line weather monitor could block the entire xmobar instance for a long time due to the refresh pausing (meant to reduce power consumption). This commit attempts to fix that by limiting the refresh pause time and using the old periodic sleep method for these slow timers (monitors).
Diffstat (limited to 'src/Xmobar/Run')
-rw-r--r--src/Xmobar/Run/Exec.hs12
1 files changed, 1 insertions, 11 deletions
diff --git a/src/Xmobar/Run/Exec.hs b/src/Xmobar/Run/Exec.hs
index ad68232..d8cf81a 100644
--- a/src/Xmobar/Run/Exec.hs
+++ b/src/Xmobar/Run/Exec.hs
@@ -21,20 +21,10 @@ module Xmobar.Run.Exec (Exec (..), tenthSeconds, doEveryTenthSeconds) where
import Prelude
import Data.Char
-import Control.Concurrent
-import Xmobar.App.Timer (doEveryTenthSeconds)
+import Xmobar.App.Timer (doEveryTenthSeconds, tenthSeconds)
import Xmobar.System.Signal
--- | Work around to the Int max bound: since threadDelay takes an Int, it
--- is not possible to set a thread delay grater than about 45 minutes.
--- With a little recursion we solve the problem.
-tenthSeconds :: Int -> IO ()
-tenthSeconds s | s >= x = do threadDelay (x * 100000)
- tenthSeconds (s - x)
- | otherwise = threadDelay (s * 100000)
- where x = (maxBound :: Int) `div` 100000
-
class Show e => Exec e where
alias :: e -> String
alias e = takeWhile (not . isSpace) $ show e