summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Plugins/Monitors/Batt
diff options
context:
space:
mode:
authorUlrik de Muelenaere <ulrikdem@gmail.com>2024-03-30 10:42:03 -0400
committerUlrik de Muelenaere <ulrikdem@gmail.com>2024-03-30 10:42:03 -0400
commit9349871b9eb888d1d1b7f552ea40f8d348b16c1b (patch)
tree4fc1ada0d16328c18b01cea129488d43946e8c2d /src/Xmobar/Plugins/Monitors/Batt
parent8ed665cc20568e877b5400944dbfa752833971bc (diff)
downloadxmobar-9349871b9eb888d1d1b7f552ea40f8d348b16c1b.tar.gz
xmobar-9349871b9eb888d1d1b7f552ea40f8d348b16c1b.tar.bz2
Fix zombie processes left by <action> tag and low battery action
This effectively reverts c54d93e and 991a168. While those fix #687 and #688 respectively in the case where the configuration is recompiled, in all other cases they leave zombie processes, since they undo the fix for #181. However, instead of reverting to the deprecated system function, we use the newer spawnCommand and waitForProcess. And like with 991a168, the low battery action now runs in the background to avoid blocking the bar.
Diffstat (limited to 'src/Xmobar/Plugins/Monitors/Batt')
-rw-r--r--src/Xmobar/Plugins/Monitors/Batt/Common.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Xmobar/Plugins/Monitors/Batt/Common.hs b/src/Xmobar/Plugins/Monitors/Batt/Common.hs
index a07ba8b..ddb2b8c 100644
--- a/src/Xmobar/Plugins/Monitors/Batt/Common.hs
+++ b/src/Xmobar/Plugins/Monitors/Batt/Common.hs
@@ -18,7 +18,7 @@ module Xmobar.Plugins.Monitors.Batt.Common (BattOpts(..)
, Status(..)
, maybeAlert) where
-import System.Process (spawnCommand)
+import System.Process (spawnCommand, waitForProcess)
import Control.Monad (unless, void)
import Xmobar.Plugins.Monitors.Common
@@ -54,4 +54,4 @@ maybeAlert opts left =
case onLowAction opts of
Nothing -> return ()
Just x -> unless (isNaN left || actionThreshold opts < 100 * left)
- $ void $ spawnCommand x
+ $ void $ spawnCommand (x ++ " &") >>= waitForProcess