<?xml version="1.0" ?>
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.5-Based Variant V1.1//EN" "dtd/kdedbx45.dtd" [
  <!ENTITY % addindex "IGNORE">
  <!ENTITY % English "INCLUDE">
]>
<book id="windowspecific" lang="&language;">
<bookinfo>
<title>Window Rules</title>
<authorgroup>
<author>&Lauri.Watts; &Lauri.Watts.mail;</author>
<author>
<personname>
      <firstname>Parts of this documentation was converted from the KDE UserBase <ulink url="https://userbase.kde.org/KWin Rules">KWin Rules</ulink> page and updated by the &kde; Documentation team to Plasma 5.8.</firstname>
<surname></surname>
</personname>
      </author>
<!-- TRANS:ROLES_OF_TRANSLATORS -->
      </authorgroup>
<legalnotice>&FDLNotice;</legalnotice>
<date>2016-06-23</date>
      <releaseinfo>Plasma 5.8</releaseinfo>
<abstract>
<para>Here you can customize window settings specifically only for
some windows.</para>
      </abstract>
<keywordset>
<keyword>KDE</keyword>
<keyword>KControl</keyword>
<keyword>window settings</keyword>
<keyword>window placement</keyword>
<keyword>window size</keyword>
</keywordset>
</bookinfo>
<chapter id="window-specific">
<title>Window Specific Settings: Quick Start</title>

<para>Here you can customize window settings specifically only for
some windows.</para>

<note>
<para>Please note that this configuration will not take effect if you
do not use &kwin; as your window manager. If you do use a different
window manager, please refer to its documentation for how to customize
window behavior.</para>
</note>

<para>Many of the settings you can configure here are those you can
configure on a global basis in the <guilabel>Window Behavior</guilabel>
&systemsettings; module, however some of them are even more detailed.</para>

<para>They encompass geometry, placement, whether a window should be
kept above or below others, focus stealing prevention, and translucency
settings.</para>

<para>You can access this module in two ways: from the titlebar of the
application you wish to configure, or from the &systemsettings;.  If you
start it from within &systemsettings; you can use the
<guibutton>New...</guibutton> to create a window profile, and the
<guibutton>Detect Window Properties</guibutton> button on the resulting dialog to
partially fill in the required information for the application
you wish to configure.</para>

<para>You can also at any time <guibutton>Modify...</guibutton> or
<guibutton>Delete</guibutton> any stored settings profile, and
reorder the list.  Reordering the list using the <guibutton>Move Up</guibutton>
and <guibutton>Move Down</guibutton> buttons effects on how they are applied.</para>

</chapter>
<!--userbase <timestamp>2012-03-09T20:50:14Z</timestamp>-->

<!--userbase-content-->
<chapter id="overview"><title>Overview</title> 
<para>&kwin; allows the end-user to define rules to alter an application's window attributes.
</para>
<para>For example, when an application is started, it can be forced to always run on <emphasis>Virtual Desktop 2</emphasis>.  Or a defect in an application can be worked-around to force the window above others.
</para>
<para>Step-by-step <link linkend="examples">examples</link> are provided along with detailed information on using the <link linkend="kwin-rule-editor">&kwin; Rule Editor</link> to specify <link linkend="window-matching">Window Matching</link> and  <link linkend="window-attributes">Window Attributes</link>.
</para>
</chapter>
<chapter id="examples-and-application-workaround"><title>Examples and Application Workaround</title> 
<para>To see what's possible, detailed <link linkend="examples">examples</link> are provided which can also be used to model your own rules.
</para>
<para>A special page is to dedicated to address <link linkend="application-workarounds">Application Workaround</link>.
</para>
</chapter>
<chapter id="kwin-rule-editor"><title>KWin Rule Editor</title> 
<sect1 id="invoking-the-kwin-rule-editor"><title>Invoking the KWin Rule Editor</title> 
<para>
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="kwin-rules-ordering.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot>
</para>
<para>There are several ways to invoke the &kwin; Rule Editor.  Below are two:
</para>
<itemizedlist>
<listitem><para>Right-click on the title-bar of any window, choose <menuchoice><guimenu>More Actions</guimenu><guimenuitem>Window Manager Settings...</guimenuitem></menuchoice> and in the <guilabel>Configure</guilabel> window, select <guilabel>Window Rules</guilabel> or</para></listitem>
</itemizedlist>
<itemizedlist>
<listitem><para><menuchoice><guimenu>System Settings</guimenu><guisubmenu>Window Behavior</guisubmenu><guimenuitem>Window Rules</guimenuitem></menuchoice></para></listitem>
</itemizedlist>
<para>The main window is used to:
</para>
<itemizedlist>
<listitem><para>Affect rules with <guilabel>New...</guilabel>, <guilabel>Modify...</guilabel> and <guilabel>Delete</guilabel></para></listitem>
<listitem><para>Share rules with others via <guilabel>Import</guilabel> and <guilabel>Export</guilabel></para></listitem>
<listitem><para>Ensure desired <link linkend="rule-evaluation">rule evaluation</link> using <guilabel>Move Up</guilabel> and <guilabel>Move Down</guilabel></para></listitem>
</itemizedlist>
<sect2 id="rule-evaluation"><title>Rule Evaluation</title> 
<para>When an application starts (or the rules are modified), &kwin; evaluates the rules from the top of the list to the bottom.  For all rules which match a window, the collective set of attributes are applied to the window, then the window is displayed.
</para>
<para>Should two or more matching rules enable the same attribute, the setting in the <emphasis>first</emphasis> rule in the list is used.
</para>
<para><tip><para>You can tailor children windows for the application by placing the more restrictive rules first - see the <link linkend="application-on-all-desktops-and-handle-one-child-window-uniquely">Kopete and Kopete Chat Window</link> example.</para></tip>
</para>
</sect2>
</sect1>
<sect1 id="rule-editor"><title>Rule Editor</title> 
<para>
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="kwin-rule-editor.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot>
</para>
<para>The editor is composed of four tabs:
</para>
<orderedlist>
<listitem><para><guilabel>Window matching</guilabel></para></listitem>
<listitem><para><guilabel>Size &amp; Position</guilabel></para></listitem>
<listitem><para><guilabel>Arrangement &amp; Access</guilabel></para></listitem>
<listitem><para><guilabel>Appearance &amp; Fixes</guilabel></para></listitem>
</orderedlist>
<para>As the name implies, <guilabel>Window matching</guilabel> is used to specify criteria to match one or more windows.  The other three tabs are used to alter the attributes of the matching windows.
</para>
<para><tip><para>Panels can also be affected.</para></tip>
</para>
<sect2 id="window-matching"><title>Window Matching</title> 
<para>Each window rule has user specified <link linkend="window-matching">Window Matching</link> criteria.  &kwin; uses the criteria to determine whether the rule is applicable for an application.
</para>
</sect2>
<sect2 id="window-attributes"><title>Window Attributes</title> 
<para>Along with Window Matching criteria, each window rule has a set of <link linkend="window-attributes">Window Attributes</link>.  The attributes override the corresponding application's settings and are applied before the window is displayed by &kwin;.
</para>

