summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Plugins/Monitors/Batt
AgeCommit message (Collapse)Author
25 hoursremove " &" and fix zombie processesLéana 江
" &" was to avoid throwing an exception when the child process has a non-empty exitcode. However, the error-throwing function is callCommand and not spawnCommand, so removing " &" shouldn't change the semantic. https://codeberg.org/xmobar/xmobar/pulls/698#issuecomment-1722323 > callCommand seems to be the closest new function to system, but there > is a difference: it raises an exception if the child process has a > non-zero exit code. To preserve the exact behavior would require > something like spawnCommand (s + "&") >>= waitForProcess. I was able to reproduce zombie processes with the following steps: + running my own xmobar configuration + spawning a command that is long running (sleep 10) + sending SIGTERM to the xmobar process After doing so, the sleep command will continue to run. This PR uses withCreateProcess, which will always wait for the process to terminate, even when the main thread is asked to exit (SIGTERM). Note that SIGKILL is not expected to terminate the children.
4 daysuse Int insteadLéana 江
4 dayspass remaining battery percentage to low battery commandLéana 江
5 daysguard low battery alert behind heuristicsLéana 江
Previously low battery alerts only depend on the ac variable. The ac state that is rendered (racst) follows more heuristics. However this causes a discrepancy where xmobar can show the status is charging while continue to spawn low battery alerts. This PR fixes that by using the rendered ac state to decide whether the alert is sent.
2024-03-30Fix zombie processes left by <action> tag and low battery actionUlrik de Muelenaere
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.
2024-02-18battery: spawnCommand instead of system when running actions0.47.4jao
should fix for real #688 this time
2022-04-18Stylistic nits for previous Batt refactoring/fixjao
2022-04-18Split up battery reading functions; fixed unitsPatrick Günther
Every quantity is now read in its own function and Maybe and pattern matching is used for dealing with absent files. On top of that all units should be fixed now.
2022-04-16Fixed unit of battery power consumptionPatrick Günther
2021-10-08try to reorganize modules per osMichal Zielonka
We should make better split os specify code for FreeBSD and Linux. Idea comes from @liskin.