rbn42 / panon

An Audio Visualizer Widget in KDE Plasma
GNU General Public License v3.0
191 stars 31 forks source link

no audio signal, no empty space #5

Closed kupiqu closed 4 years ago

kupiqu commented 4 years ago

I wish the widget would not occupy any space when there is no audio signal, so no empty space in the bar when there is no spectrum to show

rbn42 commented 4 years ago

Good idea, I can add it as option.

And we need a name for this option, but I am not good at speaking English. So do you know any good name for this option?

kupiqu commented 4 years ago

This is how it is done in Window Buttons (https://github.com/psifidotos/applet-window-buttons)

image

You don't need so many options though. You can choose what you think applies best to panon. With a plus if you could replicate the nice Window Buttons "Slice Out Animation" :)

rbn42 commented 4 years ago

Like this?

Show: Always visible
      Only when audio playing
kupiqu commented 4 years ago

Sure

kupiqu commented 4 years ago

On a second thought, I think it would be more informative if:

No audio signal: Preserve space
                 Hide

Because it's not really about showing (there is nothing to show anyways), it's about the space that the applet occupies.

rbn42 commented 4 years ago

I found it is hard to resize the plasmoid in runtime. Code below can extend the width to 400 when audio is available, but cannot reduce it to 0 when there is no audio signal. Don't know what did I miss comparing to https://github.com/psifidotos/applet-window-buttons.

Item{

    Layout.minimumWidth: show_spect? 400:0
    Layout.preferredWidth: Layout.minimumWidth
    Layout.maximumWidth: Layout.minimumWidth

    visible:false  // And visible property don't work

6

kupiqu commented 4 years ago

I would suggest taking a look to this functionality in applet-window-buttons:

https://github.com/psifidotos/applet-window-buttons/blob/master/package/contents/ui/main.qml

EDIT: Sorry, I read the email and missed that you were having window-buttons as a reference already

kupiqu commented 4 years ago

EDIT: Not sure qml needs whitespaces or not: perhaps you need a whitespace before ? in your code above, and/or around : in 400:0

rbn42 commented 4 years ago

I think I find the problem now. It comes from this

    Layout.fillWidth:  showMain ? true:false

This fillWidth property is not honored in Latte-Dock, after the property is changed by showMain. If this line is replaced by

    Layout.fillWidth:  false

it works, but then we lose the fillWidth option.

ShowMainChanged Event neither helps tell Latte-Dock not to fill width.

    onShowMainChanged:{
        root.Layout.fillWidth=showMain? true:false
    }
kupiqu commented 4 years ago

Mmm, I see, that's unfortunate. If there's no easy workaround to this, why not letting the users decide between the two options? Could this be done?

I actually set a fixed size (I prefer panon to be minimalistic and there's plenty of things in my latte panel already) so I would very much like panon not to occupy space if empty.

rbn42 commented 4 years ago

Could this be done?

No problem

rbn42 commented 4 years ago

Now we can hide the applet when no audio is available. b0509dba81851abd9ecdbad737d85701fe421e54

But there is still a trivia problem. ConfigGeneral.qml could not reload the value of autoHide every time you open the configuration window in Latte-Dock, while in plasmoidviewer it could. Weird to me.

edit: Oh, and I forgot to make an option for the slide out animation. Is it necessary?

edit: A workaround is to replace the RadioButton with a CheckBox or a ComboBox. I will leave the "RadioButton" version here in issue5 branch, and merge the "CheckBox" version into master branch.

rbn42 commented 4 years ago

Sorry, I accidentally closed this issue, it was not intended. I don't know how to remove that wrong commit from github.

kupiqu commented 4 years ago

It works great, thank you!

rbn42 commented 4 years ago

OK, then I will release a new version.