]> git.decadent.org.uk Git - ion3.git/blob - doc/conf-winprops.tex
[svn-upgrade] Integrating new upstream version, ion3 (20070506)
[ion3.git] / doc / conf-winprops.tex
1 \section{Winprops}
2 \label{sec:winprops}
3
4 The so-called ``winprops''\index{Winprops} can be used to change how
5 specific windows are handled and to set up some kludges to deal with
6 badly behaving applications. They are defined by calling the function
7 \code{defwinprop} with a table containing the properties to set and the
8 necessary information to identify a window. The currently supported
9 winprops are listed below, and the subsequent subsections explain the
10 usual method of identifying windows, and how to obtain this information.
11
12 %\begin{table}
13 %\begin{htmlonly}
14 %\docode % latex2html kludge
15 %\end{htmlonly}
16 %\caption{Supported winprops}
17 %\label{tab:winprops}
18
19 \newenvironment{winprop}[2]{
20   \begin{function}%
21       % Sigh. (La)TeX is a mess.
22       %\index{%
23       %  \ifx\\#1\\%
24       %  #2\else#1\fi%
25       %  @\expandafter\var{#2}}
26       \item[Winprop:] \var{#1} (#2)
27       \item[Description:]
28 }
29 {
30   \end{function}
31 }
32
33
34 \begin{winprop}{acrobatic}{boolean}
35     \index{acrobatic@\var{acrobatic}}
36     Set this to \code{true} for Acrobat Reader. It has an annoying
37     habit of trying to manage its dialogs instead of setting them as
38     transients and letting the window manager do its job, causing
39     Ion and acrobat go a window-switching loop when a dialog is
40     opened. 
41 \end{winprop}
42
43
44 \begin{winprop}{float}{boolean}
45     \index{float@\var{float}}
46     Set this to open the window in a floating frame, when
47     in a group.
48 \end{winprop}
49
50
51 \begin{winprop}{fullscreen}{boolean}
52     \index{fullscreen@\var{fullscreen}}
53     Should the window be initially in full screen mode?
54 \end{winprop}
55
56
57 \begin{winprop}{ignore_cfgrq}{boolean}
58     \index{ignore-cfgrq@\var{ignore_cfgrq}}
59     Should configure requests on the window be ignored?
60     Only has effect on floating windows.
61 \end{winprop}
62
63
64 \begin{winprop}{ignore_net_active_window}{boolean}
65     \index{ignore-net-active-window@\var{ignore_net_active_window}}
66     Ignore extended WM hints \code{_NET_ACTIVE_WINDOW} request. 
67 \end{winprop}
68
69
70 \begin{winprop}{jumpto}{boolean}
71     \index{jumpto@\var{jumpto}}
72     Should a newly created client window always be made
73     active, even if the allocated frame isn't. 
74 \end{winprop}
75
76
77 \begin{winprop}{new_group}{string}
78     \index{new-group@\var{new_group}}
79     If the region specified by \code{target} winprop does not exist
80     (or that winprop is not set), create a new workspace using the 
81     previously stored layout (see \fnref{ioncore.deflayout}) named by
82     this property. After creating the workspace, \code{target} is 
83     attempted to be found again. (If that still fails, the newly 
84     created workspace is still asked to manage the client window.)
85 \end{winprop}
86
87
88 \begin{winprop}{oneshot}{boolean}
89     \index{oneshot@\var{oneshot}}
90     Discard this winprop after first use. 
91 \end{winprop}
92
93
94 \begin{winprop}{statusbar}{string}
95     \index{statusbar@\var{statusbar}}
96     Put the window in the statusbar, in the named tray component,
97     (The default tray component is called simply \codestr{systray}, 
98     and others you give names to in your custom template, always 
99     prefixed by \codestr{systray\_}.
100 \end{winprop}
101
102
103 \begin{winprop}{switchto}{boolean}
104     \index{switchto@\var{switchto}}
105     Should a newly mapped client window be switched to within
106     its frame.
107 \end{winprop}
108         
109
110 \begin{winprop}{target}{string}
111     \index{target@\var{target}}
112     The name of an object (workspace, frame) that should manage 
113     windows of this type. See also \code{new_group}.
114 \end{winprop}
115
116         
117 \begin{winprop}{transient_mode}{string}
118     \index{transient-mode@\var{transient_mode}}
119     \codestr{normal}: No change in behaviour. \codestr{current}:
120     The window should be thought of as a transient for the current
121     active client window (if any) even if it is not marked as a
122     transient by the application. \codestr{off}: The window should 
123     be handled as a normal window even if it is marked as a
124     transient by the application. 
125 \end{winprop}
126
127
128 \begin{winprop}{transparent}{boolean}
129     \index{transparent@\var{transparent}}
130     Should frames be made transparent when this window is selected? \\
131 \end{winprop}
132
133
134 \subsection{Sizehint winprops}
135
136 Additionally, the winprops 
137 \code{max_size}\index{max-size@\var{max_size}},
138 \code{min_size}\index{min-size@\var{min_size}},
139 \code{aspect}\index{aspect@\var{aspect}},
140 \code{resizeinc}\index{aspect@\var{resizeinc}},
141 and
142 \code{ignore_max_size}\index{ignore-max-size@\var{ignore_max_size}},
143 \code{ignore_min_size}\index{ignore-min-size@\var{ignore_min_size}},
144 \code{ignore_aspect}\index{ignore-aspect@\var{ignore_aspect}},
145 \code{ignore_resizeinc}\index{ignore-aspect@\var{ignore_resizeinc}},
146 may be used to override application-supplied size hints. The four
147 first ones are tables with the fields \var{w} and \var{h}, indicating
148 the width and height size hints in pixels, and the latter ignore
149 winprop is a boolean. 
150
151 Finally, the boolean
152 \code{userpos}\index{userpos@\var{userpos}} option may be used to
153 override the \code{USPosition} flag of the size hints. Normally,
154 when this flag is set, Ion tries to respect the supplied window
155 position more than when it is not set. Obviously, this makes sense
156 only for floating windows.
157
158
159 \subsection{Classes, roles and instances}
160 \label{sec:classesrolesinstances}
161
162 The identification information supported are
163 \var{class}\index{class@\var{class}!winprop},
164 \var{role}\index{role@\var{role}!winprop},
165 \var{instance}\index{instance@\var{instance}!winprop},
166 \var{name}\index{name@\var{name}!winprop},
167 \var{is_transient}\index{is-transient@\var{is_transient}!winprop}, and
168 \var{is_dockapp}\index{is-dockapp@\var{is_dockapp}!winprop}.
169 It is not necessary to specify all of these fields.
170 The first three are strings, and must exactly match the
171 corresponding information obtained from the window's properties.
172 The \var{name} field is a Lua-style regular expression matched against
173 the window's title. The \var{is_transient} field is a boolean that can
174 be used to include or exclude transients only, while the \var{is_dockapp}
175 field is set by Ion for the dock windows of Window Maker dockapp protocol
176 dockapps. Usually this is the only information available for these 
177 \emph{icon} windows. 
178
179 Ion looks for a matching winprop in the order listed by the following
180 table. An 'E' indicates that the field must be set in the winprop
181 and it must match the window's corresponding property exactly or, in
182 case of \var{name}, the regular expression must match the window
183 title. An asterisk '*' indicates that a winprop where the field is
184 not specified (or is itself an asterisk in case of the first three
185 fields) is tried.
186
187 \begin{center}
188 \begin{tabular}{llll}
189   \tabhead{\var{class} & \var{role} & \var{instance} & other}
190   E            & E          & E              & E \\
191   E            & E          & E              & * \\
192   E            & E          & *              & E \\
193   E            & E          & *              & * \\
194   E            & *          & E              & E \\
195   E            & *          & E              & * \\
196   E            & *          & *              & E \\
197   \vdots       & \vdots     & \vdots         & etc. \\
198 \end{tabular}
199 \end{center}
200
201 If there are multiple matching winprops with the same
202 \var{class}, \var{role} and \var{instance}, but other information
203 different, the most recently defined one is used.
204
205
206 \subsection{Finding window identification}
207
208 The 'Window info' context menu entry (\key{Mod1+M} or \key{Button3} on a tab)
209 can be used to list the identification information required to set winprops
210 for a window and all the transient windows managed within it. 
211
212 \index{xprop} 
213 Another way to get the identification information is to use \command{xprop}.
214 Simply run To get class and instance, simply run \command{xprop WM_CLASS}
215 and click on the particular window of interest. The class is the latter of
216 the strings while the instance is the former.  To get the role -- few
217 windows have this property -- use the command \command{xprop WM_ROLE}. 
218 This method, however, will not work on transients. 
219
220 \index{transient}
221 So-called ``transient windows'' are usually short-lived dialogs (although
222 some programs abuse this property) that have a parent window that they are
223 ``transient for''. On tiled workspaces Ion displays these windows 
224 simultaneously with the parent window at the bottom of the same frame.
225 Unfortunately \command{xprop} is stupid and can't cope with this situation,
226 returning the parent window's properties when the transient is clicked on.
227 For this reason you'll have to do a little extra work to get the properties
228 for that window.\footnote{There's a patch to \command{xprop} to
229 fix this, but nothing seems to be happening with respect to including it in 
230 XFree86.}
231
232 Finally, it should be mentioned that too many authors these days
233 ``forget'' to set this vital identification to anything meaningful:
234 everything except name is the same for all of the program's 
235 windows, for example. Some other programs only set this information
236 after the window has been mapped, i.e. the window manager has been
237 told to start managing it, which is obviously too late. 
238 Gtk applications in particular are often guilty on both counts.
239
240
241 \subsection{Some common examples}
242
243 \subsubsection{Acrobat Reader}
244
245 The following is absolutely necessary for Acrobat reader:
246
247 \begin{verbatim}
248 defwinprop{
249     class = "AcroRead",
250     instance = "documentShell",
251     acrobatic = true,
252 }
253 \end{verbatim}
254
255 \subsubsection{Forcing newly created windows in named frames}
256
257 The following winprop should place xterm started with command-line parameter
258 \mbox{\code{-name sysmon}} and running a system monitoring program in a
259 particular frame:
260 \begin{verbatim}
261 defwinprop{
262     class = "XTerm",
263     instance = "sysmon",
264     target = "sysmonframe",
265 }
266 \end{verbatim}
267
268 For this example to work, we have to somehow create a frame named
269 \codestr{sysmonframe}. One way to do this is to make the following
270 call in the \key{Mod1+F3} Lua code query:
271
272 \begin{verbatim}
273 mod_query.query_renameframe(_)
274 \end{verbatim}
275
276 Recall that \code{_} points to the multiplexer (frame or screen) in which 
277 the query was opened. Running this code should open a new query prefilled
278 with the current name of the frame. In our example we would change the 
279 name to \codestr{sysmonframe}, but we could just as well have used the 
280 default name formed from the frame's class name and an instance number.