Zren / plasma-applet-commandoutput

https://store.kde.org/p/1166510/
GNU General Public License v2.0
87 stars 18 forks source link

Widget size stability #22

Closed Almtesh closed 3 years ago

Almtesh commented 3 years ago

Hello,

I installed this widget on Plasma 5.18.5 on Kubuntu 20.04 and I have a problem on the size of the widget. Every time the command executes, the widget can be resized randomly. Sometime, the new size makes the widget to put itself over or under another widget. Screenshot_20201005_214505 The text in this instance does not really change, but I can't get it smaller for a long time.

I saw in the code that there is an option to stabilise the size, but the option does not appear in the settings: Screenshot_20201005_214758

Almtesh commented 3 years ago

I tryed to look at this code I don't know in a language I don't know, is my problem related to lines 189 to 199 property in package/content/ui/main.qml? I don't know what you mean in "FixedWidth".

Zren commented 3 years ago

Fixed width/height is hidden for desktop widgets as it sets Layout.preferredWidth which will set the width in the panel. For a desktop widget, Layout.preferredWidth is ignored. I don't set Layout.maximumWidth as it wasn't necessary.

What's probably happening is that your output has lots of extra spaces after the text before the newline?

Though I just tried it in manjaro. For some reason it wouldn't shrink smaller than this height at first. I could change the width no problem.

2020-10-05___19-33-08

After a few seconds I could shrink it a little bit smaller:

2020-10-05___19-34-04

Then finally I could shrink it to:

2020-10-05___19-35-16

However after a few seconds it resized automatically to this. Probably after the command ran again and the text was updated.

2020-10-05___19-35-45

Zren commented 3 years ago

My guess is that Text.implicitWidth uses up as much width as possible if there's a newline. Perhaps I should use Text.contentWidth.

Almtesh commented 3 years ago

Surely, I don't know QML. For info, my command is upsc ups@nut-server | grep -E 'battery.charge:|input.frequency:|input.voltage:|output.frequency:|output.voltage:|ups.power:|ups.realpower:'. When I execute is on a shell, I don't get extra spaces before new lines.

Almtesh commented 3 years ago

Actually, I think you might do two things:

  1. add an option to disable widget auto-resize according to output's size.
  2. improve the auto-resize.
Almtesh commented 3 years ago

Hello,

Do you need about that? I could try to get a look on it, if you want.

Zren commented 3 years ago

Sorry, I fixed it pretty quick, but wanted to test it overnight + after restarting and forgot about pushing the release. Should be fixed in v11.

Almtesh commented 3 years ago

I hate myself asking you that, but how can I install the new version? I can't find the updater.

Zren commented 3 years ago

If you go to "Add Widgets > Get New Widget > Download", the GUI should be able Update the widget. If that doesn't work (there's recently been a bug), then download the git repo and run:

kpackagetool5 --type=Plasma/Applet --upgrade ./package/
Almtesh commented 3 years ago

OK, thanks, widget updated and working as expected.