</sect2>
</sect1>
</chapter>
<chapter id="window-matching0"><title>Window Matching</title> 
<para>
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="kwin-rule-editor.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot>
</para>
<para>The <guilabel>Window Matching</guilabel> tab is used to specify the criteria &kwin; uses to evaluate whether the rule is applicable for a given window.
</para>
<para>Zero (match any window) or more of the following may be specified:
</para>
<itemizedlist>
<listitem><para><guilabel>Window class (application)</guilabel> - match the class.<itemizedlist>
<listitem><para><guilabel>Match whole window class</guilabel> - include matching the secondary class.</para></listitem>
</itemizedlist>
</para></listitem>
<listitem><para><guilabel>Window role</guilabel> - restrict the match to the function of the window (&eg; a <emphasis>main window</emphasis>, a <emphasis>chat window</emphasis>, &etc;)</para></listitem>
<listitem><para><guilabel>Window types</guilabel> - restrict the match to the type of window:  <guilabel>Normal Window</guilabel>, <guilabel>Dialog Window</guilabel>, &etc;</para></listitem>
<listitem><para><guilabel>Window title</guilabel> - restrict the match to the title of the window.</para></listitem>
<listitem><para><guilabel>Machine (hostname)</guilabel> - restrict the match to the host name associated with the window.</para></listitem>
</itemizedlist>
<para><tip><para>While it's possible to manually enter the above information, the preferred method is to use the <guilabel>Detect Window Properties</guilabel> button.</para></tip>
</para>
<para>For each field, the following operators can be applied against the field value:
</para>
<itemizedlist>
<listitem><para><guilabel>Unimportant</guilabel> - ignore the field.</para></listitem>
<listitem><para><guilabel>Exact Match</guilabel></para></listitem>
<listitem><para><guilabel>Substring Match</guilabel></para></listitem>
</itemizedlist>
<para><note><para>Both <guilabel>Exact Match</guilabel> and <guilabel>Substring Match</guilabel> implement case insensitive matching.  For example, <emphasis>AB</emphasis> matches the string <emphasis>AB</emphasis>, <emphasis>ab</emphasis>, <emphasis>Ab</emphasis> and <emphasis>aB</emphasis>.</para></note>
</para>
<itemizedlist>
<listitem><para><guilabel>Regular Expression</guilabel> - Qt's regular expressions are implemented - see <ulink url="https://doc.qt.io/qt-5/qregexp.html">pattern matching using regular expressions</ulink>.</para></listitem>
</itemizedlist>
<sect1 id="detect-window-properties"><title>Detect Window Properties</title>
<para>
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="kwin-detect-window.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot>
</para>
<para>The <guilabel>Detect Window Properties</guilabel> function simplifies the process of entering the matching-criteria.
</para>
<orderedlist>
<listitem><para>For the application you'd like to create a rule, start the application.</para></listitem>
<listitem><para>Next, in the <guilabel>Window matching</guilabel> tab, set the number of seconds of delay before the <guilabel>Detect Window Properties</guilabel> function starts.  The default is zero seconds.</para></listitem>
<listitem><para>Click on <guilabel>Detect Window Properties</guilabel> and</para></listitem>
<listitem><para>When the mouse-cursor turns to cross-hairs, place it inside the application window (not the title bar) and left-click.</para></listitem>
<listitem><para>A new window is presented with information about the selected window.  Select the desired fields:<itemizedlist>
<listitem><para><guilabel>Secondary class name</guilabel> - some applications have a secondary class name.  This value can be used to restrict windows by this value.</para></listitem>
<listitem><para><guilabel>Window role</guilabel></para></listitem>
<listitem><para><guilabel>Window type</guilabel></para></listitem>
<listitem><para><guilabel>Window title</guilabel></para></listitem>
</itemizedlist>
</para></listitem>
</orderedlist>
<para>Click the <guilabel>OK</guilabel> button to back-fill the <guilabel>Window Matching</guilabel> criteria.
</para>
<para>By using a combination of the information, a rule can apply to an entire application (by <guilabel>Class</guilabel>) or a to a specific window <guilabel>Type</guilabel> within the <guilabel>Class</guilabel> - say a <guilabel>Toolbar</guilabel>.
</para>
</sect1>
</chapter>
<chapter id="window-attributes1"><title>Window Attributes</title>
<para>
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="kwin-window-attributes.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot>
</para>
<para>The attributes which can be set are grouped by function in three tabs:
</para>
<orderedlist>
<listitem><para><guilabel>Size &amp; Position</guilabel></para></listitem>
<listitem><para><guilabel>Arrangement &amp; Access</guilabel></para></listitem>
<listitem><para><guilabel>Appearance &amp; Fixes</guilabel></para></listitem>
</orderedlist>
<para>Each attribute has a set of parameters which determines its disposition.
</para>
<sect1 id="parameters"><title>Parameters</title>
<para>Each attribute, minimally, accepts one of the following parameters.  Additional, attribute-specific arguments are listed within each <link linkend="attributes">attribute</link> definition.
</para>
<variablelist>
  <varlistentry><term><emphasis role="bold">Do Not Affect</emphasis></term>
    <listitem>
    <para>Ensure a subsequent rule, which matches the window, does not affect the attribute.</para>
     </listitem>
  </varlistentry>
  <varlistentry><term><emphasis role="bold">Apply Initially</emphasis></term>
    <listitem>
    <para>Start the window with the attribute and allow it to be changed at run-time.</para>
     </listitem>
  </varlistentry>
  <varlistentry><term><emphasis role="bold">Remember</emphasis></term>
    <listitem>
    <para>Use the attribute setting as defined in the rule and if changed at run-time, save and use the new value instead.</para>
     </listitem>
  </varlistentry>
  <varlistentry><term><emphasis role="bold">Force</emphasis></term>
    <listitem>
    <para>The setting cannot be changed at run-time.</para>
     </listitem>
  </varlistentry>
  <varlistentry><term><emphasis role="bold">Apply Now, Force Temporarily</emphasis></term>
    <listitem>
    <para>Apply/Force the setting once and unset the attribute.The difference between the two is at run-time, <guilabel>Apply Now</guilabel> allows the attribute to be changed and <guilabel>Force Temporarily</guilabel> prohibits it to be altered until all affected windows exit.</para>
     </listitem>
  </varlistentry>
