Closed mthw0 closed 3 years ago
I can reproduce in Gnome Chess. My Firefox has a userChrome.css
that swapped the Breeze for Window's like buttons, so I'll test that later.
CSD should be controlled by the GTK theme. Atm I can't even find the "Gtk Theme" module in System Settings however. Or the Qt theme module (which should be the same module now). Weird.
Wow, neat. It appears changing Windows Decorations will now "paint" the decorations as .svg
in ~/.config/gtk-3.0/assets/
. So cool!
It's drawing a 50x50 icon. However my icon is only 10x10.
Normally my buttons are 32x24. With the icon 11x11.
Since my Gtk theme only has a 39px tall headerbar, the icon is even smaller. 39/50 * 10 = 7.8px
.
There must be padding above/below the icon button however, as the icon looks like it's only 6x6 in the CSD. Perhaps the button is only 32x32? 32/50 * 10 = 6.4px
I don't appear to scale the buttons in Qt apps. VeryLarge = 34px tall, Medium = 24px tall, Tiny = 20px tall. Icons are always 11x11.
Hmm, do I even scale the buttons for HiDPI?
I need to scale the 10x10 rect in Button::paint
.
If I scale the icon by buttonRect.height() * 10/24
, I get:
Unfortunately, it doesn't appear to affect the gtk theme in ~/.config/gtk-3.0/assets/*.svg
. I event switched to Breeze then back to Material.
Button.cc
Code:
const QRectF buttonRect = geometry();
int iconSize = qRound(buttonRect.height() * 10/24);
QRectF iconRect = QRectF(0, 0, iconSize, iconSize);
qCDebug(category) << "Button::paint" << buttonRect << (buttonRect.height() * 10/24) << iconSize << iconRect;
iconRect.moveCenter(buttonRect.center().toPoint());
There's a cache of some sort I think. I added an extra line the maximize icon, but it was not reflected in the gtk assets.
Looks like it renders to /tmp/plasma-csd-generator/
first. It's empty though, so it's not cached.
I needed to reboot for changes to take effect. So whatever process uses kde-gtk-config
is loaded in needs to be restarted, just like I need to restart kwin_x11
to test changes to the normal window decorations.
Had to also scale the line thickness. It's a bit blurry still since we're scaling the icon by 50/18 = 2.777
so it's a pain to get sharp lines for the minimize and maximize lines.
"Very Large" KWin buttons on top, with Chess Gtk CSD below:
In https://github.com/Zren/material-decoration/commit/65fe6f577a978a9e601241d29bea35185eb7f69c, I check if the process is kded5
, and use a smaller padding around the icon. I can't easily get the button to use sharp lines, but at least the icons are visible now.
It looks good now, thanks.
In Plasma 5.20, close, maximize, and minimize buttons now try to use the same look as buttons in SSDs resulting in very small buttons when your window decorations are used. Is this an issue on your side or is there something wrong on the Plasma side? This is a screenshot from Firefox with CSDs enabled:
It looks the same in gtk3-demo. This issue was also reported on the KDE bug tracker: https://bugs.kde.org/show_bug.cgi?id=426670 Could you look into this?