1 <sect1 id="windows-how-to-work">
11 <title>Windows, How To Work Them</title>
13 <sect2 id="basic-window-management">
14 <title>Basic Window Management</title>
15 <indexterm><primary>Window Management</primary></indexterm>
17 <para>Each application running in &kde; has its own window, and some
18 applications may use more than one window. You can manipulate these
19 windows in many ways to make your desktop work for you. Here is a
24 <imagedata fileref="a-window.png" format="PNG"/>
26 <textobject><phrase>A normal window</phrase>
32 <sect3 id="switching-between-windows">
33 <title>Switching Between Windows</title>
34 <indexterm><primary>Focus (windows)</primary></indexterm>
36 <para>If you want to use a window, it must be active. A window
37 automatically becomes active when you open it, so that the application
38 you opened is immediately ready to use. Only one window can be active
39 at a time. The active window is the one into which you can type, and can
40 be distinguished from the others because it has a different colored
41 titlebar. (With the &kde; default theme, the active window has a
42 <replaceable>light blue</replaceable> titlebar, and the inactive
43 windows have <replaceable>gray</replaceable> titlebars.)</para>
46 <indexterm><primary>Raising Windows</primary></indexterm>
47 When you want to work in a different window, you need to make
48 it active. There are two ways to do this:
52 <para>&LMB;-click on the window that you want to make active. The
53 window will become active and will be raised above other windows if it
58 <para><indexterm><primary><keycombo
59 action="simul">&Alt;	</keycombo></primary></indexterm>
60 Hold down &Alt; and press 	 (do not release the &Alt;
61 key). A popup dialog appears with a list of available windows, one of
62 which is highlighted. You can select a different window by pressing
63 	 again to move through the list, all the time holding down
64 &Alt;. When you release the &Alt; key, the window which was highlighted
65 is made active.</para>
72 <sect3 id="moving-windows">
73 <title>Moving Windows</title>
74 <indexterm><primary>Moving Windows</primary></indexterm>
76 <para>The first way to organize the windows on your desktop is to move
77 them around. You can move windows so that they overlap other windows,
78 or so that you can see the whole window. There are three ways to move
82 <para>Click the &LMB; on the window titlebar and hold it down. Move
83 the mouse cursor and the window moves with it. Release the mouse
84 button, and the window remains where you left it.</para>
87 <!-- FIXME: OK, so the screenie sucks, but it shows the idea -->
88 <!-- In fact, maybe it's not even necessary: just mention the previous -->
89 <!-- screenshot (having callouts on it would be nice) -->
92 <para>Open the window menu using the leftmost button on the window
93 titlebar (as displayed below), and select <guimenuitem>Move</guimenuitem>. The mouse cursor
94 moves to the center of the current window and by moving the mouse
95 around, you can move the window. Once you have moved the window to the
96 position you want, click the &LMB; to release it.</para>
97 <indexterm><primary>Window Menu</primary></indexterm>
100 <screeninfo>The Window Menu</screeninfo>
103 <imagedata fileref="titlebar-menu.png" format="PNG" />
106 <phrase>The Window Menu</phrase>
113 <para>Hold down &Alt; and the &LMB; when the mouse cursor is
114 above the window you want to move. The mouse cursor changes to a
115 compass, and by moving the mouse, you can move the window. Just
116 release the mouse button to release the window. This method is
117 particularly useful if the window titlebar has been moved off the
118 screen, so you cannot use the other methods.</para>
125 <sect3 id="resizing-windows">
126 <title>Resizing Windows</title>
128 <indexterm><primary>Resizing Windows</primary></indexterm>
130 <para>You can make windows bigger or smaller, wider, or taller in
131 one of two ways. Just use whichever you are most comfortable with:
134 <para>Move the mouse cursor over the border of the window (it is light
135 blue in the screenshot above). The pointer will turn into a
136 double-headed arrow. Click and drag, and the edge of the window
137 follows the mouse cursor, making the window bigger or smaller. If you
138 click on the borders on the top or bottom of the window, you can
139 adjust the height on its own. If you click on the borders on the left
140 or right of the window, you can adjust the width. To change both at
141 the same time, move the mouse cursor over the corner of the
142 window. When the pointer becomes a diagonal double-headed arrow, click
146 <para>Use the leftmost button on the window titlebar to display the
147 window menu. Choose the <guimenuitem>Resize</guimenuitem> entry, and
148 the mouse pointer will become a double-headed arrow. Move the mouse
149 cursor around to resize, and click the &LMB; when you are done
150 to release the window.</para>
153 <para>If you cannot see the window border or the button for the window
154 menu, you can use &Alt; and the &RMB;: Hold down &Alt; and drag with
155 the &RMB;. The window will resize. You just release the &RMB; when
156 you are done. </para>
161 <para>If you just want to make a window as big as possible, so it
162 takes up the whole screen, use the
163 <guibutton>Maximize<indexterm><primary>Maximizing
164 Windows</primary></indexterm></guibutton> button, which is the second
165 button from the right on the window titlebar. Clicking with the &LMB;
166 on this button will make the window as big as possible in both
167 directions; while clicking with the &MMB;<indexterm><primary>Maximizing
168 Windows</primary><secondary>Vertically</secondary></indexterm> or the
169 &RMB;<indexterm><primary>Maximizing Windows</primary><secondary>Horizontally</secondary></indexterm>
170 will increase the window's size in only the vertical or horizontal
171 direction, respectively.</para>
176 <sect3 id="hiding-windows">
177 <title>Hiding Windows</title>
178 <indexterm><primary>Hiding Windows</primary></indexterm>
180 <!-- TODO: Screenshot of the minimize button -->
182 <indexterm><primary>Minimize</primary></indexterm>
183 When you need to keep a program open, but you do not want it to
184 take up space on your desktop, you can minimize it or shade it. To
185 minimize a window, click the <guibutton>Minimize</guibutton> button,
186 which is third from the right on the window titlebar. The window will
187 not be displayed, but the program is still running, and an entry for
188 it appears in the taskbar on the panel. To display the window again,
189 click on its entry in the taskbar. You can also use <keycombo
190 action="simul">&Alt;	</keycombo><indexterm><primary><keycombo
191 action="simul">&Alt;	</keycombo></primary></indexterm>: see <xref
192 linkend="switching-between-windows" />.</para>
195 <indexterm><primary>Shade</primary></indexterm>
196 Shading windows is very similar to minimizing them, but this
197 time, only the titlebar of the window is shown. To shade a window,
198 double-click on the titlebar. To restore the window, just double-click
199 on the titlebar again.</para>
202 <sect3 id="cascade-windows">
203 <title>Cascading Windows</title>
205 <para>Sometimes you might have a whole lot of windows open and all over the place. By selecting to cascade windows &kde; 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>
209 <sect3 id="unclutter-windows">
210 <title>Uncluttering Windows</title>
212 <para>By selecting to unclutter your opened windows &kde; 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>
216 <sect3 id="closing-windows">
217 <title>Closing Windows</title>
219 <indexterm><primary>Closing Windows</primary></indexterm>
221 <para>When you finish using an application, you will want to stop
222 the application and close its window. Once again, you have the choice
226 <para>Click on the rightmost button on the window titlebar.<!-- TODO: -->
227 <!-- Screenie --> If you are editing a document with that application,
228 you will be asked whether you want to <guibutton>Save</guibutton> your
229 changes, <guibutton>Discard</guibutton> them, or
230 <guibutton>Cancel</guibutton> your command to close the application.</para>
233 <para>Use the <menuchoice><guimenu>File</guimenu><guimenuitem>Quit</guimenuitem>
234 </menuchoice> option on the menubar. You will be presented with the
235 same choice of <guibutton>Save</guibutton>,
236 <guibutton>Discard</guibutton>, or
237 <guibutton>Cancel</guibutton>.</para>
241 <para> <mousebutton>Right</mousebutton>-click on the respective window in &kicker;, the &kde; panel, and then select <guimenuitem>Close</guimenuitem>. You will be prompted with an option to save any documents that were being edited.</para>
245 <para>Press <keycombo action="simul">&Alt;<keycap>F4</keycap></keycombo><indexterm><primary><keycombo action="simul">&Alt;<keycap>F4</keycap>
246 </keycombo></primary></indexterm>
247 . Once again, the confirmation dialog will be shown if you
248 were editing any documents.</para>
255 <!-- Let's try organising this a different way
256 <para>The bar along the top is called the titlebar, and contains most
257 of the things you'll need to manipulate the window. Let's take a
262 <imagedata fileref="titlebar.png" format="png"/>
264 <textobject><phrase>A window titlebar</phrase>
268 <note><para>This screenshot shows the titlebar which appears in the
269 default &kde; configuration. The exact appearance on your system may
270 be slightly different, but the functions are similar.</para>
274 <!-- TODO:Note &MMB; mouse button/&RMB mouse button on maximize for
275 vertical/horizontal maximization. Or is this advanced? -->
279 <sect2 id="advanced-window-management">
280 <title>Advanced Window Management</title>
287 &Richard.J.Moore.mail;
290 <title>&kstart;</title>
292 <para>The simplest way to access the advanced window management
293 facilities in &kde; is to use a little known
294 utility called &kstart;, which is included in &kde; since version 2.1 &kstart; lets you control the way an application interacts with
295 the window manager. The command is usually
296 used to define special behavior for commonly-used applications, but
297 it can also be useful for integrating non-&kde; applications into your
300 <para>Using &kstart; is easy: you simply put
301 <userinput><command>kstart</command></userinput> and some options
302 before a command. To begin, let's look at how we might use
303 &kstart; to customize the behaviour of a
304 &kcalc; window. The command we'll use is as follows:
306 <screen><prompt>%</prompt> <userinput><command>kstart</command> <option>--ontop</option> <option>--alldesktops</option> <option>kcalc</option></userinput></screen>
309 <para>With luck, the effect this command has
310 should be fairly obvious - the kcalc window will stay on top of all
311 the others and be visible on every virtual desktop. A feature that is
312 less obvious is that this command will work with any NET compliant
313 environment, not just &kde;.</para>
315 <para>We can pass arguments to programs we invoke with &kstart; as normal, for
318 <screen><prompt>%</prompt> <userinput><command>kstart</command>
319 <option>--skiptaskbar</option> <option>--desktop</option>
320 1 xmessage'Hello World'</userinput></screen>
324 <para>This command displays <computeroutput>Hello
325 World</computeroutput> with <application>xmessage</application> and
326 ensures that the window will be shown on the first virtual desktop and
327 will be omitted from the taskbar. The fact that this program is
328 written using the Xt toolkit rather than being a native &kde;
329 application does not cause any problem for
330 &kstart;, hopefully this illustrates how
331 &kstart; can be used to integrate foreign
332 applications into your &kde; desktop.</para>
335 <sect3 id="special-window-settings">
336 <title>Other Special Window Settings</title>
337 <para>While you can use &kstart; to assign particular window settings, &kde; also allows you to alter these -- as well as other similar settings -- from the program window itself. Simply select the leftmost button in the window titlebar (or just hit <keycombo action="simul">&Alt;<keycap>F3</keycap></keycombo> once the window is focued), 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>
340 <sect3 id="system-tray">
344 &Richard.J.Moore.mail;
348 <title>The System Tray</title>
350 <para>Now that we know how to customize the decoration of a window
351 let's take a look at another aspect of the desktop: the system
352 tray. The system tray is an area in which an application can display a
353 small window. It is used to display status information or provide
354 quick access to commands. A window that has an item in the system tray
355 usually disappears from the task manager when minimised with the tray
356 icon providing a replacement. Normally tray icons are specifically
357 developed as part of an application, but as with window decorations,
358 &kde; provides a tool for changing this:
359 <application>ksystraycmd</application>.</para>
361 <para>To begin with, we'll take the standard application &kcalc; and turn
362 it into a system tray application. This is acheived with one simple
364 <screen><prompt>%</prompt> <userinput><command>ksystraycmd</command> <option>--title</option> 'kcalc' kcalc</userinput></screen>
368 <para>The icon shown in the tray is the one specified in the window
369 hints and will be updated if the icon changes. The window title is
370 shown as a tooltip if you hold the mouse over the icon.
371 <application>ksystraycmd</application> follows standard &kde;
372 behaviour so the target window can be shown and hidden by clicking the
373 tray icon, and a standard context menu is available. </para>
375 <screenshot> <mediaobject> <imageobject><imagedata
376 fileref="kcalc-systray.png"></imagedata></imageobject>
377 </mediaobject></screenshot>
380 <sect3 id="more-complex-uses-of-ksystraycmd">
384 &Richard.J.Moore.mail;
388 <title>More Complex Uses of
389 <application>ksystraycmd</application></title>
391 <para>To illustrate the other features of
392 <application>ksystraycmd</application>, we'll use a more complicated example: a &konsole; window tracking the
393 <filename>.xsession-errors</filename> file (this is the log file that records what's
394 happening on your desktop). To begin with, we'll simply look at how
396 <screen><prompt>%</prompt> <userinput><command>konsole</command> <option>--icon</option>
397 log <option>--caption</option> 'X Log' \
398 <option>--nomenubar</option> <option>--notabbar</option>
399 <option>--noframe</option> \
400 <option>-e</option> tail -f ~/.xsession-errors</userinput></screen>
403 <para>The <option>--caption</option> and <option>--icon</option>
404 arguments are provided as standard by &kde; applications. You can get
405 a full list of these global options by running an application with the
406 <option>--help-kde</option> and <option>--help-qt</option>
407 parameters. Here we give our &konsole; window the title 'X Log' and
408 the icon <quote>log</quote>. You can use these options with any &kde; application and
409 as mentioned above, <application>ksystraycmd</application> takes account of these when creating
410 the tray icon. The <option>-e</option> argument is specific to &konsole; and tells it
411 to run the <command>less</command> command. Despite its complexity, we can easily move
412 this window into the tray with <application>ksystraycmd</application>:
414 <screen><prompt>%</prompt> <userinput><command>ksystraycmd</command>
415 <option>--hidden</option> <option>--title</option> 'X Log' \
416 konsole --icon log --caption 'XLog' \
417 --nomenubar --notabbar --noframe \
418 -e tail -f .xsession-errors</userinput></screen>
421 <para>In addition to being the
422 most complex command we've used, this example demonstrates the
423 <option>--hidden</option> option which starts the command with only the system tray
424 icon visible. This example achieves our aim of providing quick access
425 to the log file, but we can do things a little more efficiently if we
426 only run the konsole process when it is visible. The command we use
428 <screen><prompt>%</prompt> <userinput><command>ksystraycmd</command> <option>--startonshow</option> \
429 --<option>icon</option> log <option>--tooltip</option> 'X Log' \
430 konsole --icon log --caption 'X Log' \
431 --nomenubar --notabbar --noframe \
432 -e tail -f ~/.xsession-errors</userinput></screen>
435 <para>The addition of the <option>--startonshow</option> parameter tells
436 <application>ksystraycmd</application> to start with only the tray
437 icon visible (like the <option>--hidden</option> parameter), and to wait until the user
438 activates the tray icon before running the target command. We've also
439 used the <option>--quitonhide</option> parameter which tells <application>ksystraycmd</application> to terminate
440 the target app whenever its window is hidden. Using both these
441 parameters ensures that our &konsole; tray icon doesn't waste resources
442 when we aren't using it. Creating and destroying the target window as
443 we do here prevents the standard icon and title handling of
444 <application>ksystraycmd</application> from working, so we now need to
445 specify the initial icon and tooltip explicitly
449 <sect3 id="improving-reliability">
453 &Richard.J.Moore.mail;
457 <title>Improving Reliability</title>
459 <para>In all of our previous examples we've relied on
461 <application>ksystraycmd</application> to figure out which window we
462 want to affect, and unless we say otherwise, they assume that the first
463 window to appear is the one we want. This policy is usually OK because
464 we are starting the application at the same time, but it can fail
465 badly when lots of windows are appearing (such as when you log on). To
466 make our commands more robust we can use the
467 <option>--window</option> parameter. This specifies the title
468 of the target window. The following example uses the <option>--window</option> parameter
469 to ensure that a particular konsole window is affected:
471 <screen><prompt>%</prompt> <userinput><command>kstart</command> <option>--iconify</option> <option>--window</option> 'kstart_me' konsole
472 --caption 'kstart_me' -e tail -f
473 ~/.xsession-errors</userinput></screen>
477 <para>Here we've used the tried and tested technique of specifying a
478 title for both &kstart; and the target application. This is generally
479 the best way to use &kstart; and <application>ksystraycmd</application>. The <option>--window</option> argument is
480 supported by both &kstart; and <option>ksystraycmd</option> and can be regular expression
481 (⪚ <quote>window[0-9]</quote>) as well as a particular title. (Regular
482 expressions are a powerful pattern matching tool you'll find used
483 throughout &kde;.) </para>
489 <sect2 id="using-multiple-desktops">
490 <title>Using Multiple Desktops</title>
492 <indexterm><primary>Virtual Desktops</primary></indexterm>
493 <indexterm><primary>Multiple Desktops</primary></indexterm>
495 <para>Sometimes, one screen's worth is just not enough space. If you
496 use many applications at the same time, and find yourself drowning in
497 different windows, virtual desktops offer the solution. By default,
498 &kde; has four virtual desktops, each one of which is like a separate
499 screen: you can open windows, move windows around, and set backgrounds and
500 icons on each of the desktops. If you are familiar with the concept of
501 virtual terminals, you will have no trouble with &kde;'s virtual
504 <sect3 id="switching-virtual-desktops">
505 <title>Switching Virtual Desktops</title>
506 <para>To move to a different virtual desktop, you can use <keycombo action="simul">&Ctrl;	
507 </keycombo> in the same way as you would use <keycombo action="simul">&Alt;	
508 </keycombo> to switch between windows (see <xref linkend="switching-between-windows"/>): Hold down &Ctrl; and then press
509 	. A small popup window appears, showing the virtual desktops,
510 with one highlighted. If you release &Ctrl;, &kde; will switch to the
511 highlighted virtual desktop. To select a different desktop, press
512 	 repeatedly, while holding down &Ctrl;. The selection moves
513 through the available desktops. When the desktop you want to switch to
514 is highlighted, release &Ctrl;.</para>
516 <!-- TODO: Write about the desktop pager thing -->
520 <sect3 id="windows-and-virtual-desktops">
521 <title>Windows and Virtual Desktops</title>
522 <para>You can move windows around your virtual desktops with the
523 <guisubmenu>To Desktop</guisubmenu> item in the window menu: just
524 select the desktop to which you want to move the window. You can make the
525 window appear on all desktops with the <guimenuitem>All
526 Desktops</guimenuitem><indexterm><primary>Sticky
527 Windows</primary></indexterm> item.</para>
529 <!-- Add links to "further reading" here
531 <title>Related Information</title>
532 <listitem><para></para>
543 <!-- Keep this comment at the end of the file
548 sgml-namecase-general:nil
549 sgml-general-insert-case:lower
550 sgml-minimize-attributes:nil
551 sgml-always-quote-attributes:t
553 sgml-indent-data:true
554 sgml-parent-document:("index.docbook" "book" "sect1")
555 sgml-exposed-tags:nil
556 sgml-local-catalogs:nil
557 sgml-local-ecat-files:nil