</variablelist>
<para><warning><para>For <guilabel>Apply Now</guilabel>, if the rule has no other attributes set, the rule is deleted after evaluation whereas <guilabel>Force Temporarily</guilabel>, the rule is deleted after the last affected window terminates.</para></warning>
</para>
</sect1>
<sect1 id="attributes"><title>Attributes</title>
<para><tip><para>The <guilabel>Detect Window Properties</guilabel> button back-fills attribute-specific values - for more information see <link linkend="window-matching">Window Matching</link>.  For example the height and width values of the <guilabel>Size</guilabel> attribute is set to the height and width of the detected window.</para></tip>
</para>
<para><tip><para><guilabel>Yes/No</guilabel> arguments are used to toggle on or off attributes.  Leniency with grammar helps one understand how a setting will be processed.  <inlinemediaobject> <imageobject> <imagedata fileref="Face-smile.png" format="PNG"/> </imageobject> </inlinemediaobject>  For example, the attribute <guilabel>Skip taskbar</guilabel>, when set to <guilabel>No</guilabel> means do not skip the taskbar.  In other words, show the window in the taskbar.  <inlinemediaobject> <imageobject> <imagedata fileref="Face-smile.png" format="PNG"/> </imageobject> </inlinemediaobject></para></tip>
</para>
<sect2 id="size--position"><title>Size &amp; Position</title>
<variablelist>
  <varlistentry><term><emphasis role="bold">Position</emphasis></term>
    <listitem>
    <para>Position the window's upper left corner at the specified x,y coordinate.</para>
     </listitem>
  </varlistentry>
