[solved]Polybar MPD Module, limit label length?

So I can set up polybar like this and the “artist song album” label will go off the end of polybar/display if too long. Which is fine.

config:

   modules-left   = clock window_switch pkg memory temperature coreuse vpnstatus wireless-network
    modules-center =
    modules-right  = pulseaudio mpd

modules involved:

    [module/mpd]
    type = internal/mpd
    format-online        = %{A3:sonata & disown:}<icon-prev> <icon-stop> <toggle> <icon-next> <icon-random> <icon-consume> <label-song>%{A}
    format-offline       = <label-offline>
    bar-progress-format  = %{+o +u}%fill%%{-o -u}%indicator%%{+o +u}%empty%%{-u -o}
    label-offline        = mpd is off
    label-song = [%title%][%artist%][%album%]
    blablabla

[module/wireless-network]
type = internal/network
interface = wlp3s0

format-connected  = <label-connected>
format-packetloss = <animation-packetloss>
label-connected   = "%{A3:python /usr/bin/networkmanager_dmenu & disown:} %upspeed%  %downspeed% %{A}"
blabla

However, it would be nice if I could limit the length of the data to a preset number of characters, if I desired to place the mpd module on the left or center sections of polybar. At this point if I do, it will push the modules to the right off the end of the display/polybar with a long MPD label.

example config:

   modules-left   = clock window_switch pulseaudio mpd
    modules-center =
    modules-right  = pkg memory temperature coreuse vpnstatus wireless-network

When configured like this, the wireless-network data is usually forced off the right edge of Polybar with long MPD labels. Is there a way to limit the length of a label in polybar? I googleized the question with no googleanswer.

P.S.
I had to switch from archlabs polybar to polybar-git for the consume key in the MPD module, pulseaudio module and the wireless-network module to work. Just fyi easy fix.

1 Like

Hey FluffyUnicorn, have you thought of using conky. Just a thought. :thinking:

Hello sir,

What you are looking for (I believe) is something like this in your config:

label = %output:0:30:...%

Just FYI, this is more of a Polybar issues that you describe than a AL issue.

I think you are right.

OR @FluffyUnicorn try this in the module concerned:

label-maxlen = 40

label-song-maxlen = 1234

maxlen was it, thanks!

I dont think I expressed myself correctly if it appeared like a reference to AL. I just was unable to find the correct variable ie maxlen, not a AL issue at all. However, I was unable to use the pulseaudio module, the wireless-network module and the consume option with the MPD module with the AL polybar included with the last download. A switch to polybar-git enabled the use of those modules. I just want to explain that in case anyone wanted to try those options/modules mentioned in the 1st post if that is what your refering to.

I appreciate all the fine work and advice, thanks

much obliged.

Glad it worked out :smiley:

I did use conky+tint2 up until I was exposed to polybar thanks to Archlabs. I find polybar very sexy and a better fit for my needs.

Polybar is brilliant. I’m back on Tint2 but no doubt will make a return.

Well, it depends on what you want to do. I like to see system data and weather information on my desktop. Especially when I am doing heavy packaging. Right now now my CPU is running at full tilt at 100% all 4 threads going at 60 °C. Kinda watching that temp, I have never seen it go that high before. :thinking:

I see, got ya. Well I got alot of trinkets hanging on polybar hence the original reason for this thread. But also I got a minimalist streak I suppose. But yeah with the weather I too would need more display space.

Blow some canned air in there itl cool it down for a few seconds at least, heh

Yeah, it only lasted about five minutes then it dropped off to about 40°C when I got to the less makepkg duties. Then at rest it was at its normal 30°C. For a moment there I was going to have a barbecued gerbil! But I kinda like a busy desk. As soon as I get my system more stable, I’m going to write some code for conky modules that are strictly written in lua and compact if possible with as much information as possible. :neutral_face: