<sect1 id="windows-how-to-work">
<title>Windows, How To Work Them</title>
<sect2 id="basic-window-management">
<title>Basic Window Management</title>
<indexterm><primary>Window Management</primary></indexterm>
<para>In computer terminology, a window is a rectangular area containing information
that can be moved around the desktop.
Each application running in &tde; uses at least one window and some
applications use more than one window. These windows are manipulated or controlled
in many ways to make the desktop useful. Here is a
typical window:
<screenshot>
<mediaobject>
<imageobject>
<imagedata fileref="a-window.png" format="PNG"/>
</imageobject>
<textobject><phrase>A normal window</phrase>
</textobject>
</mediaobject>
</screenshot>
</para>
<sect3 id="switching-between-windows">
<title>Switching Between Windows</title>
<indexterm><primary>Focus (windows)</primary></indexterm>
<para>A window must be active or receive the focus to be used. When first starting
an application the main window immediately receives the focus and is ready to use.
Only one window can be active at a time. The active window is the one that responds
to user actions and can be distinguished from other windows by the different colored
titlebar.</para>
<para>The titlebar is the top bar of a window that displays the name and description
of the window. The default titlebar also contains the Minimize, Maximize, and Close buttons
on the far right side.</para>
<para>With the &tde; default theme, the active window has a
<replaceable>light blue</replaceable> titlebar, and the inactive
windows have <replaceable>gray</replaceable> titlebars.</para>
<para>
<indexterm><primary>Raising Windows</primary></indexterm>
To work in a different window requires activating that window.
There are two ways to do this:
<itemizedlist>
<listitem>
<para>Use the mouse pointer to select a window. When selected the window receives the focus
and becomes active and will be raised to the foreground above other windows.</para>
</listitem>
<listitem>
<para><indexterm><primary><keycombo
action="simul">&Alt;	</keycombo></primary></indexterm>
With the keyboard, press and hold either &Alt; key and press the 	 key.
A popup dialog appears with a list of available windows. The currently active window that
has the focus will be selected automatically in the list. While pressing the &Alt; key,
select a different window by again pressing the 	 key to scroll through the list.
Release the &Alt; key and the window that is selected in the list receives the focus
and becomes the active window.</para>
</listitem>
</itemizedlist>
</para>
</sect3>
<sect3 id="moving-windows">
<title>Moving Windows</title>
<indexterm><primary>Moving Windows</primary></indexterm>
<para>One way to organize the windows on a desktop is to move
them. There are three ways to move a window:
<itemizedlist>
<listitem>
<para>Select the window titlebar using the &LMB; and continue holding the &LMB;. When
selected in this manner, moving the mouse pointer moves the window. Release the mouse
button and the window remains at that position.</para>
</listitem>
<listitem>
<para>Select the window titlebar using the &RMB;, which causes a popup menu to appear
as displayed in the following image. From the popup menu select <guimenuitem>Move</guimenuitem>.
The mouse pointer moves to the center of the window. Move the mouse pointer
to move the window. After moving the window to the desired
position, use the &LMB; to release the window.</para>
<indexterm><primary>Window Menu</primary></indexterm>
<screenshot>
<screeninfo>The Window Menu</screeninfo>
<mediaobject>
<imageobject>
<imagedata fileref="titlebar-menu.png" format="PNG" />
</imageobject>
<textobject>
<phrase>The Window Menu</phrase>
</textobject>
</mediaobject>
</screenshot>
</listitem>
<listitem>
<para>Place the mouse pointer over the window to move. Press and hold either &Alt; key
and the &LMB;. The mouse pointer changes to a
compass. Moving the mouse then moves the window. Release the mouse
button to release the window. This method is
useful when the window titlebar has moved off the
screen and the previous methods cannot be used.</para>
</listitem>
</itemizedlist>
</para>
</sect3>
<sect3 id="resizing-windows">
<title>Resizing Windows</title>
<indexterm><primary>Resizing Windows</primary></indexterm>
<para>The window size can be changed: bigger, smaller, wider, or taller. There
are two ways to resize a window.
Use either method:
<itemizedlist>
<listitem>
<para>Move the mouse pointer over one of the side borders of the window. The mouse pointer changes
into a horizontal double-headed arrow. Press and hold the &LMB; and drag the window border,
making the window bigger or smaller. Similarly, selecting the top or bottom
borders of the window will change the height of the window.
To concurrently change both width and height of a window,
move the mouse pointer over the corner of the
window. When the pointer becomes a diagonal double-headed arrow, select the border corner
and drag.</para>
</listitem>
<listitem>
<para>Use the left-most button on the window titlebar to display the
window menu. Choose the <guimenuitem>Resize</guimenuitem> entry, and
the mouse pointer will become a double-headed arrow. Move the mouse
pointer around to resize, and use the &LMB; to release the window.</para>
</listitem>
<listitem>
<para>When the window border or the button for the window menu are not visible,
usethe &Alt; key and &RMB;: Press and hold the &Alt; key and drag with
the &RMB;. The window will resize. Release the &RMB; when finsihed resizing.</para>
</listitem>
</itemizedlist>
</para>
<para>Windows may be maximized in size to use the entire screen. Use the
<guibutton>Maximize<indexterm><primary>Maximizing
Windows</primary></indexterm></guibutton> button, which is located on the window titlebar,
the second button from the right. Selecting that button with the mouse
will force the window to resize as large as the screen allows in both
directions. Alternately, selecting that button with the &MMB;<indexterm><primary>Maximizing
Windows</primary><secondary>Vertically</secondary></indexterm> or the
&RMB;<indexterm><primary>Maximizing Windows</primary><secondary>Horizontally</secondary></indexterm>
will increase the window's size in only the vertical or horizontal direction, respectively.</para>
</sect3>
<sect3 id="hiding-windows">
<title>Hiding Windows</title>
<indexterm><primary>Hiding Windows</primary></indexterm>
<!-- TODO: Screenshot of the minimize button -->
<para>
<indexterm><primary>Minimize</primary></indexterm>
A window can be made to shrink out of view without closing the application.
There are two ways to shrink a window: minimizing and shading. To
minimize a window, select the <guibutton>Minimize</guibutton> button,
which is located on the window titlebar, third button from the right. The window will
not be displayed, but the application remains running as can be seen
in the taskbar on the panel. To display the window again,
use the mouse to select the respective rectangular button in the taskbar or use the <keycombo
action="simul">&Alt;	</keycombo><indexterm><primary><keycombo
action="simul">&Alt;	</keycombo></primary></indexterm> as described in <xref
linkend="switching-between-windows" />.</para>
<para>
<indexterm><primary>Shade</primary></indexterm>
Shading windows is similar to minimizing, but the titlebar of the window
remains on the screen. To shade a window, use the mouse to "double-click"
on the titlebar. To restore the window, again "double-click" on the titlebar.</para>
</sect3>
<sect3 id="cascade-windows">
<title>Cascading Windows</title>
<para>Sometimes you might have a whole lot of windows open and all over the place. By selecting to cascade windows &tde; will automatically line them up as a succession from the top-left of your screen. To use this option use your &MMB; on the desktop, and then select <guimenuitem>Cascade Windows</guimenuitem>.</para>
</sect3>
<sect3 id="unclutter-windows">
<title>Uncluttering Windows</title>
<para>By selecting to unclutter your opened windows &tde; will attempt to use the maximum available space of the desktop in order to display as much of each window as possible. For example, should you have four windows open and you request that they be uncluttered, they will each be placed in a corner of the desktop, regardless of where they were originally. To use this option once again use your &MMB; on the desktop and then select <guimenuitem>Unclutter Windows</guimenuitem>.</para>
</sect3>
<sect3 id="closing-windows">
<title>Closing Windows</title>
<indexterm><primary>Closing Windows</primary></indexterm>
<para>When you finish using an application, you will want to stop
the application and close its window. Once again, you have the choice
of a few options:
<itemizedlist>
<listitem>
<para>Click on the right-most button on the window titlebar.<!-- TODO: -->
<!-- Screenie --> If you are editing a document with that application,
you will be asked whether you want to <guibutton>Save</guibutton> your
changes, <guibutton>Discard</guibutton> them, or
<guibutton>Cancel</guibutton> your command to close the application.</para>
</listitem>
<listitem>
<para>Use the <menuchoice><guimenu>File</guimenu><guimenuitem>Quit</guimenuitem>
</menuchoice> option on the menubar. You will be presented with the
same choice of <guibutton>Save</guibutton>,
<guibutton>Discard</guibutton>, or
<guibutton>Cancel</guibutton>.</para>
</listitem>
<listitem>
<para> <mousebutton>Right</mousebutton>-click on the respective window in &kicker;, the &tde; panel, and then select <guimenuitem>Close</guimenuitem>. You will be prompted with an option to save any documents that were being edited.</para>
</listitem>
<listitem>
<para>Press <keycombo action="simul">&Alt;<keycap>F4</keycap></keycombo><indexterm><primary><keycombo action="simul">&Alt;<keycap>F4</keycap>
</keycombo></primary></indexterm>
. Once again, the confirmation dialog will be shown if you
were editing any documents.</para>
</listitem>
</itemizedlist>
</para>
</sect3>
<!-- Let's try organising this a different way
<para>The bar along the top is called the titlebar, and contains most
of the things you'll need to manipulate the window. Let's take a
closer look:
<screenshot>
<mediaobject>
<imageobject>
<imagedata fileref="titlebar.png" format="png"/>
</imageobject>
<textobject><phrase>A window titlebar</phrase>
</textobject>
</mediaobject>
</screenshot>
<note><para>This screenshot shows the titlebar which appears in the
default &tde; configuration. The exact appearance on your system may
be slightly different, but the functions are similar.</para>
</note>
-->
<!-- TODO:Note &MMB; mouse button/&RMB mouse button on maximize for
vertical/horizontal maximization. Or is this advanced? -->
</sect2>
<sect2 id="advanced-window-management">
<title>Advanced Window Management</title>
<para>kstart</para>
<sect3 id="kstart">
<title>&kstart;</title>
<para>The simplest way to access the advanced window management
facilities in &tde; is to use a little known
utility called &kstart;. &kstart; lets you control the way an application interacts with
the window manager. The command is usually
used to define special behavior for commonly-used applications, but
it can also be useful for integrating non-&tde; applications into your
desktop.</para>
<para>Using &kstart; is easy: you simply put
<userinput><command>kstart</command></userinput> and some options
before a command. To begin, let's look at how we might use
&kstart; to customize the behaviour of a
&kcalc; window. The command we'll use is as follows:
<screen><prompt>%</prompt> <userinput><command>kstart</command> <option>--ontop</option> <option>--alldesktops</option> <option>kcalc</option></userinput></screen>
</para>
<para>Hopefully the effect this command is
obvious - the kcalc window will stay on top of all
the others and be visible on every virtual desktop. A feature that is
less obvious is that this command will work with any NET compliant
environment, not just &tde;.</para>
<para>We can pass arguments to programs we invoke with &kstart; as normal, for
example:
<screen><prompt>%</prompt> <userinput><command>kstart</command> <option>--skiptaskbar</option> <option>--desktop</option> 1 xmessage 'Hello World'</userinput></screen>
</para>
<para>This command displays <computeroutput>Hello
World</computeroutput> with <application>xmessage</application> and
ensures that the window will be shown on the first virtual desktop and
will be omitted from the taskbar. The fact that this program is
written using the Xt toolkit rather than being a native &tde;
application does not cause any problem for
&kstart;. Hopefully this illustrates how
&kstart; can be used to integrate foreign
applications into your &tde; desktop.</para>
</sect3>
<sect3 id="special-window-settings">
<title>Other Special Window Settings</title>
<para>While you can use &kstart; to assign particular window settings, &tde; also allows you to alter these — as well as other similar settings — from the program window itself. Simply select the left-most button in the window titlebar (or press <keycombo action="simul">&Alt;<keycap>F3</keycap></keycombo> after the window is focused), and then go to <menuchoice><guisubmenu>Advanced</guisubmenu><guimenuitem>Special Window Settings...</guimenuitem></menuchoice>. As you can see, from here you change various things from its geometry upon startup, to whether it should have a border or not.</para>
</sect3>
<sect3 id="system-tray">
<title>The System Tray</title>
<para>Now that we know how to customize the decoration of a window
let's take a look at another aspect of the desktop: the system
tray. The system tray is an area in which an application can display a
small window. It is used to display status information or provide
quick access to commands. A window that has an item in the system tray
usually disappears from the task manager when minimised with the tray
icon providing a replacement. Normally tray icons are specifically
developed as part of an application, but as with window decorations,
&tde; provides a tool for changing this:
<application>ksystraycmd</application>.</para>
<para>To begin with, we'll take the standard application &kcalc; and turn
it into a system tray application. This is acheived with one simple
command:
<screen><prompt>%</prompt> <userinput><command>ksystraycmd</command> <option>--title</option> 'kcalc' kcalc</userinput></screen>
</para>
<para>The icon shown in the tray is the one specified in the window
hints and will be updated if the icon changes. The window title is
shown as a tooltip if you hold the mouse pointer over the icon.
<application>ksystraycmd</application> follows standard &tde;
behaviour so the target window can be shown and hidden by clicking the
tray icon, and a standard context menu is available.</para>
<screenshot> <mediaobject> <imageobject><imagedata
fileref="kcalc-systray.png"></imagedata></imageobject>
</mediaobject></screenshot>
</sect3>
<sect3 id="more-complex-uses-of-ksystraycmd">
<title>More Complex Uses of
<application>ksystraycmd</application></title>
<para>To illustrate the other features of
<application>ksystraycmd</application>, we'll use a more complicated example: a &konsole; window tracking the
<filename>.xsession-errors</filename> file (this is the log file that records what's
happening on your desktop). To begin with, we'll simply look at how
we can view this:
<screen><prompt>%</prompt> <userinput><command>konsole</command> <option>--icon</option> log <option>--caption</option> 'X Log' \
<option>--nomenubar</option> <option>--notabbar</option> <option>--noframe</option> \
<option>-e</option> tail -f ~/.xsession-errors</userinput></screen>
</para>
<para>The <option>--caption</option> and <option>--icon</option>
arguments are provided as standard by &tde; applications. You can get
a full list of these global options by running an application with the
<option>--help-kde</option> and <option>--help-qt</option>
parameters. Here we give our &konsole; window the title 'X Log' and
the icon <quote>log</quote>. You can use these options with any &tde; application and
as mentioned above, <application>ksystraycmd</application> takes account of these when creating
the tray icon. The <option>-e</option> argument is specific to &konsole; and tells it
to run the <command>less</command> command. Despite its complexity, we can easily move
this window into the tray with <application>ksystraycmd</application>:
<screen><prompt>%</prompt> <userinput><command>ksystraycmd</command> <option>--hidden</option> <option>--title</option> 'X Log' \
konsole --icon log --caption 'XLog' \
--nomenubar --notabbar --noframe \
-e tail -f .xsession-errors</userinput></screen>
</para>
<para>In addition to being the
most complex command we've used, this example demonstrates the
<option>--hidden</option> option which starts the command with only the system tray
icon visible. This example achieves our aim of providing quick access
to the log file, but we can do things a little more efficiently if we
only run the konsole process when it is visible. The command we use
is
<screen><prompt>%</prompt> <userinput><command>ksystraycmd</command> <option>--startonshow</option> \
--<option>icon</option> log <option>--tooltip</option> 'X Log' \
konsole --icon log --caption 'X Log' \
--nomenubar --notabbar --noframe \
-e tail -f ~/.xsession-errors</userinput></screen>
</para>
<para>The addition of the <option>--startonshow</option> parameter tells
<application>ksystraycmd</application> to start with only the tray
icon visible (like the <option>--hidden</option> parameter), and to wait until the user
activates the tray icon before running the target command. We've also
used the <option>--quitonhide</option> parameter which tells <application>ksystraycmd</application> to terminate
the target app whenever its window is hidden. Using both these
parameters ensures that our &konsole; tray icon doesn't waste resources
when we aren't using it. Creating and destroying the target window as
we do here prevents the standard icon and title handling of
<application>ksystraycmd</application> from working, so we now need to
specify the initial icon and tooltip explicitly
too.</para>
</sect3>
<sect3 id="improving-reliability">
<title>Improving Reliability</title>
<para>In all of our previous examples we've relied on
&kstart; and
<application>ksystraycmd</application> to figure out which window we
want to affect, and unless we say otherwise, they assume that the first
window to appear is the one we want. This policy is usually OK because
we are starting the application at the same time, but it can fail
badly when lots of windows are appearing (such as when you log on). To
make our commands more robust we can use the
<option>--window</option> parameter. This specifies the title
of the target window. The following example uses the <option>--window</option> parameter
to ensure that a particular konsole window is affected:
<screen><prompt>%</prompt> <userinput><command>kstart</command> <option>--iconify</option> <option>--window</option> 'kstart_me' konsole --caption 'kstart_me' -e tail -f ~/.xsession-errors</userinput></screen>
</para>
<para>Here we've used the tried and tested technique of specifying a
title for both &kstart; and the target application. This is generally
the best way to use &kstart; and <application>ksystraycmd</application>. The <option>--window</option> argument is
supported by both &kstart; and <option>ksystraycmd</option> and can be regular expression
(⪚ <quote>window[0-9]</quote>) as well as a particular title. (Regular
expressions are a powerful pattern matching tool you'll find used
throughout &tde;.) </para>
</sect3>
</sect2>
<sect2 id="using-multiple-desktops">
<title>Using Multiple Desktops</title>
<indexterm><primary>Virtual Desktops</primary></indexterm>
<indexterm><primary>Multiple Desktops</primary></indexterm>
<para>Sometimes, one screen's worth is just not enough space. If you
use many applications at the same time, and find yourself drowning in
different windows, virtual desktops offer a solution. By default,
&tde; has four virtual desktops, each one of which is like a separate
screen: you can open windows, move windows around, and set backgrounds and
icons on each of the desktops. If you are familiar with the concept of
virtual terminals, you will have no trouble with &tde;'s virtual
desktops.</para>
<sect3 id="switching-virtual-desktops">
<title>Switching Virtual Desktops</title>
<para>One way to move to a different desktop is to use the desktop pager in the panel.
Use the mouse pointer and &LMB; to select the desired desktop.</para>
<para>Another way to move to a different virtual desktop, is using <keycombo action="simul">&Ctrl;	
</keycombo> in the same way as you would use <keycombo action="simul">&Alt;	
</keycombo> to switch between windows (refer to the <xref linkend="switching-between-windows"/>):
Hold down &Ctrl; and then press
	. A small popup window appears, showing the virtual desktops,
with one highlighted. When you release &Ctrl;, &tde; will switch to the
highlighted virtual desktop. To select a different desktop, hold down &Ctrl;
whle pressing 	 repeatedly. The selection moves
through the available desktops. When the desktop you want to switch to
is highlighted, release &Ctrl;.</para>
<!-- TODO: Write about the desktop pager thing -->
</sect3>
<sect3 id="windows-and-virtual-desktops">
<title>Windows and Virtual Desktops</title>
<para>You can move windows to different virtual desktops with the
<guisubmenu>To Desktop</guisubmenu> item in the window menu button. Use the &LMB;
to select the window menu button and select the desktop to which you want to move
the window. You can make the window appear on all desktops with the <guimenuitem>All
Desktops</guimenuitem><indexterm><primary>Sticky
Windows</primary></indexterm> item.</para>
<!-- Add links to "further reading" here
<itemizedlist>
<title>Related Information</title>
<listitem><para></para>
</listitem>
</itemizedlist>
-->
</sect3>
</sect2>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: xml
sgml-omittag:nil
sgml-shorttag:nil
sgml-namecase-general:nil
sgml-general-insert-case:lower
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:0
sgml-indent-data:true
sgml-parent-document:("index.docbook" "book" "sect1")
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->