</variablelist>
<para><tip><para>&kwin;'s origin, (0,0), is the upper left of the desktop.</para></tip>
</para>
<variablelist>
  <varlistentry><term><emphasis role="bold">Size</emphasis></term>
    <listitem>
    <para>The width and height of the window.</para>
     </listitem>
  </varlistentry>
  <varlistentry><term><emphasis role="bold">Maximized horizontally, Maximized vertically</emphasis></term>
    <listitem>
    <para>These attributes are used to toggle the maximum horizontal/minimum horizontal window attribute.</para>
     </listitem>
  </varlistentry>
  <varlistentry><term><emphasis role="bold">Desktop, Activity, Screen</emphasis></term>
    <listitem>
    <para>Place the window on the specified <emphasis>(Virtual) Desktop</emphasis>, <emphasis>Activity</emphasis> or <emphasis>Screen</emphasis>.  Use <guilabel>All Desktops</guilabel> to place the window on all <emphasis>Virtual Desktops</emphasis>.</para>
     </listitem>
  </varlistentry>
  <varlistentry><term><emphasis role="bold">Fullscreen, Minimized, Shaded</emphasis></term>
    <listitem>
    <para>Toggle the Fullscreen, Minimize and Shading window attribute.  For example, a window can be started Minimized or if it is started Minimized, it can be forced to not.</para>
     </listitem>
  </varlistentry>
</variablelist>
<para><tip><para>Maximized attribute is emulated by using both <guilabel>Maximized horizontally</guilabel> and <guilabel>Maximized vertically</guilabel> or <guilabel>Initial placement</guilabel> with the <guilabel>Maximizing</guilabel> argument.</para></tip>
</para>
<variablelist>
  <varlistentry><term><emphasis role="bold">Initial placement</emphasis></term>
    <listitem>
    <para>Override the global window placement strategy with one of the following:</para>
<itemizedlist>
<listitem><para><guilabel>Default</guilabel> - use the global window placement strategy.</para></listitem>
<listitem><para><guilabel>No Placement</guilabel> - top-left corner.</para></listitem>
<listitem><para><guilabel>Minimal Overlapping</guilabel> - place where no other window exists.</para></listitem>
<listitem><para><guilabel>Maximized</guilabel> - start the window maximized.</para></listitem>
<listitem><para><guilabel>Centered</guilabel> - center of the desktop.</para></listitem>
<listitem><para><guilabel>Random</guilabel></para></listitem>
<listitem><para><guilabel>In Top-Left Corner</guilabel></para></listitem>
<listitem><para><guilabel>Under Mouse</guilabel></para></listitem>
<listitem><para><guilabel>On Main Window</guilabel> - restrict placement of a child window to the boundaries of the parent window.</para></listitem>
</itemizedlist>

     </listitem>
  </varlistentry>
  <varlistentry><term><emphasis role="bold">Ignore requested geometry</emphasis></term>
    <listitem>
    <para>Toggle whether to accept or ignore the window's requested geometry position.  To avoid conflicts between the default placement strategy and the window's request, the placement strategy is ignored when the window's request is accepted.</para>
     </listitem>
  </varlistentry>
  <varlistentry><term><emphasis role="bold">Minimum size, Maximum size</emphasis></term>
    <listitem>
    <para>The minimum and maximum size allowed for the window.</para>
     </listitem>
  </varlistentry>
  <varlistentry><term><emphasis role="bold">Obey geometry restrictions</emphasis></term>
    <listitem>
    <para>Toggle whether to adhere to the window's requested aspect ratio or <emphasis>base increment</emphasis>.In order to understand this attribute, some background is required.  Briefly, windows must request from the Window Manager, a base increment:  the minimum number of <emphasis>height</emphasis> X <emphasis>width</emphasis> pixels per re-size request.  Typically, it's 1x1.  Other windows though, for example terminal emulators or editors, use fixed-fonts and request their base-increment according to the size of one character.</para>
     </listitem>
  </varlistentry>
