Moon-0xff / gnome-mpris-label

A music related GNOME extension.
GNU General Public License v3.0
50 stars 9 forks source link

Let customize cover height #71

Closed muerwre closed 11 months ago

muerwre commented 11 months ago

Please, add setting to customize icon height (or vertical paddings), so album cover won't take 100% of panel height.

g9

Moon-0xff commented 11 months ago

Icon height like the "Album art scaling" option?
Vertical padding to off center the album art up or down?

I'm not sure what you mean.

muerwre commented 11 months ago

@Moon-0xff, sorry, updated the issue description. The idea is to make cover look like other panel elements, like having margins and, maybe, a little border rounding.

Moon-0xff commented 11 months ago

Thanks for the visual aid! It looks like you want to reduce the value of the "Album art scaling" option. The default value is 60% to match with other elements in the panel, looks like yours is set to 100%.

And I like the idea of rounded corners, but I don't know if there's a good way of adding them (perhaps with CSS?).

muerwre commented 11 months ago

For me scale (now set to 50) only changes horizontal space around it (I'm on gnome-shell 44.3 btw). Rounding could be done with border-radius in CSS, but it's not as easy as I thought at first.

UPD: fixed height by changing Player.getArtUrlIcon to:

this.albumArt = new St.Icon({
    gicon: Gio.Icon.new_for_string(url),
    style_class: 'system-status-icon',
    icon_size: size - 8, // <-- here
    style: "padding: 0; border-radius: 10px;" // <-- sadly doesn't work :-(
})
Moon-0xff commented 11 months ago

I suppose we should decrease the minimum allowed value of the "Album art scaling" option then.

What you are doing there is decreasing the value that "Album art scaling" sets by 8 pixels more (less?). Basically:

icon_size: Math.floor(Main.panel.height*50/100) - 8;

The 50 comes from the "Album art scaling" setting.

It might be helpful to know what's your panel height. Can you run this command on the looking glass evaluator and show me the output?

>>> Main.panel.height

To open looking glass:

  1. Alt+F2 or whatever your "run command" shortcut is
  2. type lg

It might also be helpful to know the output of the entire thing. It might just be that 44 does math differently. Please also run and show:

>>> Math.floor(Main.panel.height*50/100) - 8
muerwre commented 11 months ago

Can you run this command on the looking glass evaluator and show me the output?

It's 64px, default for Manjaro gnome built-in theme, which is based in default, I suppose (?)

Math.floor(Main.panel.height*50/100) - 8

It's 24px

Moon-0xff commented 11 months ago

Helpful! Math is the same. I don't know why the percentage needs to be so low but in any case we only need to decrease the minimum value of "Album art scaling" to solve this.

I will push an update soon enough. You will need to choose 39% to get the same value when the update comes:

Math.floor(64 * 39 / 100)
Moon-0xff commented 11 months ago

Fix is already in main, just a one line diff.

I will update the extension when I have something else to add, I don't like to push small updates.

Thanks for raising this issue! I will close this when the next update is live.

muerwre commented 11 months ago

Thanks, it works as expected! (on this picture I've tried to figure out how to make round corners on St.Icon, sadly without any luck, so, don't look at the red artifacts around it).

image

Moon-0xff commented 11 months ago

For sure I would love to know if you get the rounded borders working!

Moon-0xff commented 11 months ago

Update is live. Thanks again!