geommer / yabar

A modern and lightweight status bar for X window managers.
MIT License
681 stars 49 forks source link

ya_int_song: improve configuration of playerctl properties #180

Closed Ma27 closed 6 years ago

Ma27 commented 6 years ago

It's now possible to declare which properties from playerctl (supported are album, artist, title) should be shown in the song indicator. Before this, the usage of <artist> - <title> was hard-coded which wasn't that usable if artist and/or title were quite long, now it's up to the user what he wants to see.

The configuration can be used like this:

bar-list = ["bar"];
bar: {
  position: "top";
  block-list: ["ya_song"];
  ya_song: {
    exec: "YABAR_SONG";
    internal-option1: "spotify";
    internal-option3: "title artist album";
  }
}
Ma27 commented 6 years ago

This is the output of the third build (the two gcc builds are fine):

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/d/docbook-xml/docbook-xml_4.5-7.2_all.deb  Unable to connect to archive.ubuntu.com:http: [IP: 91.189.88.152 80]

Retriggering the build should fix that.

Ma27 commented 6 years ago

This won't work because there are only three options hardcoded for each internal block:

ahh didn't know about that as I used some of th eprovided defaults during testing :-)

Will try to find a better approach to fix that %)

Ma27 commented 6 years ago

You could remove one of the options or increase the size of the array.

@NBonaparte as you suggested I removed one of the options. The default segregator for properties such as title or album is - which will be used for now. I don't think it's worth to work on yabar's internals or use some scanf hackery to load seperator and other values out of a single property.

Ma27 commented 6 years ago

done. You're right, I added a sscanf-based parser here for performance reasons and used ` rather than;as separator token. Furthermore I hardcoded a maximum of three properties (album, title, artist) in any order, however it's still possible to just saytitle albumif you're not interested in theartist`.

Ma27 commented 6 years ago

@NBonaparte anything to be added here?

NBonaparte commented 6 years ago

Sorry, this seems to have slipped through. I'll check it within the next few days.

Ma27 commented 6 years ago

@NBonaparte done :)