Warning, /plasma/kwin/CONTRIBUTING.md is written in an unsupported language. File is not indexed.

0001 # Contributing to KWin
0002 
0003 ## Chatting
0004 
0005 Come on by and ask about anything you run into when hacking on KWin!
0006 
0007 KWin's Matrix room on our instance is located here: https://matrix.to/#/#kwin:kde.org.
0008 You can grab an Matrix account at https://webchat.kde.org/ if you don't already have one from us or another provider.
0009 
0010 The Matrix room is bridged to `#kde-kwin` on Libera, allowing IRC users to access it.
0011 
0012 ## What Needs Doing
0013 
0014 There's a large amount of bugs open for KWin on our [Bugzilla instance](https://bugs.kde.org/describecomponents.cgi?product=kwin).
0015 
0016 ## Where Stuff Is
0017 
0018 Everything codewise for KWin itself is located in the `src` directory.
0019 
0020 ### Settings Pages / KCMs
0021 
0022 All the settings pages for KWin found in System Settings are located in `src/kcmkwin`.
0023 
0024 ### Default Decorations
0025 
0026 The Breeze decorations theme is not located in the KWin repository, and is in fact part of the [Breeze repository here](https://invent.kde.org/plasma/breeze), in `kdecoration`.
0027 
0028 ### Tab Switcher
0029 
0030 The default visual appearance of the tab switcher is not located in the KWin repository, and is in fact part of [Plasma Workspace](https://invent.kde.org/plasma/plasma-workspace), located at `lookandfeel/contents/windowswitcher`.
0031 
0032 Other window switchers usually shipped by default are located in [Plasma Addons](https://invent.kde.org/plasma/kdeplasma-addons), located in the `windowswitchers` directory.
0033 
0034 ### Window Management
0035 
0036 Most window management stuff (layouting, movement, properties, communication between client<->server) is defined in files ending with `client`, such as `x11client.cpp` and `xdgshellclient.cpp`.
0037 
0038 ### Window Effects
0039 
0040 Window effects are located in `src/plugins`, one effect plugin per folder.  Folder `src/plugins/private` contains the plugin (`org.kde.kwin.private.effects`) that exposes layouting properties and `WindowHeap.qml` for QML effects.  Not everything here is an effect as exposed in the configuration UI, such as the colour picker in `src/plugins/colorpicker`.
0041 
0042 Of note, the Effects QML engine is shared with the Scripting components (see `src/scripting`).
0043 
0044 ### Scripting API
0045 
0046 Many objects in KWin are exposed directly to the scripting API; scriptable properties are marked with Q_PROPERTY and functions that scripts can invoke on them.
0047 
0048 Other scripting stuff is located in `src/scripting`.
0049 
0050 ## Conventions
0051 
0052 ### Coding Conventions
0053 
0054 KWin's coding conventions are located [here](doc/coding-conventions.md).
0055 
0056 KWin additionally follows [KDE's Frameworks Coding Style](https://community.kde.org/Policies/Frameworks_Coding_Style).
0057 
0058 ### Commits
0059 
0060 We usually use this convention for commits in KWin:
0061 
0062 ```
0063 component/subcomponent: Do a thing
0064 
0065 This is a body of the commit message,
0066 elaborating on why we're doing thing.
0067 ```
0068 
0069 While this isn't a hard rule, it's appreciated for easy scanning of commits by their messages.
0070 
0071 ## Contributing
0072 
0073 KWin uses KDE's GitLab instance for submitting code.
0074 
0075 You can read about the [KDE workflow here](https://community.kde.org/Infrastructure/GitLab).
0076 
0077 ## Running KWin From Source
0078 
0079 KWin uses CMake like most KDE projects, so you can build it like this:
0080 
0081 ```bash
0082 mkdir _build
0083 cd _build
0084 cmake ..
0085 make
0086 ```
0087 
0088 People hacking on much KDE software may want to set up [kdesrc-build](https://invent.kde.org/sdk/kdesrc-build).
0089 
0090 Once built, you can either install it over your system KWin (not recommended) or run it from the build directory directly.
0091 
0092 Running it from your build directory looks like this:
0093 ```bash
0094 # from the root of your build directory
0095 
0096 source prefix.sh
0097 cd bin
0098 
0099 # for wayland, starts nested session: with console
0100 
0101 env QT_PLUGIN_PATH="$(pwd)":"$QT_PLUGIN_PATH" dbus-run-session ./kwin_wayland --xwayland konsole
0102 
0103 # or for x11, replaces current kwin instance:
0104 
0105 env QT_PLUGIN_PATH="$(pwd)":"$QT_PLUGIN_PATH" ./kwin_x11 --replace
0106 
0107 ```
0108 
0109 QT_PLUGIN_PATH tells Qt to load KWin's plugins from the build directory, and not from your system KWin.
0110 
0111 The dbus-run-session is needed to prevent the nested KWin instance from conflicting with your session KWin instance when exporting objects onto the bus, or with stuff like global shortcuts.
0112 
0113 If you need to run a whole Wayland plasma session, you should install a development session by first building [plasma-workspace](https://invent.kde.org/plasma/plasma-workspace) and executing the `login-sessions/install-sessions.sh` in the build directory. This can be done using kdesrc-build.
0114 
0115 ```bash
0116 kdesrc-build plasma-workspace
0117 # assuming the root directory for kdesrc-build is ~/kde
0118 bash ~/kde/build/plasma-workspace/login-sessions/install-sessions.sh
0119 ```
0120 Then you can select the develop session in the sddm login screen.
0121 
0122 You can look up the current boot kwin log via `journalctl --user-unit plasma-kwin_wayland --boot 0`.
0123 
0124 ## Using A Debugger
0125 
0126 Trying to attach a debugger to a running KWin instance from within itself will likely be the last thing you do in the session, as KWin will freeze until you resume it from your debugger, which you need KWin to interact with.
0127 
0128 Instead, either attach a debugger to a nested KWin instance or debug over SSH.
0129 
0130 ## Tests
0131 
0132 KWin has a series of unit tests and integration tests that ensure everything is running as expected.
0133 
0134 If you're adding substantial new code, it's expected that you'll write tests for it to ensure that it's working as expected.
0135 
0136 If you're fixing a bug, it's appreciated, but not expected, that you add a test case for the bug you fix.
0137 
0138 You can read more about [KWin's testing infrastructure here](doc/TESTING.md).