I can't figure out where I'm supposed to call for this script to run, on account of I'm real dumb. Little help?
The mpdupdate script? The one in i3blocks?
That's the one. Didn't mean to be vague, apologies. I assume it pairs in some way with the music script, which has an interval of once in his i3blocks config, but it's not obvious to me where the mpdupdate script comes into use.
No worries, I understood what you meant. I'm not too familiar but here is what I would suggest. It seems that possibly mpd block is either a) Missing and you need to add a new block in the i3blocks config which would be called mpupdate, under music would be a good place for it. Then mod + f2 to refresh i3 and there might be the mod block in your statusbar taking advantage up the mpupdate script b) you just need to launch the music player of larbs and play music, it might show mpd block then. Sorry I'm not more familiar, I use a heavy modified version of larbs and don't use mpd.
For giggles you could just grep mpdupdate /home and see where that takes you
You never call the mpdupdate script. It is more like a background "daemon" script that is called by xprofile when you start the graphical environment. What mpdupdate does is wait for a change in mpd (a change of songs or pausing, etc.) and will update the music status block whenever something happens.
@LukeSmithxyz the mpdupdate script doesn't seem to work when I install lightdm on top of LARBS, I did this so that I can have multiple WM's, the music plays but the bar doesn't get updated
Depending on when you installed LARBS, you might be using an older version where mpdupdate is called in xinitrc, which wouldn't be run if you are using a DM. Is that the case?
I decided it would be a better learning experience to start with my own barebones install of i3 and try to take what I found useful from LARBS in sort of an a la carte fashion.
Anyway, thanks for the help. I log in from TTY, so I just threw it in .xinit and voila!
Aaand I'm struggling again. I don't know why it mysteriously seemed to work the first time, but I do know the issue right now: mpdupdate runs cat on a file that doesn't exist, /tmp/mpdupdate.
I can't find where this is done, but I'm guessing you somehow echo information from mpd into this file and then mpdupdate cats it out to the block?
Sorry for the delay. I'll explain how this works if you haven't figured it out yourself already:
kill -0 "$(cat /tmp/mpdupdate)" 2>/dev/null && exit || echo $$ > /tmp/mpdupdate
The above line kills any previous instance of mpdupdate running because there was an issue of multiple instances getting started and wasting system resources. When you first run the script, there should be no /tmp/mpdupdate file, so the kill command will fail and the script will thus run the command after the || since the last command failed, which echoes $$ (which means the process number of the current mpdupdate command) to /tmp/mpdupdate.
If mpdupdate gets called again, it will find the /tmp/mpdupdate file, read it and kill that process id, which would be the previous mpdupdate command. This way there is only one loop at a time.
This is how it's supposed to work.
Now was something wrong in addition to that?
Most helpful comment
Depending on when you installed LARBS, you might be using an older version where
mpdupdateis called inxinitrc, which wouldn't be run if you are using a DM. Is that the case?