</variablelist>
</sect2>
<sect2 id="arrangement--access"><title>Arrangement &amp; Access</title>
<variablelist>
  <varlistentry><term><emphasis role="bold">Keep above, Keep below</emphasis></term>
    <listitem>
    <para>Toggle whether to keep the window above/below all others.</para>
     </listitem>
  </varlistentry>
  <varlistentry><term><emphasis role="bold">Autogroup with identical</emphasis></term>
    <listitem>
    <para>Toggle the grouping (commonly known as <emphasis>tabbing</emphasis>) of windows.</para>
     </listitem>
  </varlistentry>
  <varlistentry><term><emphasis role="bold">Autogroup in foreground</emphasis></term>
    <listitem>
    <para>Toggle whether to make the window active when it is added to the current Autogroup.</para>
     </listitem>
  </varlistentry>
  <varlistentry><term><emphasis role="bold">Autogroup by ID</emphasis></term>
    <listitem>
    <para>Create a group via a user-defined ID.  More than one rule can share the same ID to allow for seemingly unrelated windows to be grouped.</para>
     </listitem>
  </varlistentry>

  <varlistentry><term><emphasis role="bold">Skip taskbar</emphasis></term>
    <listitem>
    <para>Toggle whether to display the window in the taskbar.</para>
     </listitem>
  </varlistentry>
  <varlistentry><term><emphasis role="bold">Skip pager</emphasis></term>
    <listitem>
    <para>Toggle whether to display the window in pager.</para>
     </listitem>
  </varlistentry>
    </variablelist>
<para>
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="pager-4-desktops.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot>
</para>
<variablelist>
  <varlistentry><term><emphasis role="bold">Skip switcher</emphasis></term>
    <listitem>
    <para>Toggle whether to display the window in the <guilabel>ALT+TAB</guilabel> list.</para>
     </listitem>
  </varlistentry>
  <varlistentry><term><emphasis role="bold">Shortcut</emphasis></term>
    <listitem>
    <para>Assign a shortcut to the window.  When <guilabel>Edit...</guilabel> is clicked, additional instructions are presented.</para>
     </listitem>
  </varlistentry>
</variablelist>
</sect2>
<sect2 id="appearance--fixes"><title>Appearance &amp; Fixes</title>
<variablelist>
  <varlistentry><term><emphasis role="bold">No titlebar and frame</emphasis></term>
    <listitem>
    <para>Toggle whether to display the titlebar and frame around the window.</para>
     </listitem>
  </varlistentry>
  <varlistentry><term><emphasis role="bold">Titlebar color scheme</emphasis></term>
    <listitem>
    <para>Select a color scheme for the titlebar of the window.</para>
     </listitem>
  </varlistentry>
  <varlistentry><term><emphasis role="bold">Active/Inactive opacity</emphasis></term>
    <listitem>
    <para>When the window is active/inactive, set its opacity to the percentage specified.</para>
     </listitem>
  </varlistentry>
</variablelist>
<para><tip><para><guilabel>Active/Inactive opacity</guilabel> can only be affected when <guilabel>Desktop Effects</guilabel> are enabled.</para></tip>
</para>
<variablelist>
  <varlistentry><term><emphasis role="bold">Focus stealing prevention</emphasis></term>
    <listitem>
    <para>When a window wants focus, control on a scale (from <guilabel>None</guilabel> to <guilabel>Extreme</guilabel>) whether to honor the request and place above all other windows, or ignore its request (potentially leaving the window behind other windows):</para>
<itemizedlist>
<listitem><para>None - Always grant focus to the window.</para></listitem>
<listitem><para>Low</para></listitem>
<listitem><para>Normal</para></listitem>
<listitem><para>High</para></listitem>
<listitem><para>Extreme - The window's focus request is denied.  Focus is only granted by explicitly requesting via the  mousing.</para></listitem>
</itemizedlist>

     </listitem>
  </varlistentry>
</variablelist>
<para><tip><para>See <guilabel>Accept focus</guilabel> to make a window read-only - not accept any keyboard input.</para></tip>
</para>
<variablelist>
  <varlistentry><term><emphasis role="bold">Accept focus</emphasis></term>
    <listitem>
    <para>Toggle whether the window accepts keyboard input.  Make the window read-only.</para>
     </listitem>
  </varlistentry>
  <varlistentry><term><emphasis role="bold">Ignore global shortcuts</emphasis></term>
    <listitem>
    <para>Toggle whether to ignore global shortcuts (as defined by <menuchoice><guimenu>System Settings</guimenu><guisubmenu>Shortcuts and Gestures</guisubmenu><guimenuitem>Global Shortcuts</guimenuitem></menuchoice> or by running <varname>kcmshell6 keys</varname> in <guilabel>konsole</guilabel>) while the window is active.</para>
     </listitem>
  </varlistentry>
  <varlistentry><term><emphasis role="bold">Closeable</emphasis></term>
    <listitem>
    <para>Toggle whether to display the <guilabel>Close</guilabel> button on the title bar.</para>
     </listitem>
  </varlistentry>
</variablelist>
<para><tip><para>A terminal window may still be closed by the end user by ending the shell session however using <guilabel>Accept focus</guilabel> to disable keyboard input will make it more difficult to close the window.</para></tip>
</para>
<variablelist>
  <varlistentry><term><emphasis role="bold">Window type</emphasis></term>
    <listitem>
    <para>Change the window to another type and inherit the characteristics of that window:</para>
