Skip to content

Polybar kills all children of processes it spawns? #770

@apetresc

Description

@apetresc

So, I have a shell script that launches mpv in the background to connect to my remote MPD server:

$ cat $(which stream-mpd)
#!/bin/bash
pkill -f "mpv http://mysever"
mpv http://myserver &

If I launch this from the command line, everything works as it should, mpv runs in the background even if I close the terminal, etc. However, if I try to hook it up to my mpd module in polybar (so that I can actually listen to the stream that I am remote-controlling with the module) like so:

format-online = %{A3:stream-mpd:}<label-song> %{A}  <icon-prev> <icon-seekb> <icon-stop> <toggle> <icon-seekf> <icon-next>  <icon-repeat> <icon-random>

then something strange happens: the mpv process is killed as soon as stream-mpd exits. I can confirm this by adding a sleep 10 as the last line of my script: polybar will freeze up for 10 seconds since the script is running, but then once the 10 seconds are up, mpv is killed too! I can't explain why that happens - is polybar going out of its way to clean up the children of all the processes it spawns? Is there a way to accomplish what I'm after (which is to start a background task as an input trigger)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions