Little KWin Helpers

15 hours ago 2

KWin, our fantastic and flexible window manager and Wayland compositor, can not just drive your session but also run in windowed mode for development purposes:

$ dbus-run-session kwin_wayland --exit-with-session kwrite

Et voila, a windowed KWin appears, running KWrite. The separate DBus session is important so it doesn’t mess with your running session, notably trying to take over your global shortcuts.

A black window “KDE Wayland Compositor” containing a KWrite editor windowKWrite running inside KWin Wayland running inside KWin Wayland

Speaking of shortcuts: when grabbing the mouse (press right Ctrl), it now blocks the session’s global shortcuts. This makes it behave more like a full “input grab” on X11. As a result, you can now use global shortcuts in your windowed KWin, for instance to more easily trigger the Overview effect (Meta+W), if you want to work on it without affecting your running session.

KWin also includes a debug console that lets you inspect open windows, see input devices and events, the state of the clipboard, load and unload desktop effects, and so on. We particularly moved developer-facing desktop effects (like the “Compositing” indicator or FPS effect that isn’t a benchmark™) from System Settings to the debug console. You can access it by typing “kwin” in KRunner and selecting “KWin Debug Console”. Mind that it’s a developer tool, so function definitely outdoes form.

After a recent bug report about a blurry window icon in the Alt+Tab window switcher, I noticed that we didn’t include any information about the window’s icon. It would have been helpful to see the icon name used, if any, and what sizes were available. In fact, there were a couple of window properties using custom types that the debug console didn’t know how to visualize. I therefore added a couple of custom converters to the tree model:

  • QIcon, (e.g. window icon): Display the icon, its name, and list of available sizes. Generally, for properties of Window type, such as dialog parent (transient parent), also show the window icon
  • KWin::Output: the name of the output, its geometry, and scale factor
  • KWin::Tile (quick tile and custom tiles): its geometry, shape (e.g. floating) and/or quick tile mode (e.g. left/right)
  • KWin::VirtualDesktop: its name
  • QPalette (e.g. window color scheme): show a 2×2 grid of important theme colors, similar to the application color scheme selector we have in many apps
KWin’s Debug Console showing a list of window properties (color scheme, desktop file name, height, icon, etc)A lot more value in the debug console window list

With that, the list of windows becomes much more useful and nicer looking. For those who prefer a command-line tool, David Redondo added a little kwindowprop application similar to xwininfo that prints information about a given window.

Read Entire Article