<itemizedlist>
<listitem><para>Normal Window</para></listitem>
<listitem><para>Dialog Window</para></listitem>
<listitem><para>Utility Window</para></listitem>
<listitem><para>Dock (panel)</para></listitem>
<listitem><para>Toolbar</para></listitem>
<listitem><para>Torn-Off Menu</para></listitem>
<listitem><para>Splash Screen</para></listitem>
<listitem><para>Desktop</para></listitem>
<listitem><para>Standalone Menubar</para></listitem>
<listitem><para>On Screen Display</para></listitem>
</itemizedlist>

     </listitem>
  </varlistentry>
</variablelist>
<para><warning><para>Use with care because unwanted results may be introduced.  For example, a <guilabel>Splash Screen</guilabel> is a automatically closed by &kwin; when clicked.</para></warning>
</para>
<variablelist>
  <varlistentry><term><emphasis role="bold">Block compositing</emphasis></term>
    <listitem>
    <para>Toggle whether to disable compositing while the window <emphasis>exists</emphasis>.  If compositing is enabled and the rule specifies to disable compositing, while <emphasis>any</emphasis> matching window exists, compositing will be disabled.  Compositing is re-enabled when the last matching window terminates.</para>
     </listitem>
  </varlistentry>
</variablelist>
</sect2>
</sect1>
</chapter>
<chapter id="examples"><title>Examples</title>
<para><note><para>The first example details all the necessary steps to create the rules.  In order to keep this page a manageable size, subsequent examples only list steps specific to the example.</para></note>
</para>
<para><note><para>The <guilabel>Pager</guilabel> attribute refers to the <guilabel>Virtual Desktop Manager</guilabel>:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="pager-4-desktops.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></note>
</para>
<sect1 id="pin-a-window-to-a-desktop-and-set-other-attributes"><title>Pin a Window to a Desktop and set other Attributes</title>
<para>Pin &akregator; to <emphasis>Virtual Desktop 2</emphasis>.  Additionally, start the application with a preferred size and position.  For each attribute, use the <guilabel>Apply Initially</guilabel> <link linkend="parameters">parameter</link> so it can be overridden at run-time.
</para>
<para>The &kwin; rule is created as follows:
</para>
<orderedlist>
<listitem><para>Start &akregator; on <emphasis>desktop two</emphasis>, size and position it to suit:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="akregator-fav.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Right-click on the titlebar and select <menuchoice><guimenu>More Actions</guimenu><guimenuitem>Window Manager Settings...</guimenuitem></menuchoice>:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="config-win-behavior.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Select the <guilabel>Window Rules</guilabel> in the left column and click on <guilabel>New...</guilabel>:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="kwin-rules-main.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>The <guilabel>Edit Window-Specific Settings</guilabel> window is displayed.  <guilabel>Window matching</guilabel> is the default tab:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="window-matching-init.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Click <guilabel>Detect Window Properties</guilabel> with <guilabel>0s delay</guilabel> 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 - for additional information see <link linkend="window-matching">window matching</link>:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="akgregator-info.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Clicking <guilabel>OK</guilabel> the previous window back-fills the results in the <guilabel>Window Matching</guilabel> tab.  Enter a meaningful text in the <guilabel>Description</guilabel> field (which is displayed in the <guilabel>KWin Rule</guilabel> window):
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="window-matching-ready-akregator.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Enable the window attributes: <guilabel>Position</guilabel>, <guilabel>Size</guilabel> and <guilabel>Desktop</guilabel>.  The initial values are set by <guilabel>Detect Window Properties</guilabel> and can be overridden:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="akregator-attributes.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Clicking <guilabel>OK</guilabel> in the previous window returns to the main <guilabel>KWin Rules</guilabel>.  The new rule with its description is listed:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="kwin-rules-main-n-akregator.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Click <guilabel>OK</guilabel> to close the window.</para></listitem>
<listitem><para>Done.</para></listitem>
</orderedlist>
</sect1>
<sect1 id="application-on-all-desktops-and-handle-one-child-window-uniquely"><title>Application on all Desktops and Handle One Child Window Uniquely</title>
<para>Except for conversation windows, display &kopete; and its children windows on all desktops and skip the systray and pager.  For children conversation windows, treat them as the parent window except show them in systray.
</para>
<para>For each attribute, use the <guilabel>Force</guilabel> <link linkend="parameters">parameter</link> so it can not be overridden.
</para>
<para>In order to implement the above, two rules need to be created:
</para>
<orderedlist>
<listitem><para>A rule for <guilabel>Kopete Chat</guilabel> and</para></listitem>
<listitem><para>A rule for &kopete;</para></listitem>
</orderedlist>
<para>The <guilabel>Kopete Chat</guilabel> rule's matching-criteria is more restrictive than the <emphasis>Kopete</emphasis> rule as it needs to match a specific Window Role:  the chat window.  Due to <link linkend="rule-evaluation">rule evaluation</link> processing, the <guilabel>Kopete Chat</guilabel> rule must precede the &kopete; rule in the <link linkend="kopete-kwin-rule-list">KWin Rule list for Kopete</link>.
</para>
<sect2 id="kopete-chat-rule"><title>Kopete Chat Rule</title>
<para>Assuming a <guilabel>Kopete Chat</guilabel> window is open:
</para>
<orderedlist>
<listitem><para>Use <guilabel>Detect Window Properties</guilabel> and select the <guilabel>Kopete  Chat</guilabel> window.  Check the <guilabel>Window role</guilabel> box to restrict the criteria to chat windows - for additional information see <link linkend="window-matching">window matching</link>:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="kopete-chat-info.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Clicking <guilabel>OK</guilabel> in the previous window back-fills the results in the <guilabel>Window Matching</guilabel> tab.  Enter a meaningful text in the <guilabel>Description</guilabel> box:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="window-matching-kopete-chat.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Enable the following attributes:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="kopete-chat-attribute.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Click through to complete entry of the rule.</para></listitem>
</orderedlist>
<para><note><para>The <guilabel>Skip taskbar</guilabel> attribute is set to <guilabel>No</guilabel> to display the window in the taskbar which loosely translates to:  <emphasis>no</emphasis> <emphasis>do not</emphasis> <emphasis>skip taskbar</emphasis> <inlinemediaobject> <imageobject> <imagedata fileref="Face-smile.png" format="PNG"/> </imageobject> </inlinemediaobject>.</para></note>
</para>
</sect2>
<sect2 id="kopete-rule"><title>Kopete Rule</title>
<para>Assuming &kopete; is open:
</para>
<orderedlist>
<listitem><para>Use <guilabel>Detect Window Properties</guilabel> and select the &kopete; window.  Match only by primary class name so leave the check boxes unchecked - for additional information see <link linkend="window-matching">window matching</link>:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="kopete-info.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Clicking <guilabel>OK</guilabel> in the previous window back-fills the results in the <guilabel>Window Matching</guilabel> tab.  Enter a meaningful text in the <guilabel>Description</guilabel> box:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="window-matching-kopete.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Enable the following attributes:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="kopete-attribute-2.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Click through to complete entry of the rule.</para></listitem>
</orderedlist>
</sect2>
<sect2 id="kopete-kwin-rule-list"><title>Kopete KWin Rule List</title>
<para>As mentioned, due to <link linkend="rule-evaluation">rule evaluation</link> processing, the <guilabel>Kopete Chat</guilabel> rule must precede the &kopete; rule:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="kwin-kopete-rules.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot>
</para>
</sect2>
</sect1>
<sect1 id="suppress-a-window-from-showing-on-pager"><title>Suppress a Window from showing on Pager</title>
<para><guilabel>KNotes</guilabel> currently does not allow for its notes to skip the pager however a rule easily solves this shortcoming.
</para>
<para>Assuming a <emphasis>sticky note</emphasis>' window is available:
</para>
<orderedlist>
<listitem><para>Use <guilabel>Detect Window Properties</guilabel> and select any <emphasis>sticky note</emphasis> window.  Match only by primary class name so leave the check boxes unchecked - for additional information see <link linkend="window-matching">window matching</link>:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="knotes-info.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Clicking <guilabel>OK</guilabel> in the previous window back-fills the results in the <guilabel>Window Matching</guilabel> tab.  Enter a meaningful text in the <guilabel>Description</guilabel> box:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="window-matching-knotes.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Enable the <guilabel>Skip Pager</guilabel> attribute with the <guilabel>Force</guilabel> <link linkend="parameters">parameter</link>:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="knotes-attribute.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Click through to complete entry of the rule.</para></listitem>
</orderedlist>
</sect1>
<sect1 id="force-a-window-to-the-top"><title>Force a Window to the Top</title>
<para>To pop an active window to the top, set its <guilabel>Focus stealing prevention</guilabel> attribute to <guilabel>None</guilabel>, typically, in conjunction with the <guilabel>Force</guilabel> <link linkend="parameters">parameter</link>:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="focus-stealing-pop2top-attribute.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot>
</para>
</sect1>
<sect1 id="multiple-rules-per-application"><title>Multiple Rules per Application</title>
<para><application>Thunderbird</application> has several different child windows.  This example:
</para>
<itemizedlist>
<listitem><para>Pin <application>Thunderbird</application>'s main window on <emphasis>Virtual Desktop 1</emphasis> with a specific size and location on the desktop.</para></listitem>
<listitem><para>Allow the <application>Thunderbird</application> composer window to reside on any desktop and when activated, force focus and pop it to the top of all windows.</para></listitem>
<listitem><para>Pop the <application>Thunderbird</application> reminder to the top and do not give it focus so it isn't inadvertently dismissed.</para></listitem>
</itemizedlist>
<para>Each rule's matching criteria is sufficiently restrictive so their order within the main &kwin; window is not important to affect <link linkend="rule-evaluation">rule evaluation</link>.
</para>
<sect2 id="thunderbird---main"><title>Thunderbird - Main</title>
<para>Assuming the <guilabel>Thunderbird Main</guilabel> window is open, sized and position to suit:
</para>
<orderedlist>
<listitem><para>Use <guilabel>Detect Window Properties</guilabel> and select the <guilabel>Thunderbird Main</guilabel> window.  Check the <guilabel>Window role</guilabel> box to restrict the criteria to the main window - for additional information see <link linkend="window-matching">window matching</link>:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="tbird-main-info.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Clicking <guilabel>OK</guilabel> in the previous window back-fills the results in the <guilabel>Window Matching</guilabel> tab.  Enter a meaningful text in the <guilabel>Description</guilabel> box:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="window-matching-tbird-main.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Enable the following attributes:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="tbird-main-attribute.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Click through to complete entry of the rule.</para></listitem>
</orderedlist>
</sect2>
<sect2 id="thunderbird---composer"><title>Thunderbird - Composer</title>
<para>Assuming a <guilabel>Thunderbird Composer</guilabel> window is open:
</para>
<orderedlist>
<listitem><para>Use <guilabel>Detect Window Properties</guilabel> and select the <guilabel>Thunderbird Compose</guilabel> window.  Check the <guilabel>Window role</guilabel> and <guilabel>Window type</guilabel> boxes to restrict the criteria to composition windows - for additional information see <link linkend="window-matching">window matching</link>:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="tbird-compose-info.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Clicking <guilabel>OK</guilabel> in the previous window back-fills the results in the <guilabel>Window Matching</guilabel> tab.  Enter a meaningful text in the <guilabel>Description</guilabel> box:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="window-matching-tbird-compose.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Enable the following attributes:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="tbird-compose-attribute.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Click through to complete entry of the rule.</para></listitem>
</orderedlist>
</sect2>
<sect2 id="thunderbird---reminder"><title>Thunderbird - Reminder</title>
<para>Assuming a <guilabel>Thunderbird Reminder</guilabel> window is open:
</para>
<orderedlist>
<listitem><para>Use <guilabel>Detect Window Properties</guilabel> and select the <guilabel>Thunderbird Reminder</guilabel> window.  Check the <guilabel>Secondary class name</guilabel> and <guilabel>Window Type</guilabel> boxes to restrict the criteria to reminder windows - for additional information see <link linkend="window-matching">window matching</link>:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="tbird-reminder-info.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Clicking <guilabel>OK</guilabel> in the previous window back-fills the results in the <guilabel>Window Matching</guilabel> tab.  Enter a meaningful text in the <guilabel>Description</guilabel> box:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="window-matching-tbird-reminder.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Enable the following attributes:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="tbird-reminder-attribute-2.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Click through to complete entry of the rule.</para></listitem>
</orderedlist>

