[TabBox] Thumbnail Grid window switcher
ClosedPublic

Authored by Zren on Jan 15 2020, 2:21 AM.

Details

Summary

Cleaned up my code from https://github.com/Zren/kwin-tabbox-thumbnail_grid

The column is calculated recursively, but survived a stress test.
https://github.com/Zren/kwin-tabbox-thumbnail_grid/pull/2

I tested when "show desktop" is configured to be hidden since I know it didn't like it with modding by 0 items in the python test. "show desktop" will show up on an empty desktop though so there's always at least 1 item it seems.

I wrote a python script to easily test the recursive column calculation with __ number of windows.
https://github.com/Zren/kwin-tabbox-thumbnail_grid/blob/master/test_recursion.py

Outlined:

Diff Detail

Repository
R114 Plasma Addons
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
Zren created this revision.Jan 15 2020, 2:21 AM
Restricted Application added a project: Plasma. · View Herald TranscriptJan 15 2020, 2:21 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
Zren requested review of this revision.Jan 15 2020, 2:21 AM
romangg requested changes to this revision.Jan 15 2020, 1:25 PM
romangg added a reviewer: Plasma.
romangg added a subscriber: romangg.

Nice. Let's fix these few issues and get it merged before tomorrow. Other small issues can be fixed in beta phase.

windowswitchers/thumbnail_grid/contents/ui/main.qml
183

It works for me if you keep it height: parent.height.

184

This must be width: parent.height. implicitWidth is a read-only property. WIthout this change the qml file won't load.

231

trailing white space

This revision now requires changes to proceed.Jan 15 2020, 1:25 PM
davidedmundson added inline comments.
windowswitchers/thumbnail_grid/contents/ui/main.qml
184

you can use Layout.preferredWidth

One shouldn't specifiy a width/height from an item inside a layout

davidedmundson added inline comments.Jan 15 2020, 1:44 PM
windowswitchers/thumbnail_grid/contents/ui/main.qml
232

GridView has it's own input handling you shouldn't need this anyway.

If keyboard doesn't work, chances are your activeFocus is incorrect.

I can only see focus: true on

id: dialogMainItem

it should be on the gridview instead

zzag added a subscriber: zzag.Jan 15 2020, 2:08 PM
zzag added inline comments.
windowswitchers/thumbnail_grid/contents/ui/main.qml
2

Bad file permissions. Needs to be 644.

75–77

You could use const here

const c = ...

const residue = ...
Zren added inline comments.Jan 15 2020, 6:51 PM
windowswitchers/thumbnail_grid/contents/ui/main.qml
184

Uhg, I was using width: parent.height and height: parent.height but changed it when cleaning it up. I must've not staged all the changes before diffing. This has made me notice another bug though.

By using height: parent.height, I was basically setting it at height: 22, which is smaller than the "close button" which is 30x30.

width: parent.height
height: parent.height

Layout.fillHeight: true
Layout.minimumWidth: height
Layout.maximumWidth: Layout.minimumWidth

This makes the icon slightly larger than I'm used to.

I've also noticed why I added clip: true to the KWin.ThumbnailItem, apparently the close button is 30x30, which is taller than the captionRow.height: 22. Here's a look at the overflow after removing clip: true and clipTo: parent:
Outlines with: Rectangle { anchors.fill: parent; border.color: "#f00"; border.width: 1; color: "transparent" }

I've fixed it all in the latest diff:


232

Arrow keys work. Sorry, forgot to this comment.

Zren updated this revision to Diff 73648.Jan 15 2020, 7:07 PM
Zren edited the summary of this revision. (Show Details)

Fix implicitWidth error by using Layout.min/maxWidth.
Scale captionRow.spacing by dpi.
Take into account the close button is 30x30.
Use a ColumnLayout for thumbnailGridItems instead of anchoring.
Add Item container for KWin.ThumbnailItem so it's not cliping the bottom of the window thumbnail.
Remove "keybindings don't work" comment that no longer applies.
Use const for function variables.
644 (RW-R--R--) file permission.

romangg accepted this revision.Jan 15 2020, 11:53 PM
romangg added inline comments.
windowswitchers/thumbnail_grid/contents/ui/main.qml
184

Yea, just tested it again and looks good!

This revision is now accepted and ready to land.Jan 15 2020, 11:53 PM
This revision was automatically updated to reflect the committed changes.