Use the KDE System Settings window decoration rules to force borders and shadows on specific applications. Navigate to Appearance, then Window Management, and select Window Rules. Create a new rule matching your target application’s class or name, then enable the "Force" options for border size and shadow under the Appearance section.
Many modern Linux applications are designed to be borderless, rendering their own title bars and controls internally. While this aesthetic is popular in tools like Discord, Slack, or certain web browsers, it can make window management difficult on a desktop environment like KDE Plasma. Users often struggle to resize these windows using the mouse or identify which window is active because standard visual cues are missing. In Kubuntu 23.10, the underlying window manager, KWin, provides powerful mechanisms to override these client-side decorations without breaking the application’s internal design. It is important to understand that you do not need to restart the window manager or modify environment variables to achieve this. Older guides might suggest runningkwin_x11 --replace or setting QT_QPA_PLATFORMTHEME=qt5ct, but these methods are obsolete for modern setups. The QT_QPA_PLATFORMTHEME variable primarily affects dialog styling rather than window decorations, and forcing a compositor replacement can break Wayland sessions entirely. Instead, we rely on KWin’s built-in Window Rules engine, which operates at the compositor level and works seamlessly with both X11 and Wayland sessions.
Navigating to Window Rules
The primary interface for customizing window behavior in KDE is the System Settings application. Open the menu and locate the Appearance section. Within Appearance, find the Window Management subsection. Here you will see several tabs, including General, Desktop Layout, and Window Rules. Click on Window Rules to access the configuration panel where individual application behaviors are defined. This section allows you to create global rules that apply to all windows of a specific type, or specific rules that only trigger when certain conditions are met. For adding borders and shadows, we will create a specific rule targeted at a single application. This ensures that other applications remain untouched and continue to function as intended by their developers.Creating a New Rule
Click the Add New Button button located at the top of the Window Rules list. A dialog will appear asking you to configure the properties. You can choose to match by Window Class, Window Title, or Application Name. For most applications, matching by Window Class is the most reliable method. If you are unsure of the class, you can use the Detect Properties tool, which lets you click on an open window to automatically fill in its details. Enter a descriptive name for the rule, such as "Add Border to AppName". Ensure that the option "Apply immediately" is checked so you can test the changes right away. Once created, the rule will appear in the list with a default set of properties. By default, most properties are set to "Default," meaning they inherit the global system settings. To change them, you must explicitly set them to "Force."Forcing Borders and Shadows
With your new rule selected, look at the list of properties on the right side. Scroll down to the Appearance section. You will find options for Border Size and Shadow. These options control how the window frame is rendered by KWin, independent of the application’s internal UI. First, locate the Border Size property. Change the dropdown from "Default" to "Force". In the adjacent field, enter the desired pixel width for the border. A value of 1 or 2 pixels is usually sufficient for a subtle outline, while larger values may look disjointed from the application’s native design. Next, locate the Shadow property. Change this from "Default" to "Force" as well. Enable the shadow effect if it was previously disabled globally, or adjust the strength if needed. Some users may also wish to control the Window Type or Geometry. However, for simply adding visual boundaries, adjusting Border Size and Shadow is sufficient. Click OK to save the rule. The changes should take effect immediately. If the application does not update visually, try minimizing and restoring the window, or restarting the application.Verifying the Configuration
To ensure the rule is working correctly, open the target application. Observe whether the border and shadow appear around the window frame. If they do not, return to System Settings and verify that the Window Class matches exactly. You can check the current window class by hovering over the window title bar and looking at the tooltip, or by using the command line toolwmctrl -l if you are comfortable with terminal commands.
If the rule conflicts with another existing rule, you may need to adjust the priority. Rules are applied in order, so placing your new rule higher in the list gives it precedence. You can reorder rules by dragging them up or down in the list within the Window Rules editor.
Troubleshooting Common Issues
Occasionally, users may find that the borders appear but the shadow does not, or vice versa. This can happen if the application uses strict opacity settings that interfere with KWin’s compositing effects. In such cases, you might need to disable specific effects for that window. Go back to Window Management, then Effects, and look for Compositing rules. You can add a rule to disable transparency or blur for the specific application if necessary. Another common issue arises if the application resizes incorrectly after adding a border. Since the border is now part of the window frame, the internal content area may shift. Most modern applications handle this gracefully, but older ones might require manual adjustment of the initial geometry. You can force an initial position or size in the Window Rules editor under the Geometry section, though this is rarely needed for simple border additions. For more complex customization needs, such as changing the color of the border or adding rounded corners, you may need to explore additional KWin scripts or themes. However, for basic visibility and usability improvements, the Window Rules engine is robust and sufficient. If you encounter persistent errors with KDE components during this process, refer to our guide on troubleshooting KDE errors to diagnose potential package conflicts. Additionally, ensuring your system packages are up to date is crucial for avoiding known bugs in recent KWin releases.Frequently Asked Questions
Will adding borders break the app's internal theme?
No, KWin renders the border outside the application’s client area. The internal UI elements remain controlled by the application itself. The border is purely a visual overlay managed by the window manager.
How do I remove a border I accidentally added?
Return to System Settings > Window Management > Window Rules. Find your rule and either delete it or change the Border Size property back to Default. The change applies immediately upon saving.
Does this work on Wayland sessions?
Yes, KWin’s Window Rules engine functions identically on both X11 and Wayland sessions in Kubuntu 23.10. No special configuration or session restarts are required.
Can I add borders to all windows at once?
You can create a global rule by leaving the detection criteria empty or broad. However, this is generally discouraged as it may interfere with games or fullscreen media players that require true borderless modes.
Why doesn't the shadow appear even though I forced it?
Check if the application has high opacity or transparency settings enabled. Some apps disable shadows for performance reasons. You may need to adjust the app’s internal settings or disable compositing effects for that specific window via the Effects settings.