</sect2>
</sect1>
</chapter>
<chapter id="application-workarounds"><title>Application Workarounds</title>
<para>Below are Workarounds for misbehaving applications.
</para>
<para><tip><para>If you are unfamiliar with creating &kwin; Rules, see this <link linkend="pin-a-window-to-a-desktop-and-set-other-attributes">detailed example</link> to base your new rule.</para></tip>
</para>
<sect1 id="full-screen-re-size-error"><title>Full-screen Re-size Error</title>
<para>&Emacs; and <guilabel>gVim</guilabel>, when maximized (full-screen mode) and under certain conditions may encounter window re-sizing issues - see <ulink url="https://bugs.kde.org/show_bug.cgi?id=252314">Emacs window resizes ...</ulink>  A &kwin; Rule will work-around the issue.
</para>
<para>Assuming an &Emacs; window is open:
</para>
<orderedlist>
<listitem><para>Use <guilabel>Detect Window Properties</guilabel> and select the &Emacs; window.  Match only by <guilabel>primary class name</guilabel> so leave the check boxes unchecked - for additional information see <link linkend="window-matching">window matching</link>
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="emacs-info.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Clicking <guilabel>OK</guilabel> in the previous window back-fills the results in the <guilabel>Window Matching</guilabel> tab.  Enter a meaningful text in the <guilabel>Description</guilabel> text box:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="window-matching-emacs.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Ignore &Emacs;'s full-screen request by enabling the <guilabel>Obey geometry restrictions</guilabel> attribute, toggling it to off (<guilabel>No</guilabel>) to ignore and selecting the <guilabel>Force</guilabel>  <link linkend="parameters">parameter</link>:
<screenshot>
<screeninfo></screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="emacs-attribute.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase></phrase>
    </textobject>
  </mediaobject>
</screenshot></para></listitem>
<listitem><para>Click through to complete entry of the rule.</para></listitem>
</orderedlist>
</sect1>
</chapter>

<!--userbase-content-->
<chapter id="credits">
<title>Credits and License</title>
      <para>
Documentation Copyright see the UserBase
      <ulink url="https://userbase.kde.org/index.php?title=KWin Rules&amp;action=history">KWin Rules page history</ulink></para>
      <!-- TRANS:CREDIT_FOR_TRANSLATORS -->
&underFDL;
</chapter>
&documentation.index;
</book>
