9
1
This is just a small annoyance, but I've made the XMonad configuration file load xmobar using this code:
xmproc <- spawnPipe "/use/bin/xmobar ~/.xmobarrc"
It works well, but it spawn a new xmobar process every time XMonad is reloaded. I wonder if there's an easy way to kill the old one?
update: As suggested by entropo, I've created a bash script like this one:
#!/bin/bash
for PID in `pgrep xmobar`; do
kill ${PID} > /dev/null &
done
/usr/bin/xmobar &
and call that script from XMonad configuration file.
For me this is creating 2 new processes each time I reload xmonad. Using spawnPipe creates 2 additional processes. ps -ax returns: "/bin/sh -c /.cabal/bin/xmobar ~/.xmobarrc:", "/bin/sh -c xmobar", "~/.cabal/bin/xmonad ~/.xmobarrc" and "xmobar". – fsanches – 2015-08-01T03:18:59.463
Reinstalling both fixed the issue in my commend above. – fsanches – 2015-08-01T03:42:52.113
1I'm pretty sure your
spawnPipe
will fork a process in a new thread. If you want to makespawnPipe
create a child process instead (one that closes when the main process does), I'm afraid you'll have to write your ownspawnPipe
function. – YoYoYonnY – 2017-05-06T02:04:53.250XMonad.Hooks.DynamicLog.xmobar
is defined in terms ofspawnPipe
... – bcc32 – 2018-05-14T05:17:18.903I tried n solutions already and none fixed the problem, the previous xmobar process isn't killed. The only way I could manage that was spawning a
killall "xmobar"
command. – ptkato – 2018-08-24T18:42:20.893An important point which was not mentioned is that you must have
Run StdinReader
(orRun UnsafeStdinReader
) in your xmobar config. TheStdinReader
implementation makes xmobar exit when it sees EOF on its stdin, which happens when xmonad closes its end of pipe during the restart. – Sergey Vlasov – 2019-02-15T12:31:11.3432Well, I've found the
spawnPipe
code on the XMonad website, it's really not easy to know where to look! But in the end, I prefer the technique I'm using as it is cleaner, usingDynamicLog
didn't kill the old process in my tests. I really like XMonad, but Haskell is not a good configuration language. – Nicolas Buduroi – 2011-04-10T15:21:49.6601Okay, whatever works for you is good in the end. But I think you are thinking about it wrong. You do not configure XMonad: you extend it. Haskell the prefect fit for extension. – Robert Massaioli – 2011-04-10T23:00:59.093