KWin Rules Examples
Examples
The environment in these examples has eight Virtual Desktops.
The first example details all the steps. Subsequent examples only list steps specific to the example.
Pin a Window to a Desktop and set other Attributes
Pin Akregator to Virtual Desktop 2. Additionally, start the application with a preferred size and position. For each attribute, use the Apply Initially parameter so it can be overridden at run-time.
The KWin rule is created as follows:
- Start Akregator on desktop two, size and place it to suit:
- Right-click on the menu bar and select Configure Window Behavior...:
- Select the Window Rules option in the left column and click on the New... button:
- The Edit Window-Specific Settings window is displayed. The Window matching tab is the default tab:
- Click on Detect Window Properties and with 0s delay the cursor immediately turns into cross-hairs. Click (anywhere) inside the Akregator window (but not the title bar). The window criteria are presented. Match only by primary class name so leave the check boxes unchecked:
- Clicking OK in the previous window back-fills the results in the Window Matching tab. Enter a meaningful Description (which is displayed in the KWin Rule window):
- Enable the window attributes: Position, Size and Desktop. The values are automatically set by Detect Window Properties:
- Clicking OK in the previous window returns to the main KWin Rules. The new rule with its Description is listed:
- Click OK to close the window.
- Done.
Application on all Desktops and Handle One Child Window Uniquely
Except for conversation windows, display Kopete and its children windows (e.g. Configuration) on all desktops and skip the systray and pager. For conversation windows, treat them as the parent window except show them in systray.
For each attribute, use the Force parameter so it can not be overridden.
In order to implement the above, two rules need to be created:
- A rule for Kopete Chat and
- A rule for Kopete
The Kopete Chat rule's matching-criteria is more restrictive than the Kopete rule as it needs to match a specific Window Role: the chat window. Due to rule evaluation processing, the Kopete Chat rule must precede the Kopete rule in the KWin Rule list for Kopete.
Kopete Chat Rule
Assuming a Kopete Chat window is open:
- Use Detect Window Properties and select the Kopete Chat window. Check the Window role box to restrict the criteria to chat windows:
- Clicking OK in the previous window back-fills the results in the Window Matching tab. Enter a meaningful Description:
- Enable the following attributes:
- Click through to complete entry of the rule.
Kopete Rule
Assuming Kopete is open:
- Use Detect Window Properties and select the Kopete window. Check the Secondary class name box to include all of Kopetes children windows:
- Clicking OK in the previous window back-fills the results in the Window Matching tab. Enter a meaningful Description:
- Enable the following attributes:
- Click through to complete entry of the rule.
Kopete KWin Rule List
As mentioned above, the Kopete Chat rule must precede the Kopete rule:
Suppress a Window from showing on Pager
KNotes currently does not allow for its notes to not appear in the pager however a rule easily solves this shortcoming.
Assuming a sticky note' window is available:
- Use Detect Window Properties and select any sticky note window:
- Clicking OK in the previous window back-fills the results in the Window Matching tab. Enter a meaningful Description:
- Enable the Skip Pager attribute with the Force the parameter:
- Click through to complete entry of the rule.
Force a Window to the Front/Top of all Others
To pop window to the top of all others when active, set its Focus stealing prevention attribute to None. Typically used with the Force parameter:
Multiple Rules per Application
---pablo 20:28, 1 March 2012 (UTC)
Thunderbird has several different child windows. This example:
- Pin Thunderbird's main window on Virtual Desktop 1 with a specific size and location on the desktop.
- Allow the Thunderbird composer window to reside on any desktop and when activated, force focus and pop it to the top of all windows.
- Pop the Thunderbird reminder to the top and do not give it focus so it isn't inadvertently dismissed.
Each rule's matching criteria is sufficiently restrictive so their order within the main KWin window is not important.
Thunderbird - Main
Assuming the Thunderbird Main window is open:
- Use Detect Window Properties and select the Thunderbird Main window. Check the Window role box to restrict the criteria to the main window:
- Clicking OK in the previous window back-fills the results in the Window Matching tab. Enter a meaningful Description:
- Enable the following attributes:
- Click through to complete entry of the rule.
Thunderbird - Composer
Assuming a Thunderbird Composer window is open:
- Use Detect Window Properties and select the Thunderbird Compose window. Check the Window role and Window type boxes to restrict the criteria to composition windows:
- Clicking OK in the previous window back-fills the results in the Window Matching tab. Enter a meaningful Description:
- Enable the following attributes:
- Click through to complete entry of the rule.
Thunderbird - Reminder
Assuming a Thunderbird Reminder window is open:
- Use Detect Window Properties and select the Thunderbird Reminder window. Check the Secondary class name and Window Type boxes to restrict the criteria to reminder windows:
- Clicking OK in the previous window back-fills the results in the Window Matching tab. Enter a meaningful Description:
- Enable the following attributes:
- Click through to complete entry of the rule.