Window rule for CSD and/or Tiled state
Our prefer-no-csd flag is global and only applies to newly spawned applications. The reason for this is that many versions of SDL 2 shipped with a bug where if an xdg-decoration global is present at window creation but signals CSD preference, the window would never show up. So the way prefer-no-csd is implemented in niri is by straight up hiding the xdg-decoration global from all clients when it's off.
However, if the client already sees the xdg-decoration global, nothing prevents us from asking it to use CSD, so let's add a window rule like force-csd true for that. (prefer-no-csd combined with a blanket force-csd true rule will trigger the aforementioned SDL 2 bug, but we won't have that in the default config, so it's fine.)
The Tiled state is an entirely orthogonal concept from xdg-shell. Niri uses it together with prefer-no-csd because it makes GTK 4 and other clients square their rounded corners. It would also be useful to control that from a window rule, e.g. to switch from square-corner SSD to rounded-corner CSD for floating windows. Or to disable the Tiled state when prefer-no-csd is set for whatever reason. Something like tiled-state true/false.
Note that this prevents us from adding an is-tiled=true matcher so as not to introduce a window rule cycle. I think that a tiled state rule should be more useful than the tiled state matcher, so let's add the rule.
Really looking forward to this! The only window that I need to have csd is wezterm due to its resizing bug and I prefer not to have it applied globally. This would be an amazing update.
I believe wezterm recently merged the fix for that
I believe wezterm recently merged the fix for that
You're right! I just tried it and I can confirm this is now fixed. Thank you for the heads up! 🥳
Added tiled-state in 1c6037e6125870205a878f5267ffb02d3b02db64, force-csd not yet.
I was actually looking for a way to use prefer-no-csd in a window rule so that most of my apps use CSD except for my terminal and Neovide for example but if that's not possible then at least a force-csd true would be helpful for apps like Inkscape where I actually want a close button on some windows (mainly popup windows).
@dmac-au how about using KDE's decorations and adding rules which window should display decorations inside KDE settings?
Environment settings:
QT_QPA_PLATFORMTHEME "kde"
QT_QPA_PLATFORMTHEME_QT6 "kde"
KDE_FULL_SESSION "true"