1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
3 <!--Converted with LaTeX2HTML 2002-2-1 (1.71)
4 original version by: Nikos Drakos, CBLU, University of Leeds
5 * revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
6 * with significant contributions from:
7 Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
10 <TITLE>3. Basic configuration</TITLE>
11 <META NAME="description" CONTENT="3. Basic configuration">
12 <META NAME="keywords" CONTENT="ionconf">
13 <META NAME="resource-type" CONTENT="document">
14 <META NAME="distribution" CONTENT="global">
16 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
17 <META NAME="Generator" CONTENT="LaTeX2HTML v2002-2-1">
18 <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
20 <LINK REL="STYLESHEET" HREF="ionconf.css">
22 <LINK REL="next" HREF="node5.html">
23 <LINK REL="previous" HREF="node3.html">
24 <LINK REL="up" HREF="ionconf.html">
25 <LINK REL="next" HREF="node5.html">
30 <DIV CLASS="navigation"><!--Navigation Panel-->
33 <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A>
36 <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A>
39 <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A>
42 <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A>
45 <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A>
47 <B> Next:</B> <A NAME="tex2html289"
48 HREF="node5.html">4. Graphical styles</A>
49 <B> Up:</B> <A NAME="tex2html283"
50 HREF="ionconf.html">Configuring and extending Ion3</A>
51 <B> Previous:</B> <A NAME="tex2html277"
52 HREF="node3.html">2. Preliminaries: Key concepts</A>
53 <B> <A NAME="tex2html285"
54 HREF="node1.html">Contents</A></B>
55 <B> <A NAME="tex2html287"
56 HREF="node11.html">Index</A></B>
59 <!--End of Navigation Panel-->
60 <!--Table of Child-Links-->
61 <A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>
63 <UL CLASS="ChildLinks">
64 <LI><A NAME="tex2html290"
65 HREF="node4.html#SECTION00410000000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">1</SPAN> The configuration files</A>
66 <LI><A NAME="tex2html291"
67 HREF="node4.html#SECTION00420000000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">2</SPAN> A walk through <SPAN CLASS="textit">cfg_ion.lua</SPAN></A>
68 <LI><A NAME="tex2html292"
69 HREF="node4.html#SECTION00430000000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">3</SPAN> Keys and rodents</A>
71 <LI><A NAME="tex2html293"
72 HREF="node4.html#SECTION00431000000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">1</SPAN> Binding handlers and special variables</A>
73 <LI><A NAME="tex2html294"
74 HREF="node4.html#SECTION00432000000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">2</SPAN> Guards</A>
75 <LI><A NAME="tex2html295"
76 HREF="node4.html#SECTION00433000000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">3</SPAN> Defining the bindings</A>
77 <LI><A NAME="tex2html296"
78 HREF="node4.html#SECTION00434000000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">4</SPAN> Examples</A>
79 <LI><A NAME="tex2html297"
80 HREF="node4.html#SECTION00435000000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">5</SPAN> Key specifications</A>
81 <LI><A NAME="tex2html298"
82 HREF="node4.html#SECTION00436000000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">6</SPAN> Button specifications</A>
83 <LI><A NAME="tex2html299"
84 HREF="node4.html#SECTION00437000000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">7</SPAN> A further note on the default binding configuration</A>
87 <LI><A NAME="tex2html300"
88 HREF="node4.html#SECTION00440000000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">4</SPAN> Menus</A>
90 <LI><A NAME="tex2html301"
91 HREF="node4.html#SECTION00441000000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">4</SPAN>.<SPAN CLASS="arabic">1</SPAN> Defining menus</A>
92 <LI><A NAME="tex2html302"
93 HREF="node4.html#SECTION00442000000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">4</SPAN>.<SPAN CLASS="arabic">2</SPAN> Special menus</A>
94 <LI><A NAME="tex2html303"
95 HREF="node4.html#SECTION00443000000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">4</SPAN>.<SPAN CLASS="arabic">3</SPAN> Defining context menus</A>
96 <LI><A NAME="tex2html304"
97 HREF="node4.html#SECTION00444000000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">4</SPAN>.<SPAN CLASS="arabic">4</SPAN> Displaying menus</A>
100 <LI><A NAME="tex2html305"
101 HREF="node4.html#SECTION00450000000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">5</SPAN> Winprops</A>
103 <LI><A NAME="tex2html306"
104 HREF="node4.html#SECTION00451000000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">1</SPAN> Sizehint winprops</A>
105 <LI><A NAME="tex2html307"
106 HREF="node4.html#SECTION00452000000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">2</SPAN> Classes, roles and instances</A>
107 <LI><A NAME="tex2html308"
108 HREF="node4.html#SECTION00453000000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">3</SPAN> Finding window identification</A>
109 <LI><A NAME="tex2html309"
110 HREF="node4.html#SECTION00454000000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">4</SPAN> Some common examples</A>
112 <LI><A NAME="tex2html310"
113 HREF="node4.html#SECTION00454100000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">4</SPAN>.<SPAN CLASS="arabic">1</SPAN> Acrobat Reader</A>
114 <LI><A NAME="tex2html311"
115 HREF="node4.html#SECTION00454200000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">4</SPAN>.<SPAN CLASS="arabic">2</SPAN> Forcing newly created windows in named frames</A>
119 <LI><A NAME="tex2html312"
120 HREF="node4.html#SECTION00460000000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">6</SPAN> The statusbar</A>
122 <LI><A NAME="tex2html313"
123 HREF="node4.html#SECTION00461000000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">6</SPAN>.<SPAN CLASS="arabic">1</SPAN> The template</A>
124 <LI><A NAME="tex2html314"
125 HREF="node4.html#SECTION00462000000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">6</SPAN>.<SPAN CLASS="arabic">2</SPAN> The systray</A>
126 <LI><A NAME="tex2html315"
127 HREF="node4.html#SECTION00463000000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">6</SPAN>.<SPAN CLASS="arabic">3</SPAN> Monitors</A>
129 <LI><A NAME="tex2html316"
130 HREF="node4.html#SECTION00463100000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">6</SPAN>.<SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">1</SPAN> Date</A>
131 <LI><A NAME="tex2html317"
132 HREF="node4.html#SECTION00463200000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">6</SPAN>.<SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">2</SPAN> Load</A>
133 <LI><A NAME="tex2html318"
134 HREF="node4.html#SECTION00463300000000000000"><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">6</SPAN>.<SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">3</SPAN> Mail</A>
136 <!--End of Table of Child-Links-->
139 <H1><A NAME="SECTION00400000000000000000"></A>
140 <A NAME="chap:config"></A>
142 <SPAN CLASS="arabic">3</SPAN>. Basic configuration
146 This chapter should help your configure Ion to your liking. As the your
147 probably already know, Ion uses Lua as a configuration and extension
148 language. If you're new to it, you might first want to read some Lua
149 documentation as already suggested and pointed to in the Introduction
150 before continuing with this chapter.
153 Section <A HREF="#sec:conffiles">3.1</A> is an overview of the multiple configuration
154 files Ion uses and as a perhaps more understandable introduction to the
155 general layout of the configuration files, a walk-through of the main
156 configuration file <SPAN CLASS="textit">ion.lua</SPAN> is provided in section
157 <A HREF="#sec:walkthrough">3.2</A>.
158 How keys and mouse action are bound to functions is described in detail
159 in <A HREF="#sec:bindings">3.3</A> and in section <A HREF="#sec:winprops">3.5</A> winprops are
160 explained. Finally, the statusbar is explained in <A HREF="#sec:statusbar">3.6</A>.
161 For a reference on exported functions, see section <A HREF="node7.html#sec:exports">6</A>.
165 <H2><A NAME="SECTION00410000000000000000"></A>
166 <A NAME="sec:conffiles"></A>
168 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">1</SPAN> The configuration files
172 Ion3, to which document applies, stores its stock configuration files in
173 <SPAN CLASS="textit">/usr/local/etc/ion3/</SPAN> unless you, the OS package maintainer or
174 whoever installed the package on the system has modified the variables
175 <TT>PREFIX</TT><A NAME="582"></A> or
176 <TT>ETCDIR</TT><A NAME="583"></A> in
177 <SPAN CLASS="textit">system.mk</SPAN><A NAME="584"></A> before compiling Ion.
178 In the first case you probably know where to find the files and in
179 the other case the system administrator or the OS package maintainer
180 should have provided documentation to point to the correct location.
181 If these instructions are no help in locating the correct directory,
182 the command <TT>locate cfg_ion.lua</TT> might help provided <TT>updatedb</TT>
183 has been run recently.
186 User configuration files go in <SPAN CLASS="textit">~/.ion3/</SPAN>.
187 Ion always searches the user configuration file directory before the stock
188 configuration file directory for files. Therefore, if you want to change
189 some setting, it is advised against that you modify the stock configuration
190 files in-place as subsequent installs of Ion will restore the stock
191 configuration files. Instead you should always make a copy of the stock
192 file in <SPAN CLASS="textit">~/.ion3/</SPAN> and modify this file. When searching
193 for a file, if no extension or path component is given, compiled <SPAN CLASS="textit">.lc</SPAN>
194 files are attempted before <SPAN CLASS="textit">.lua</SPAN> files.
197 All the configuration files are named <SPAN CLASS="textit">cfg_*.lua</SPAN> with the ``<SPAN CLASS="textit">*</SPAN>''
198 part varying. The configuration file for each module <SPAN CLASS="textit">mod_modname</SPAN> is
199 <SPAN CLASS="textit">cfg_modname.lua</SPAN>, with <SPAN CLASS="textit">modname</SPAN> varying by the module in
200 question. The following table summarises these and other configuration
204 <TABLE CELLPADDING=3 BORDER="1" WIDTH="100%">
205 <TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>File</TD>
206 <TD ALIGN="LEFT">Description</TD>
208 <TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><SPAN CLASS="textit">cfg_ion.lua</SPAN></TD>
209 <TD ALIGN="LEFT">The main configuration file</TD>
211 <TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><SPAN CLASS="textit">cfg_ioncore.lua</SPAN></TD>
212 <TD ALIGN="LEFT">Configuration file for Ion's core library.
213 Most of the bindings and menus are configured here. Bindings that are
214 specific to some module are configured in the module's configuration
215 file. For details, see section <A HREF="#sec:bindings">3.3</A>.</TD>
217 <TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><SPAN CLASS="textit">cfg_kludges.lua</SPAN></TD>
218 <TD ALIGN="LEFT">Settings to get some applications behave more nicely have been
219 collected here. See section <A HREF="#sec:winprops">3.5</A>.</TD>
221 <TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><SPAN CLASS="textit">cfg_layouts.lua</SPAN></TD>
222 <TD ALIGN="LEFT">Some workspace layouts are defined here.</TD>
224 <TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><SPAN CLASS="textit">cfg_tiling.lua</SPAN>
225 <SPAN CLASS="textit">cfg_query.lua</SPAN>
226 <SPAN CLASS="textit">cfg_menu.lua</SPAN>
227 <SPAN CLASS="textit">cfg_dock.lua</SPAN>
228 <SPAN CLASS="textit">cfg_statusbar.lua</SPAN>
230 <TD ALIGN="LEFT">Configuration files for different modules.</TD>
235 Additionally, there's the file <SPAN CLASS="textit">look.lua</SPAN> that configures the
236 drawing engine, but it is covered in chapter <A HREF="node5.html#chap:gr">4</A>.
240 <H2><A NAME="SECTION00420000000000000000"></A>
241 <A NAME="sec:walkthrough"></A>
243 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">2</SPAN> A walk through <SPAN CLASS="textit">cfg_ion.lua</SPAN>
247 As already mentioned <SPAN CLASS="textit">cfg_ion.lua</SPAN> is Ion's main configuration
248 file. Some basic 'feel' settings are usually configured there and
249 the necessary modules and other configuration files configuring some
250 more specific aspects of Ion are loaded there. In this section we
251 take a walk through the stock <SPAN CLASS="textit">cfg_ion.lua</SPAN>.
252 Notice that most of the settings are commented-out (<code>--</code> is a
253 line comment in Lua) in the actual file, as they're the defaults
257 The first thing done in the file, is to set
262 These settings cause most of Ion's key bindings to use <SPAN CLASS="textbf">Mod1</SPAN> as the
263 modifier key. If <TT>ALTMETA</TT> is set, it is used as modifier for the
264 keys that don't normally use a modifier. Note that these two are Lua
265 variables used in the configuration files only, and not Ion settings.
266 For details on modifiers and key binding setup in general, see section
267 <A HREF="#sec:bindings">3.3</A>.
270 Next we do some basic feel configuration:
281 These two will set the delay between button presses in a double click, and
282 the timeout to quit resize mode in milliseconds.
293 The first of these two settings enables opaque resize mode: in move/resize
294 move frames and other objects mirror you actions immediately. If opaque
295 resize is disabled, a XOR rubber band is shown during the mode instead.
296 This will, unfortunately, cause Ion to also grab the X server and has some
300 There are some other options as well; see the documentation
301 for <A HREF="node7.html#fn:ioncore.set"><TT>ioncore.set</TT></A> for details.
304 As a next step, in the actual <SPAN CLASS="textit">cfg_ion.lua</SPAN> file, we load
305 <SPAN CLASS="textit">cfg_defaults.lua</SPAN>. However, it is merely a convenience file for
306 doing exactly what we will going through below, and what is commented
307 out in the actual file. If you do not want to load what
308 <SPAN CLASS="textit">cfg_defaults.lua</SPAN> loads, just comment out the corresponding
309 line, and uncomment the lines for the files that you want:
313 --dopath("cfg_defaults")
314 dopath("cfg_ioncore")
315 dopath("cfg_kludges")
316 dopath("cfg_layouts")
320 Most bindings and menus are defined in <SPAN CLASS="textit">cfg_ioncore.lua</SPAN>.
321 Details on making such definitions follow in sections <A HREF="#sec:bindings">3.3</A>
322 and <A HREF="#sec:menus">3.4</A>, respectively.
323 some kludges or ``winprops'' to make some applications behave better
324 under Ion are collected in <SPAN CLASS="textit">cfg_kludges.lua</SPAN>; see section
325 <A HREF="#sec:winprops">3.5</A> for details. In addition to these, this file
326 lists quite a few statements of the form
328 ioncore.defshortening("[^:]+: (.*)(<[0-9]+>)", "$1$2$|$1$<...$2")
330 These are used to configure how Ion attempts to shorten window titles
331 when they do not fit in a Tab. The first argument is a POSIX regular
332 expression that is used to match against the title and the next is
333 a rule to construct a new title of a match occurs. This particular
334 rule is used to shorten e.g. 'Foo: barbaz<3>' to 'barba...<3>'; for
335 details see the function reference entry for <A HREF="node7.html#fn:ioncore.defshortening"><TT>ioncore.defshortening</TT></A>.
336 Finally, <SPAN CLASS="textit">cfg_layouts.lua</SPAN> defines some workspace layouts, available
337 through the <SPAN CLASS="textbf">F9</SPAN> workspace creation query.
340 To actually be able to do something besides display windows in full screen
341 mode, we must next load some modules:
348 dopath("mod_statusbar")
355 <H2><A NAME="SECTION00430000000000000000"></A>
356 <A NAME="sec:bindings"></A>
358 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">3</SPAN> Keys and rodents
362 In the stock configuration file setup, most key and mouse bindings are set
363 from the file <SPAN CLASS="textit">cfg_ioncore.lua</SPAN> while module-specific bindings
364 are set from the modules' main configuration files (<SPAN CLASS="textit">cfg_modname.lua</SPAN>).
365 This, however, does not have to be so as long as the module has been
366 loaded prior to defining any module-specific bindings.
369 Bindings are defined by calling the function
370 <A HREF="node7.html#fn:ioncore.defbindings"><TT>defbindings</TT></A> with the ``context'' of the
371 bindings and the a table of new bindings to make. The context is simply
372 string indicating one of the classes of regions (or modes such as
373 WMoveresMode) introduced in section <A HREF="node3.html#sec:objects">2.2</A>, and fully
374 listed in appendix <A HREF="node9.html#app:fullhierarchy">B</A>, although not all define
375 a binding map. For example, the following skeleton would be used to
376 define new bindings for all frames:
380 defbindings("WFrame", {
381 -- List of bindings to make goes here.
386 There has been some confusion among users about the need to define the
387 ``context'' for each binding, so let me try to explain this design
388 decision here. The thing is that if there was a just a simple 'bind this
389 key to this action' method without knowledge of the context, some
390 limitations would have to be made on the available actions and writing
391 custom handlers would be more complicated. In addition one may want to
392 bind the same function to different key for different types of objects.
393 Indeed, the workspace and frame tab switching functions are the same both
394 classes being based on WMPlex, and in the stock configuration the
395 switch to <SPAN CLASS="MATH"><IMG
396 WIDTH="15" HEIGHT="14" ALIGN="BOTTOM" BORDER="0"
398 ALT="$n$"></SPAN>:th workspaces is bound to <SPAN CLASS="textbf">Mod1+n</SPAN> while the switch to
399 <SPAN CLASS="MATH"><IMG
400 WIDTH="15" HEIGHT="14" ALIGN="BOTTOM" BORDER="0"
402 ALT="$n$"></SPAN>:th tab is bound to the sequence <SPAN CLASS="textbf">Mod1+k n</SPAN>.
405 Currently known contexts include:
408 `<TT>WMPlex.toplevel</TT>',
410 `<TT>WFrame.toplevel</TT>',
411 `<TT>WFrame.floating</TT>',
412 `<TT>WFrame.tiled</TT>',
413 `<TT>WFrame.transient</TT>',
414 `<TT>WMoveresMode</TT>',
418 `<TT>WClientWin</TT>',
419 `<TT>WTiling</TT>', and
420 `<TT>WStatusBar</TT>'.
421 Most of these should be self-explanatory, corresponding to objects
422 of class with the same name. The ones with `<TT>.toplevel</TT>' suffix
423 refer to screens and ``toplevel'' frames, i.e. frames that are
424 not used for transient windows. Likewise `<TT>.transient</TT>' refers
425 to frames in transient mode, and `<TT>.tiled</TT>' and `<TT>.floating</TT>'
426 to frames in, respectively, tiled and floating modes.
429 The following subsections describe how to construct elements of the
430 binding table. Note that <A HREF="node7.html#fn:ioncore.defbindings"><TT>defbindings</TT></A> adds
431 the the newly defined bindings to the previous bindings of the context,
432 overriding duplicates. To unbind an event, set the handler parameter
433 to <TT>nil</TT> for each of the functions to be described in the following
437 Also note that when multiple objects want to handle a binding, the
438 innermost (when the root window is considered the outermost) active object
439 in the parent-child hierarchy (see Figure <A HREF="node3.html#fig:parentship">2.2</A>) of objects
440 gets to handle the action.
444 <H3><A NAME="SECTION00431000000000000000">
445 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">1</SPAN> Binding handlers and special variables</A>
449 Unlike in Ion2, in Ion3 binding handlers are not normally passed as
450 ``anonymous functions'', although this is still possible. The preferred
451 method now is to pass the code of the handler as a string. Two following
452 special variables are available in this code.
455 <TABLE CELLPADDING=3 BORDER="1" WIDTH="100%">
456 <TR><TD ALIGN="LEFT">Variable</TD>
457 <TD ALIGN="LEFT">Description</TD>
459 <TR><TD ALIGN="LEFT"><TT>_</TT> (underscore)</TD>
460 <TD ALIGN="LEFT">Reference to the object on which the
461 binding was triggered. The object is of the same class as the the
462 context of the <A HREF="node7.html#fn:ioncore.defbindings"><TT>defbindings</TT></A> call
463 defining the binding.</TD>
465 <TR><TD ALIGN="LEFT"><TT>_sub</TT></TD>
466 <TD ALIGN="LEFT">Usually, the currently active <SPAN CLASS="textit">managed object</SPAN> of the
467 object referred to by <TT>_</TT>, but sometimes (e.g. mouse actions
468 on tabs of frames) something else relevant to the action triggering
471 <TR><TD ALIGN="LEFT"><TT>_chld</TT></TD>
472 <TD ALIGN="LEFT">Object corresponding to the currently active child window of the
473 object referred to by <TT>_</TT>. This should seldom be needed.</TD>
478 For example, supposing <TT>_</TT> (underscore) is a WFrame, the
479 following handler should move the active window to the right, if
489 <H3><A NAME="SECTION00432000000000000000">
490 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">2</SPAN> Guards</A>
494 To suppress error messages, each binding handler may also be accompanied
495 by a ``guard'' expression that blocks the handler from being called when
496 the guard condition is not met. Currently the following guard expressions
497 are supported (for both <TT>_sub</TT> and <TT>_chld</TT>):
500 <TABLE CELLPADDING=3 BORDER="1" WIDTH="100%">
501 <TR><TD ALIGN="LEFT">Guard</TD>
502 <TD ALIGN="LEFT">Description</TD>
504 <TR><TD ALIGN="LEFT">`<TT>_sub:non-nil</TT>'</TD>
505 <TD ALIGN="LEFT">The <TT>_sub</TT> parameter must be set.</TD>
507 <TR><TD ALIGN="LEFT">`<TT>_sub:SomeClass</TT>'</TD>
508 <TD ALIGN="LEFT">The <TT>_sub</TT> parameter must be member
509 of class SomeClass.</TD>
515 <H3><A NAME="SECTION00433000000000000000"></A>
516 <A NAME="sec:binddef"></A>
518 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">3</SPAN> Defining the bindings
522 The descriptions of the individual bindings in the binding table argument
523 to <A HREF="node7.html#fn:ioncore.defbindings"><TT>defbindings</TT></A> should be constructed with the following
530 <LI><A HREF="node7.html#fn:ioncore.kpress"><TT>kpress</TT></A>, and
531 <A HREF="node7.html#fn:ioncore.kpress_wait"><TT>kpress_wait</TT></A><TT>(keyspec, handler [, guard])</TT>.
533 <LI><A HREF="node7.html#fn:ioncore.submap"><TT>submap</TT></A><TT>(keyspec, { ... more key bindings ... })</TT>.
535 <LI><A HREF="node7.html#fn:ioncore.submap_enter"><TT>submap_enter</TT></A>, and
536 <A HREF="node7.html#fn:ioncore.submap_wait"><TT>submap_wait</TT></A><TT>(handler [, guard])</TT>.
542 <LI><A HREF="node7.html#fn:ioncore.mclick"><TT>mclick</TT></A>,
543 <A HREF="node7.html#fn:ioncore.mdblclick"><TT>mdblclick</TT></A>,
544 <A HREF="node7.html#fn:ioncore.mpress"><TT>mpress</TT></A>, and
545 <A HREF="node7.html#fn:ioncore.mdrag"><TT>mdrag</TT></A><TT>(buttonspec, handler [, guard])</TT>.
550 The actions that most of these functions correspond to should be clear
551 and as explained in the reference, <A HREF="node7.html#fn:ioncore.kpress_wait"><TT>kpress_wait</TT></A> is simply
552 <A HREF="node7.html#fn:ioncore.kpress"><TT>kpress</TT></A> with a flag set instructing Ioncore wait for
553 all modifiers to be released before processing any further actions.
554 This is to stop one from accidentally calling e.g.
555 <A HREF="node7.html#fn:WRegion.rqclose"><TT>WRegion.rqclose</TT></A> multiple times in a row. The
556 <A HREF="node7.html#fn:ioncore.submap"><TT>submap</TT></A> function is used to define submaps or
557 ``prefix maps''. The second argument to this function is table listing
558 the key press actions (<A HREF="node7.html#fn:ioncore.kpress"><TT>kpress</TT></A>) in the submap.
559 The <A HREF="node7.html#fn:ioncore.submap_enter"><TT>submap_enter</TT></A> handler is called when the submap
560 is entered, in which this handler is defined. Likewise, the
561 <A HREF="node7.html#fn:ioncore.submap_wait"><TT>submap_wait</TT></A> handler is called when all modifiers
562 have been released while waiting for further key presses in the submap.
565 The parameters <TT>keyspec</TT> and <TT>buttonspec</TT> are explained below
566 in detail. The parameter <TT>handler</TT> is the handler for the binding,
567 and the optional parameter <TT>guard</TT> its guard. These should normally
568 be strings as explained above.
572 <H3><A NAME="SECTION00434000000000000000">
573 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">4</SPAN> Examples</A>
577 For example, to just bind the key <SPAN CLASS="textbf">Mod1+1</SPAN> to switch to the first
578 workspace and <SPAN CLASS="textbf">Mod1+Right</SPAN> to the next workspace, you would make the
581 defbindings("WScreen", {
582 kpress("Mod1+Right", "_:switch_next()"),
583 kpress("Mod1+1", "_:switch_nth(1)"),
588 Note that <TT>_:switch_nth(1)</TT> is the same as calling
589 <A HREF="node7.html#fn:WMPlex.switch_next"><TT>WMPlex.switch_next</TT></A><TT>(_, 1)</TT> as WScreen inherits
590 WMPlex and this is where the function is actually defined.
593 Similarly to the above example, to bind the key sequence <SPAN CLASS="textbf">Mod1+k n</SPAN>
594 switch to the next managed object within a frame, and <SPAN CLASS="textbf">Mod1+k 1</SPAN> to the
595 first, you would issue the following call:
597 defbindings("WFrame", {
599 kpress("Right", "_:switch_next()"),
600 kpress("1", "_:switch_nth(1)"),
607 <H3><A NAME="SECTION00435000000000000000">
608 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">5</SPAN> Key specifications</A>
612 As seen above, the functions that create key binding specifications require
613 a <TT>keyspec</TT> argument. This argument should be a string containing the
614 name of a key as listed in the X header file <SPAN CLASS="textit">keysymdef.h</SPAN><A NAME="tex2html7"
615 HREF="#foot876"><SUP><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">1</SPAN></SUP></A> without the <TT>XK_</TT> prefix.
617 Most of the key names are quite intuitive while some are not. For example,
618 the <SPAN CLASS="textbf">Enter</SPAN> key on the main part of the keyboard has the less common
619 name <SPAN CLASS="textbf">Return</SPAN> while the one the numpad is called <SPAN CLASS="textbf">KP_Enter</SPAN>.
622 The <TT>keyspec</TT> string may optionally have multiple ``modifier'' names
623 followed by a plus sign (<TT>+</TT>) as a prefix. X defines the following
627 <SPAN CLASS="textbf">Shift</SPAN>, <SPAN CLASS="textbf">Control</SPAN>, <SPAN CLASS="textbf">Mod1</SPAN> to <SPAN CLASS="textbf">Mod5</SPAN>,
628 <SPAN CLASS="textbf">AnyModifier</SPAN> and <SPAN CLASS="textbf">Lock</SPAN>.
636 X allows binding all of these modifiers to almost any key and while this
637 list of modifiers does not explicitly list keys such as
638 <SPAN CLASS="textbf">Alt</SPAN><A NAME="883"></A> that are common on modern keyboards, such
639 keys are bound to one of the <SPAN CLASS="textbf">ModN</SPAN>. On systems running XFree86
640 <SPAN CLASS="textbf">Alt</SPAN> is usually <SPAN CLASS="textbf">Mod1</SPAN>. On Suns <SPAN CLASS="textbf">Mod1</SPAN> is the diamond key
641 and <SPAN CLASS="textbf">Alt</SPAN> something else. One of the ``flying window'' keys on so
642 called Windows-keyboards is probably mapped to <SPAN CLASS="textbf">Mod3</SPAN> if you have
643 such a key. Use the program <SPAN CLASS="textit">xmodmap</SPAN><A NAME="884"></A>
644 to find out what exactly is bound where.
647 Ion defaults to <SPAN CLASS="textbf">AnyModifier</SPAN> in submaps. This can sometimes lead to
648 unwanted effects when the same key is used with and without explicitly
649 specified modifiers in nested regions. For this reason, Ion recognises
650 <SPAN CLASS="textbf">NoModifier</SPAN> as a special modifier that can be used to reset this
654 Ion ignores the <SPAN CLASS="textbf">Lock</SPAN> modifier and any <SPAN CLASS="textbf">ModN</SPAN> (<SPAN CLASS="MATH"><IMG
655 WIDTH="82" HEIGHT="15" ALIGN="BOTTOM" BORDER="0"
657 ALT="$N=1{\ldots} 5$"></SPAN>)
658 bound to <SPAN CLASS="textbf">NumLock</SPAN><A NAME="885"></A> or
659 <SPAN CLASS="textbf">ScrollLock</SPAN><A NAME="886"></A>
660 by default because such<A NAME="tex2html8"
661 HREF="#foot855"><SUP><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">2</SPAN></SUP></A> locking keys may otherwise
666 <H3><A NAME="SECTION00436000000000000000">
667 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">6</SPAN> Button specifications</A>
671 Button specifications are similar to key definitions but now
672 instead of specifying modifiers and a key, you specify modifiers
673 and one of the button names <SPAN CLASS="textbf">Button1</SPAN> to
674 <SPAN CLASS="textbf">Button5</SPAN><A NAME="887"></A>. Additionally the
675 specification may end with an optional area name following an @-sign.
676 Only frames currently support areas, and the supported values in this
678 `<TT>border</TT>', `<TT>tab</TT>', `<TT>empty_tab</TT>', `<TT>client</TT>'
679 and <TT>nil</TT> (for the whole frame).
682 For example, the following code binds dragging a tab with the first
683 button pressed to initiate tab drag&drop handling:
687 defbindings("WFrame", {
688 mdrag("Button1@tab", "_:p_tabdrag()"),
694 <H3><A NAME="SECTION00437000000000000000">
695 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">7</SPAN> A further note on the default binding configuration</A>
699 The default binding configuration contains references to the variables
700 <TT>META</TT> and <TT>ALTMETA</TT> instead of directly using the default
701 values of `<TT>Mod1+</TT>' and `' (nothing). As explained in
702 section <A HREF="#sec:walkthrough">3.2</A>, the definitions of these variables
703 appear in <SPAN CLASS="textit">cfg_ion.lua</SPAN>. This way you can easily change the the
704 modifiers used by all bindings in the default configuration without
705 changing the whole binding configuration. Quite a few people prefer
706 to use the Windows keys as modifiers because many applications already
707 use <SPAN CLASS="textbf">Alt</SPAN>. Nevertheless, <SPAN CLASS="textbf">Mod1</SPAN> is the default as a key bound
708 to it is available virtually everywhere.
712 <H2><A NAME="SECTION00440000000000000000"></A>
713 <A NAME="sec:menus"></A>
715 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">4</SPAN> Menus
720 <H3><A NAME="SECTION00441000000000000000">
721 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">4</SPAN>.<SPAN CLASS="arabic">1</SPAN> Defining menus</A>
729 In the stock configuration file setup, menus are defined in the file
730 <SPAN CLASS="textit">cfg_menus.lua</SPAN> as previously mentioned. The <SPAN CLASS="textit">mod_menu</SPAN> module
731 must be loaded for one to be able to define menus, and this is done with
732 the function <A HREF="#fn:mod_menu.defmenu"><TT>defmenu</TT></A> provided by it.
735 Here's an example of the definition of a rather simple menu with a submenu:
739 defmenu("exitmenu", {
740 menuentry("Restart", "ioncore.restart()"),
741 menuentry("Exit", "ioncore.shutdown()"),
744 defmenu("mainmenu", {
745 menuentry("Lock screen", "ioncore.exec('xlock')"),
746 menuentry("Help", "mod_query.query_man(_)"),
747 submenu("Exit", "exitmenu"),
752 The <A HREF="#fn:mod_menu.menuentry"><TT>menuentry</TT></A> function is used to create an entry in the
753 menu with a title and an entry handler to be called when the menu entry
754 is activated. The parameters to the handler are similar to those of binding
755 handlers, and usually the same as those of the binding that opened the menu.
758 The <A HREF="#fn:mod_menu.submenu"><TT>submenu</TT></A> function is used to insert a submenu at that
759 point in the menu. (One could as well just pass a table with the menu
760 entries, but it is not encouraged.)
764 <H3><A NAME="SECTION00442000000000000000">
765 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">4</SPAN>.<SPAN CLASS="arabic">2</SPAN> Special menus</A>
769 The menu module predefines the following special menus. These can be used
770 just like the menus defined as above.
773 <TABLE CELLPADDING=3 BORDER="1" WIDTH="100%">
774 <TR><TD ALIGN="LEFT">Menu name</TD>
775 <TD ALIGN="LEFT">Description</TD>
777 <TR><TD ALIGN="LEFT">`<TT>windowlist</TT>'</TD>
778 <TD ALIGN="LEFT">List of all client windows. Activating an entry jumps to that window.</TD>
780 <TR><TD ALIGN="LEFT">`<TT>workspacelist</TT>'</TD>
781 <TD ALIGN="LEFT">List of all workspaces. Activating an entry jumps to that workspaces.</TD>
783 <TR><TD ALIGN="LEFT">`<TT>focuslist</TT>'</TD>
784 <TD ALIGN="LEFT">List of client windows with recent activity in them, followed by
785 previously focused client windows.</TD>
787 <TR><TD ALIGN="LEFT">`<TT>focuslist_</TT>'</TD>
788 <TD ALIGN="LEFT">List of previously focused client windows.</TD>
790 <TR><TD ALIGN="LEFT">`<TT>stylemenu</TT>'</TD>
791 <TD ALIGN="LEFT">List of available <SPAN CLASS="textit">look_*.lua</SPAN> style files. Activating an entry
792 loads that style and ask to save the selection.</TD>
794 <TR><TD ALIGN="LEFT">`<TT>ctxmenu</TT>'</TD>
795 <TD ALIGN="LEFT">Context menu for given object.</TD>
801 <H3><A NAME="SECTION00443000000000000000">
802 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">4</SPAN>.<SPAN CLASS="arabic">3</SPAN> Defining context menus</A>
806 The ``ctxmenu'' is a special menu that is assembled from a defined context
807 menu for the object for which the menu was opened for, but also includes
808 the context menus for the manager objects as submenus.
811 Context menus for a given region class are defined with the
812 <A HREF="#fn:mod_menu.defctxmenu"><TT>defctxmenu</TT></A> function. This is other ways similar to
813 <A HREF="#fn:mod_menu.defmenu"><TT>defmenu</TT></A>, but the first argument instead being the name
814 of the menu, the name of the region class to define context menu for.
815 For example, here's part of the stock WFrame context menu
820 defctxmenu("WFrame", {
821 menuentry("Close", "WRegion.rqclose_propagate(_, _sub)"),
822 menuentry("Kill", "WClientWin.kill(_sub)", "_sub:WClientWin"),
827 Some of the same ``modes'' as were available for some bindings
828 may also be used: `<TT>WFrame.tiled</TT>', `<TT>WFrame.floating</TT>',
829 and `<TT>WFrame.transient</TT>'.
833 <H3><A NAME="SECTION00444000000000000000"></A>
834 <A NAME="sec:menudisp"></A>
836 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">4</SPAN>.<SPAN CLASS="arabic">4</SPAN> Displaying menus
840 The following functions may be used to display menus from binding
841 handlers (and elsewhere):
844 <TABLE CELLPADDING=3 BORDER="1" WIDTH="100%">
845 <TR><TD ALIGN="LEFT">Function</TD>
846 <TD ALIGN="LEFT">Description</TD>
848 <TR><TD ALIGN="LEFT"><A HREF="node7.html#fn:mod_menu.menu"><TT>mod_menu.menu</TT></A></TD>
849 <TD ALIGN="LEFT">Keyboard (or mouse) operated menus that open in the bottom-left corner
850 of a screen or frame.</TD>
852 <TR><TD ALIGN="LEFT"><A HREF="#fn:mod_menu.bigmenu"><TT>mod_menu.bigmenu</TT></A></TD>
853 <TD ALIGN="LEFT">Same as previous, but uses another graphical style.</TD>
855 <TR><TD ALIGN="LEFT"><A HREF="node7.html#fn:mod_menu.pmenu"><TT>mod_menu.pmenu</TT></A></TD>
856 <TD ALIGN="LEFT">Mouse-operated drop-down menus. This function can only be called from a
857 mouse press or drag handler.</TD>
859 <TR><TD ALIGN="LEFT"><A HREF="node7.html#fn:mod_menu.grabmenu"><TT>mod_menu.grabmenu</TT></A></TD>
860 <TD ALIGN="LEFT">A special version of <A HREF="node7.html#fn:mod_menu.menu"><TT>mod_menu.menu</TT></A> that grabs the keyboard
861 and is scrolled with a given key until all modifiers have been released,
862 after which the selected entry is activated.</TD>
867 The <A HREF="node7.html#fn:mod_menu.grabmenu"><TT>grabmenu</TT></A> function takes the extra key parameter, but
868 aside from that each of these functions takes three arguments, which when
869 called from a binding handler, should be the parameters to the handler, and
870 the name of the menu. For example, the following snippet of of code binds
871 the both ways to open a context menu for a frame:
875 defbindings("WFrame", {
876 kpress(MOD1.."M", "mod_menu.menu(_, _sub, 'ctxmenu')"),
877 mpress("Button3", "mod_menu.pmenu(_, _sub, 'ctxmenu')"),
883 <H2><A NAME="SECTION00450000000000000000"></A>
884 <A NAME="sec:winprops"></A>
886 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">5</SPAN> Winprops
890 The so-called ``winprops''<A NAME="1291"></A> can be used to change how
891 specific windows are handled and to set up some kludges to deal with
892 badly behaving applications. They are defined by calling the function
893 <TT>defwinprop</TT> with a table containing the properties to set and the
894 necessary information to identify a window. The currently supported
895 winprops are listed below, and the subsequent subsections explain the
896 usual method of identifying windows, and how to obtain this information.
903 <DT><STRONG>Winprop:</STRONG></DT>
904 <DD><TT>acrobatic</TT> (boolean)
907 <DT><STRONG>Description:</STRONG></DT>
908 <DD><A NAME="1451"></A>
909 Set this to <TT>true</TT> for Acrobat Reader. It has an annoying
910 habit of trying to manage its dialogs instead of setting them as
911 transients and letting the window manager do its job, causing
912 Ion and acrobat go a window-switching loop when a dialog is
921 <DT><STRONG>Winprop:</STRONG></DT>
922 <DD><TT>float</TT> (boolean)
925 <DT><STRONG>Description:</STRONG></DT>
926 <DD><A NAME="1452"></A>
927 Set this to open the window in a floating frame, when
936 <DT><STRONG>Winprop:</STRONG></DT>
937 <DD><TT>fullscreen</TT> (boolean)
940 <DT><STRONG>Description:</STRONG></DT>
941 <DD><A NAME="1453"></A>
942 Should the window be initially in full screen mode?
950 <DT><STRONG>Winprop:</STRONG></DT>
951 <DD><TT>ignore_cfgrq</TT> (boolean)
954 <DT><STRONG>Description:</STRONG></DT>
955 <DD><A NAME="1454"></A>
956 Should configure requests on the window be ignored?
957 Only has effect on floating windows.
965 <DT><STRONG>Winprop:</STRONG></DT>
966 <DD><TT>ignore_net_active_window</TT> (boolean)
969 <DT><STRONG>Description:</STRONG></DT>
970 <DD><A NAME="1455"></A>
971 Ignore extended WM hints <TT>_NET_ACTIVE_WINDOW</TT> request.
979 <DT><STRONG>Winprop:</STRONG></DT>
980 <DD><TT>jumpto</TT> (boolean)
983 <DT><STRONG>Description:</STRONG></DT>
984 <DD><A NAME="1456"></A>
985 Should a newly created client window always be made
986 active, even if the allocated frame isn't.
994 <DT><STRONG>Winprop:</STRONG></DT>
995 <DD><TT>new_group</TT> (string)
998 <DT><STRONG>Description:</STRONG></DT>
999 <DD><A NAME="1457"></A>
1000 If the region specified by <TT>target</TT> winprop does not exist
1001 (or that winprop is not set), create a new workspace using the
1002 previously stored layout (see <A HREF="node7.html#fn:ioncore.deflayout"><TT>ioncore.deflayout</TT></A>) named by
1003 this property. After creating the workspace, <TT>target</TT> is
1004 attempted to be found again. (If that still fails, the newly
1005 created workspace is still asked to manage the client window.)
1013 <DT><STRONG>Winprop:</STRONG></DT>
1014 <DD><TT>oneshot</TT> (boolean)
1017 <DT><STRONG>Description:</STRONG></DT>
1018 <DD><A NAME="1458"></A>
1019 Discard this winprop after first use.
1027 <DT><STRONG>Winprop:</STRONG></DT>
1028 <DD><TT>statusbar</TT> (string)
1031 <DT><STRONG>Description:</STRONG></DT>
1032 <DD><A NAME="1459"></A>
1033 Put the window in the statusbar, in the named tray component,
1034 (The default tray component is called simply `<TT>systray</TT>',
1035 and others you give names to in your custom template, always
1036 prefixed by `<TT>systray_</TT>'.
1044 <DT><STRONG>Winprop:</STRONG></DT>
1045 <DD><TT>switchto</TT> (boolean)
1048 <DT><STRONG>Description:</STRONG></DT>
1049 <DD><A NAME="1460"></A>
1050 Should a newly mapped client window be switched to within
1059 <DT><STRONG>Winprop:</STRONG></DT>
1060 <DD><TT>target</TT> (string)
1063 <DT><STRONG>Description:</STRONG></DT>
1064 <DD><A NAME="1461"></A>
1065 The name of an object (workspace, frame) that should manage
1066 windows of this type. See also <TT>new_group</TT>.
1074 <DT><STRONG>Winprop:</STRONG></DT>
1075 <DD><TT>transient_mode</TT> (string)
1078 <DT><STRONG>Description:</STRONG></DT>
1079 <DD><A NAME="1462"></A>
1080 `<TT>normal</TT>': No change in behaviour. `<TT>current</TT>':
1081 The window should be thought of as a transient for the current
1082 active client window (if any) even if it is not marked as a
1083 transient by the application. `<TT>off</TT>': The window should
1084 be handled as a normal window even if it is marked as a
1085 transient by the application.
1093 <DT><STRONG>Winprop:</STRONG></DT>
1094 <DD><TT>transparent</TT> (boolean)
1097 <DT><STRONG>Description:</STRONG></DT>
1098 <DD><A NAME="1463"></A>
1099 Should frames be made transparent when this window is selected?
1107 <H3><A NAME="SECTION00451000000000000000">
1108 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">1</SPAN> Sizehint winprops</A>
1112 Additionally, the winprops
1113 <TT>max_size</TT><A NAME="1464"></A>,
1114 <TT>min_size</TT><A NAME="1465"></A>,
1115 <TT>aspect</TT><A NAME="1466"></A>,
1116 <TT>resizeinc</TT><A NAME="1467"></A>,
1118 <TT>ignore_max_size</TT><A NAME="1468"></A>,
1119 <TT>ignore_min_size</TT><A NAME="1469"></A>,
1120 <TT>ignore_aspect</TT><A NAME="1470"></A>,
1121 <TT>ignore_resizeinc</TT><A NAME="1471"></A>,
1122 may be used to override application-supplied size hints. The four
1123 first ones are tables with the fields <TT>w</TT> and <TT>h</TT>, indicating
1124 the width and height size hints in pixels, and the latter ignore
1125 winprop is a boolean.
1128 Finally, the boolean
1129 <TT>userpos</TT><A NAME="1472"></A> option may be used to
1130 override the <TT>USPosition</TT> flag of the size hints. Normally,
1131 when this flag is set, Ion tries to respect the supplied window
1132 position more than when it is not set. Obviously, this makes sense
1133 only for floating windows.
1137 <H3><A NAME="SECTION00452000000000000000"></A>
1138 <A NAME="sec:classesrolesinstances"></A>
1140 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">2</SPAN> Classes, roles and instances
1144 The identification information supported are
1145 <TT>class</TT><A NAME="1473"></A>,
1146 <TT>role</TT><A NAME="1474"></A>,
1147 <TT>instance</TT><A NAME="1475"></A>,
1148 <TT>name</TT><A NAME="1476"></A>,
1149 <TT>is_transient</TT><A NAME="1477"></A>, and
1150 <TT>is_dockapp</TT><A NAME="1478"></A>.
1151 It is not necessary to specify all of these fields.
1152 The first three are strings, and must exactly match the
1153 corresponding information obtained from the window's properties.
1154 The <TT>name</TT> field is a Lua-style regular expression matched against
1155 the window's title. The <TT>is_transient</TT> field is a boolean that can
1156 be used to include or exclude transients only, while the <TT>is_dockapp</TT>
1157 field is set by Ion for the dock windows of Window Maker dockapp protocol
1158 dockapps. Usually this is the only information available for these
1159 <SPAN CLASS="textit">icon</SPAN> windows.
1162 Ion looks for a matching winprop in the order listed by the following
1163 table. An 'E' indicates that the field must be set in the winprop
1164 and it must match the window's corresponding property exactly or, in
1165 case of <TT>name</TT>, the regular expression must match the window
1166 title. An asterisk '*' indicates that a winprop where the field is
1167 not specified (or is itself an asterisk in case of the first three
1171 <DIV ALIGN="CENTER">
1172 <TABLE CELLPADDING=3 BORDER="1">
1173 <TR><TD ALIGN="LEFT"><TT>class</TT></TD>
1174 <TD ALIGN="LEFT"><TT>role</TT></TD>
1175 <TD ALIGN="LEFT"><TT>instance</TT></TD>
1176 <TD ALIGN="LEFT">other</TD>
1178 <TR><TD ALIGN="LEFT">E</TD>
1179 <TD ALIGN="LEFT">E</TD>
1180 <TD ALIGN="LEFT">E</TD>
1181 <TD ALIGN="LEFT">E</TD>
1183 <TR><TD ALIGN="LEFT">E</TD>
1184 <TD ALIGN="LEFT">E</TD>
1185 <TD ALIGN="LEFT">E</TD>
1186 <TD ALIGN="LEFT">*</TD>
1188 <TR><TD ALIGN="LEFT">E</TD>
1189 <TD ALIGN="LEFT">E</TD>
1190 <TD ALIGN="LEFT">*</TD>
1191 <TD ALIGN="LEFT">E</TD>
1193 <TR><TD ALIGN="LEFT">E</TD>
1194 <TD ALIGN="LEFT">E</TD>
1195 <TD ALIGN="LEFT">*</TD>
1196 <TD ALIGN="LEFT">*</TD>
1198 <TR><TD ALIGN="LEFT">E</TD>
1199 <TD ALIGN="LEFT">*</TD>
1200 <TD ALIGN="LEFT">E</TD>
1201 <TD ALIGN="LEFT">E</TD>
1203 <TR><TD ALIGN="LEFT">E</TD>
1204 <TD ALIGN="LEFT">*</TD>
1205 <TD ALIGN="LEFT">E</TD>
1206 <TD ALIGN="LEFT">*</TD>
1208 <TR><TD ALIGN="LEFT">E</TD>
1209 <TD ALIGN="LEFT">*</TD>
1210 <TD ALIGN="LEFT">*</TD>
1211 <TD ALIGN="LEFT">E</TD>
1213 <TR><TD ALIGN="LEFT"> </TD>
1214 <TD ALIGN="LEFT"> </TD>
1215 <TD ALIGN="LEFT"> </TD>
1216 <TD ALIGN="LEFT">etc.</TD>
1222 If there are multiple matching winprops with the same
1223 <TT>class</TT>, <TT>role</TT> and <TT>instance</TT>, but other information
1224 different, the most recently defined one is used.
1228 <H3><A NAME="SECTION00453000000000000000">
1229 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">3</SPAN> Finding window identification</A>
1233 The 'Window info' context menu entry (<SPAN CLASS="textbf">Mod1+M</SPAN> or <SPAN CLASS="textbf">Button3</SPAN> on a tab)
1234 can be used to list the identification information required to set winprops
1235 for a window and all the transient windows managed within it.
1239 Another way to get the identification information is to use <TT>xprop</TT>.
1240 Simply run To get class and instance, simply run <TT>xprop WM_CLASS</TT>
1241 and click on the particular window of interest. The class is the latter of
1242 the strings while the instance is the former. To get the role - few
1243 windows have this property - use the command <TT>xprop WM_ROLE</TT>.
1244 This method, however, will not work on transients.
1248 So-called ``transient windows'' are usually short-lived dialogs (although
1249 some programs abuse this property) that have a parent window that they are
1250 ``transient for''. On tiled workspaces Ion displays these windows
1251 simultaneously with the parent window at the bottom of the same frame.
1252 Unfortunately <TT>xprop</TT> is stupid and can't cope with this situation,
1253 returning the parent window's properties when the transient is clicked on.
1254 For this reason you'll have to do a little extra work to get the properties
1255 for that window.<A NAME="tex2html9"
1256 HREF="#foot1480"><SUP><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">3</SPAN></SUP></A>
1258 Finally, it should be mentioned that too many authors these days
1259 ``forget'' to set this vital identification to anything meaningful:
1260 everything except name is the same for all of the program's
1261 windows, for example. Some other programs only set this information
1262 after the window has been mapped, i.e. the window manager has been
1263 told to start managing it, which is obviously too late.
1264 Gtk applications in particular are often guilty on both counts.
1268 <H3><A NAME="SECTION00454000000000000000">
1269 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">4</SPAN> Some common examples</A>
1274 <H4><A NAME="SECTION00454100000000000000">
1275 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">4</SPAN>.<SPAN CLASS="arabic">1</SPAN> Acrobat Reader</A>
1279 The following is absolutely necessary for Acrobat reader:
1285 instance = "documentShell",
1292 <H4><A NAME="SECTION00454200000000000000">
1293 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">4</SPAN>.<SPAN CLASS="arabic">2</SPAN> Forcing newly created windows in named frames</A>
1297 The following winprop should place xterm started with command-line parameter
1298 <TT>-name sysmon</TT> and running a system monitoring program in a
1303 instance = "sysmon",
1304 target = "sysmonframe",
1309 For this example to work, we have to somehow create a frame named
1310 `<TT>sysmonframe</TT>'. One way to do this is to make the following
1311 call in the <SPAN CLASS="textbf">Mod1+F3</SPAN> Lua code query:
1315 mod_query.query_renameframe(_)
1319 Recall that <TT>_</TT> points to the multiplexer (frame or screen) in which
1320 the query was opened. Running this code should open a new query prefilled
1321 with the current name of the frame. In our example we would change the
1322 name to `<TT>sysmonframe</TT>', but we could just as well have used the
1323 default name formed from the frame's class name and an instance number.
1327 <H2><A NAME="SECTION00460000000000000000"></A>
1328 <A NAME="sec:statusbar"></A>
1330 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">6</SPAN> The statusbar
1334 The <SPAN CLASS="textit">mod_statusbar</SPAN> module provides a statusbar that adapts to
1335 layouts of tilings, using only the minimal space needed. Ion only
1336 supports one adaptive ``status display'' object per screen, so this
1337 statusbar is mutually exclusive with the embedded mode of <SPAN CLASS="textit">mod_dock</SPAN>
1341 The statusbar is configured in <SPAN CLASS="textit">cfg_statusbar.lua</SPAN>. Typically,
1342 the configuration consists of two steps: creating a statusbar with
1343 <A HREF="node7.html#fn:mod_statusbar.create"><TT>mod_statusbar.create</TT></A>, and then launching the separate
1344 <TT>ion-statusd</TT> status daemon process with
1345 <A HREF="node7.html#fn:mod_statusbar.launch_statusd"><TT>mod_statusbar.launch_statusd</TT></A>. This latter phase is done
1346 automatically, if it was not done by the configuration file, but
1347 the configuration file may pass extra parameters to <TT>ion-statusd</TT>
1348 monitors. (See Section <A HREF="node6.html#sec:statusd">5.4</A> for more information on
1349 writing <TT>ion-statusd</TT> monitors.)
1352 A typical <SPAN CLASS="textit">cfg_statusbar.lua</SPAN> configuration might look as follows:
1356 -- Create a statusbar
1357 mod_statusbar.create{
1358 screen = 0, -- First screen,
1359 pos = 'bl', -- bottom left corner
1360 systray = true, -- Swallow systray windows
1363 template = "[ %date || load:% %>load || mail:% %>mail_new/%>mail_total ]"
1364 .. " %filler%systray",
1367 -- Launch ion-statusd.
1368 mod_statusbar.launch_statusd{
1371 -- ISO-8601 date format with additional abbreviated day name
1372 date_format='%a %Y-%m-%d %H:%M',
1379 <H3><A NAME="SECTION00461000000000000000">
1380 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">6</SPAN>.<SPAN CLASS="arabic">1</SPAN> The template</A>
1384 The template specifies what is shown on the statusbar; for information
1385 on the other options to <A HREF="node7.html#fn:mod_statusbar.create"><TT>mod_statusbar.create</TT></A>, see the reference.
1386 Strings of the form `<TT>%spec</TT>' tokens specially interpreter by
1387 the statusbar; the rest appears verbatim. The <TT>spec</TT> typically
1388 consists of the name of the value/meter to display (beginning with a latin
1389 alphabet), but may be preceded by an alignment specifier and a number
1390 specifying the minimum width. The alignment specifiers are: `<TT>></TT>'
1391 for right, `<TT><</TT>' for left, and `<TT>|</TT>' for centring. Additionally,
1392 space following `<TT>%</TT>' (that is, the string `<TT>% </TT>'), adds
1393 ``stretchable space'' at that point. The special string `<TT>%filler</TT>'
1394 may be used to flush the rest of the template to the right end of
1398 The stretchable space works as follows: <SPAN CLASS="textit">mod_statusbar</SPAN> remembers
1399 the widest string (in terms of graphical presentation) that it has
1400 seen for each meter, unless the width has been otherwise constrained.
1401 If there is stretchable space in the template, it tries to make the
1402 meter always take this much space, by stretching any space found in
1403 the direction indicated by the alignment specifier: the opposite
1404 direction for left or right alignment, and both for centring.
1408 <H3><A NAME="SECTION00462000000000000000">
1409 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">6</SPAN>.<SPAN CLASS="arabic">2</SPAN> The systray</A>
1413 The special `<TT>%systray</TT>' and `<TT>%systray_*</TT>'
1414 (`<TT>*</TT>' varying) monitors indicate where to place system tray
1415 windows. There may be multiple of these. KDE-protocol system tray
1416 icons are placed in `<TT>%systray</TT>' automatically, unless disabled
1417 with the <TT>systray</TT> option. Otherwise the <TT>statusbar</TT> winprop may
1418 be used to place any window in any particular `<TT>%systray_*</TT>'.
1422 <H3><A NAME="SECTION00463000000000000000">
1423 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">6</SPAN>.<SPAN CLASS="arabic">3</SPAN> Monitors</A>
1427 The part before the first
1428 underscore of each monitor name, describes the script/plugin/module
1429 that provides the meter, and any configuration should be passed
1430 in the a corresponding sub-table <A HREF="node7.html#fn:mod_statusbar.launch_statusd"><TT>mod_statusbar.launch_statusd</TT></A>.
1431 Ion comes with date, load and mail (for plain old mbox)
1432 <TT>ion-statusd</TT> monitor scripts. More may be obtained from
1433 the scripts repository [<A
1434 HREF="node12.html#scripts">1</A>]. These included scripts
1435 provide the following monitors and their options
1439 <H4><A NAME="SECTION00463100000000000000">
1440 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">6</SPAN>.<SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">1</SPAN> Date</A>
1444 Options: <TT>date_format</TT>: The date format in as seen above,
1445 in the usual <TT>strftime</TT> format. <TT>formats</TT>: table of
1446 formats for additional date monitors, the key being the name
1447 of the monitor (without the `<TT>date_</TT>' prefix).
1450 Monitors: `<TT>date</TT>' and other user-specified ones with the
1451 `<TT>date_</TT>' prefix.
1455 <H4><A NAME="SECTION00463200000000000000">
1456 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">6</SPAN>.<SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">2</SPAN> Load</A>
1460 Options: <TT>update_interval</TT>: Update interval in milliseconds
1461 (default 10s). <TT>important_threshold</TT>: Threshold above which
1462 the load is marked as important (default 1.5), so that the
1463 drawing engine may be suitably hinted. <TT>critical_threshold</TT>:
1464 Threshold above which the load is marked as critical (default 4.0).
1467 Monitors: `<TT>load</TT>' (for all three values),
1468 `<TT>load_1min</TT>', `<TT>load_5min</TT>' and `<TT>load_15min</TT>'.
1472 <H4><A NAME="SECTION00463300000000000000">
1473 <SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">6</SPAN>.<SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">3</SPAN> Mail</A>
1477 Options: <TT>update_interval</TT>: Update interval in milliseconds
1478 (default 1min). <TT>mbox</TT>: mbox-format mailbox location
1479 (default <code>$MAIL</code>).
1480 <TT>files</TT>: list of additional mailboxes, the key giving the
1481 name of the monitor.
1484 Monitors: `<TT>mail_new</TT>', `<TT>mail_unread</TT>',
1485 `<TT>mail_total</TT>', and corresponding
1486 `<TT>mail_*_new</TT>', `<TT>mail_*_unread</TT>', and `<TT>mail_*_total</TT>'
1487 for the additional mailboxes (`<TT>*</TT>' varying).
1492 <BR><HR><H4>Footnotes</H4>
1494 <DT><A NAME="foot876">...keysymdef.h</A><A
1495 HREF="node4.html#tex2html7"><SUP><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">1</SPAN></SUP></A></DT>
1496 <DD>This file can usually be found in the directory
1497 <SPAN CLASS="textit">/usr/X11R6/include/X11/</SPAN>.
1500 <DT><A NAME="foot855">... such</A><A
1501 HREF="node4.html#tex2html8"><SUP><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">2</SPAN></SUP></A></DT>
1502 <DD>Completely useless keys that should be
1503 gotten rid of in the author's opinion.
1506 <DT><A NAME="foot1480">... window.</A><A
1507 HREF="node4.html#tex2html9"><SUP><SPAN CLASS="arabic">3</SPAN>.<SPAN CLASS="arabic">3</SPAN></SUP></A></DT>
1508 <DD>There's a patch to <TT>xprop</TT> to
1509 fix this, but nothing seems to be happening with respect to including it in
1514 <DIV CLASS="navigation"><HR>
1515 <!--Navigation Panel-->
1516 <A NAME="tex2html288"
1518 <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A>
1519 <A NAME="tex2html282"
1520 HREF="ionconf.html">
1521 <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A>
1522 <A NAME="tex2html276"
1524 <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A>
1525 <A NAME="tex2html284"
1527 <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A>
1528 <A NAME="tex2html286"
1530 <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A>
1532 <B> Next:</B> <A NAME="tex2html289"
1533 HREF="node5.html">4. Graphical styles</A>
1534 <B> Up:</B> <A NAME="tex2html283"
1535 HREF="ionconf.html">Configuring and extending Ion3</A>
1536 <B> Previous:</B> <A NAME="tex2html277"
1537 HREF="node3.html">2. Preliminaries: Key concepts</A>
1538 <B> <A NAME="tex2html285"
1539 HREF="node1.html">Contents</A></B>
1540 <B> <A NAME="tex2html287"
1541 HREF="node11.html">Index</A></B> </DIV>
1542 <!--End of Navigation Panel-->