Getting started with KWin on Fedora KDE 36,38,39 on Plasma (x11)
In the following it is shown how to init the KWin session manager on Fedora
36,38,39 KDE Plasma, (x11).
(Just before to begin, you can experiment the very instructive case of one virtual desktop. On most machines, it reveals the structure of init files designed by KWin.)
Here, as an example we select a screen organisation equipped with 4xVirtual Desktops. Firt, in ‘Desktop Session > System Settings > Starting & Shutdown >’ start by making a general KWin reset by selecting the option:
.Empty session
and reboot the PC. Then, ~/.config/session/ must be empty and a small file (~33 octets) should appear as ~/.config/ksmserverrc. Next, in ‘Desktop Session > System Settings > Starting & Shutdown >’ select the option:
.session saved manually by the user
Then choose the windows position on screen, for example with a console at the right part of the monitor; do the same for each other Virtual Desktops. Select the size, width, height, position and profile. One goal of KWin is to save the above screen arrangement so that it will be redesigned at any next login. To get this, you need to save all Virtual Desktops by running the QDBus command line:
DISPLAY=:0.0 qdbus org.kde.ksmserver /KSMServer org.kde.KSMServerInterface.saveCurrentSession
Here, DISPLAY=:0.0 means that all virtual Desktops will appear on the first monitor (0.0) connected to your PC. For the second monitor, instead one should use DISPLAY=:0.1
Next, if the processor used is old, wait ~5 seconds before to Reboot the PC. Then, you will get on the screen the previous desktop arrangement. And you will find in ~/.config/session/ a set of konsole_x_y_z… and a kwin_* file as:
~/.config/session/‘kwin_saved by user_’
Also, a KWin inner server is designed by KWin, which is able to re-read the saved data at any next login-in:
~/.config/ksmserverrc
Finally to end the init process, select in ‘Desktop Session > System Settings >
Starting & Shutdown >’ the last option:
.session saved at last logout
This last step allows to recover the screen organisation including the consoles size, position… (and after the init process, the programs activated on the mainwindows just when the PC is stopped. So, at next login, all last tasks will be returned). Launch the previous QDBus command line. Wait more or less 5 seconds, if you do work on a old machine. Reboot the PC. This last step close the init process of the ‘4xVirtual Desktop’ session. As previouly KWin will produce a konsole_w_q_v file and a file: ‘kwin_saved at last logout_’ In the same time new data will be written in ksmserverrc.
Note that out of caution the above session (including the konsole_x_y_z_,
konsole_w_q_v_, the two kwin_* files and the server ksmserverrc) can be moved somewhere in order to be re-used subsequently. When needed this frees up space where another session can be designed.
Here, rather than to design a collection of different sessions, one can check the present init process by re-reading via KWin all screen settings. To do that, select again the second option:
.session saved manually by user
But now, ‘logout-login in’ the machine with the same user, to verify the screen arrangement as well as the KWin system: the two kwin_files should be identical.
Note: As one might think, the goal of the KWin’s developer was(?) to reduce
the init process complexity because the two konsole_* files designed by KWin can be deduced from each other. So that the initializing Kwin’s last option could become useless. It is this feature which is used in ‘rouleta/A Band-Aid for KWin’ GitHub. However, in common use, both screen settings chosen for the Kwin options could be different.