1 
2 #ifndef _CONFIG_H_
3 #define _CONFIG_H_
4 
5 // ============================
6 // Configuration header for wmx
7 // ============================
8 //
9 // To configure: change the relevant bit of the file, and rebuild the
10 // manager.  Make sure all necessary source files are built (by
11 // running "make depend" before you start).
12 //
13 // This file is in four sections.  (This might imply that it's getting
14 // too long.)  The sections are:
15 //
16 // I.   Straightforward operational parameters
17 // II.  Key bindings
18 // III. Colours and fonts
19 // IV.  Flashy stuff: channels, pixmaps, skeletal feedback &c.
20 //
21 // All timing values are in milliseconds, but accuracy depends on the
22 // minimum timer value available to select, so they should be taken
23 // with a pinch of salt.  On the machine I'm using now, I mentally
24 // double all the given values.
25 //
26 // -- Chris Cannam, January 1998
27 
28 
29 // This isn't one of the sections.  This is the structure for Stefan
30 // `Sec' Zehl's runtime configuration hack -- see Config.C.  It's a
31 // bit incomplete, but works, mostly.  Anything in this file that's
32 // #defined to DynamicConfig::config.something() will take its default
33 // from Config.C
34 
35 struct DynamicConfigImpl;
36 class DynamicConfig
37 {
38 public:
39     DynamicConfig();
40     ~DynamicConfig();
41     void scan(char startup = 0);
42 
43     char clickFocus();
44     char raiseFocus();
45     char autoRaiseFocus();
46     int  raiseDelay();
47     char useKeyboard();
48     char fullMenu();
49     char useFeedback();
50     int  feedbackDelay();
51     char disableNew();
52     char rightCirculate();
53     char rightLower();
54     char rightToggleHeight();
55     char passFocusClick();
56     int  tabMargin();
57     char *tabForeground();
58     char *tabBackground();
59     char *frameBackground();
60 
61     static DynamicConfig config;
62 
63 private:
64     DynamicConfigImpl *m_impl;
65     void update(char *);
66 };
67 
68 
69 // =================================================
70 // Section I. Straightforward operational parameters
71 // =================================================
72 
73 // List visible as well as hidden clients on the root menu?  (Visible
74 // ones will be towards the bottom of the menu, flush-right.)
75 #define CONFIG_EVERYTHING_ON_ROOT_MENU (DynamicConfig::config.fullMenu())
76 
77 // Spawn a temporary new shell between the wm and each new process?
78 #define CONFIG_EXEC_USING_SHELL   False
79 
80 // What to run to get a new window (from the "New" menu option)
81 #define CONFIG_NEW_WINDOW_LABEL "New"
82 #define CONFIG_NEW_WINDOW_COMMAND "xterm"
83 #define CONFIG_NEW_WINDOW_COMMAND_OPTIONS 0
84 // or, for example,
85 //#define CONFIG_NEW_WINDOW_COMMAND_OPTIONS "-ls","-sb","-sl","1024",0
86 // alternatively,
87 #define CONFIG_DISABLE_NEW_WINDOW_COMMAND (DynamicConfig::config.disableNew())
88 
89 // Area where [exit wmx] is added (0 -> everywhere -# -> px from other side)
90 #define CONFIG_EXIT_CLICK_SIZE_X 0
91 #define CONFIG_EXIT_CLICK_SIZE_Y -3
92 
93 // Directory under $HOME in which to look for commands for the
94 // middle-button menu
95 #define CONFIG_COMMAND_MENU       ".wmx"
96 // only used if COMMAND_MENU is not found; ignored if invalid directory:
97 #define CONFIG_SYSTEM_COMMAND_MENU	"/usr/local/lib/wmx/menu"
98 // append screennumber to COMMAND_MENU directory;
99 // use non screen style as fallback
100 #define CONFIG_ADD_SCREEN_TO_COMMAND_MENU False
101 
102 // Focus possibilities.
103 //
104 // You can't have CLICK_TO_FOCUS without RAISE_ON_FOCUS, but the other
105 // combinations should be okay.  If you set AUTO_RAISE you must leave
106 // the other two False; you'll then get focus-follows, auto-raise, and
107 // a delay on auto-raise as configured in the DELAY settings below.
108 
109 #define CONFIG_CLICK_TO_FOCUS     (DynamicConfig::config.clickFocus())
110 #define CONFIG_RAISE_ON_FOCUS     (DynamicConfig::config.raiseFocus())
111 #define CONFIG_AUTO_RAISE         (DynamicConfig::config.autoRaiseFocus())
112 
113 #define CONFIG_PASS_FOCUS_CLICK   (DynamicConfig::config.passFocusClick())
114 
115 // Delays when using AUTO_RAISE focus method
116 //
117 // In theory these only apply when using AUTO_RAISE, not when just
118 // using RAISE_ON_FOCUS without CLICK_TO_FOCUS.  First of these is the
119 // usual delay before raising; second is the delay after the pointer
120 // has stopped moving (only when over simple X windows such as xvt).
121 
122 #define CONFIG_AUTO_RAISE_DELAY       (DynamicConfig::config.raiseDelay())
123 #define CONFIG_POINTER_STOPPED_DELAY  80
124 #define CONFIG_DESTROY_WINDOW_DELAY   600
125 
126 // Number of pixels off the screen you have to push a window
127 // before the manager notices the window is off-screen (the higher
128 // the value, the easier it is to place windows at the screen edges)
129 
130 #define CONFIG_BUMP_DISTANCE      16
131 
132 // If CONFIG_BUMP_EVERYWHERE is defined, windows will "bump" against
133 // other window edges as well as the edges of the screen
134 
135 #define CONFIG_BUMP_EVERYWHERE    True
136 
137 // If CONFIG_PROD_SHAPE is True, all frame element shapes will be
138 // recalculated afresh every time their focus changes.  This will
139 // probably slow things down hideously, but has been reported as
140 // necessary on some systems (possibly SunOS 4.x with OpenWindows).
141 
142 #define CONFIG_PROD_SHAPE         False
143 
144 // If RESIZE_UPDATE is True, windows will opaque-resize "correctly";
145 // if False, behaviour will be as in wm2 (stretching the background
146 // image only).
147 
148 #define CONFIG_RESIZE_UPDATE      True
149 
150 // If USE_COMPOSITE is true, wmx will enable composite redirects for
151 // all windows if the Composite extension is present.  This should
152 // make no difference at all to the appearance or behaviour of wmx,
153 // but it may make it substantially faster with modern video cards
154 // that optimise rendering more than old-fashioned window operations.
155 
156 #define CONFIG_USE_COMPOSITE      True
157 
158 // If RAISELOWER_ON_CLICK is True, clicking on the title of the
159 // topmost window will lower instead of raising it (patch due to
160 // Kazushi (Jam) Marukawa)
161 
162 #define CONFIG_RAISELOWER_ON_CLICK	False
163 
164 // If USE_WINDOW_GROUPS is True, then if an application marks a mapped
165 // window as a group leader, when iconified, moved between desktops,
166 // killed etc, the leader will take all the rest of its window group
167 // with it.  Very few applications make any use of this -- indeed I
168 // haven't found any to test it on yet, so it probably doesn't work.
169 // This is different from the group stuff from Henri Naccache to be
170 // found further down this file
171 
172 #define CONFIG_USE_WINDOW_GROUPS	True
173 
174 // If USE_SESSION_MANAGER is True, and you have an Xsmc session
175 // manager running, wmx will respond to session manager callbacks and
176 // notify the session manager of its restart command.
177 
178 #define CONFIG_USE_SESSION_MANAGER	True
179 
180 // Specify the maximum length of an entry in the client menu or the command
181 // menu. Set this to zero if you want no limitation
182 
183 #define MENU_ENTRY_MAXLENGTH		80
184 
185 
186 // ========================
187 // Section II. Key bindings
188 // ========================
189 
190 // Allow keyboard control?
191 #define CONFIG_USE_KEYBOARD       (DynamicConfig::config.useKeyboard())
192 
193 // This is the key for wm controls: e.g. Alt/Left and Alt/Right to
194 // flip channels, and Alt/Tab to switch windows.  (On my 105-key
195 // PC keyboard, Meta_L corresponds to the left Windows key.)
196 
197 #define CONFIG_ALT_KEY            XK_Super_L
198 
199 // And these define the rest of the keyboard controls, when the above
200 // modifier is pressed; they're keysyms as defined in <X11/keysym.h>
201 // and <X11/keysymdef.h>
202 
203 #define CONFIG_FLIP_UP_KEY        XK_Right
204 #define CONFIG_FLIP_DOWN_KEY      XK_Left
205 #define CONFIG_HIDE_KEY           XK_Return
206 #define CONFIG_STICKY_KEY         XK_Pause
207 #define CONFIG_RAISE_KEY          XK_Up
208 #define CONFIG_LOWER_KEY          XK_Down
209 // Prior and Next should be the same as Page_Up and Page_Down in R6
210 #define CONFIG_FULLHEIGHT_KEY     XK_Prior
211 #define CONFIG_NORMALHEIGHT_KEY   XK_Next
212 #define CONFIG_FULLWIDTH_KEY      XK_KP_Add
213 #define CONFIG_NORMALWIDTH_KEY    XK_KP_Subtract
214 #define CONFIG_MAXIMISE_KEY       XK_Home
215 #define CONFIG_UNMAXIMISE_KEY     XK_End
216 #define CONFIG_SAME_KEY_MAX_UNMAX False
217 
218 // With modifier, print a list of client data to stdout
219 #define CONFIG_DEBUG_KEY          XK_Print
220 
221 // The next two may clash badly with Emacs, if you use Alt as the
222 // modifier.  The commented variants might work better for some.
223 #define CONFIG_CIRCULATE_KEY	XK_Tab
224 //#define CONFIG_CIRCULATE_KEY	XK_grave
225 //#define CONFIG_CIRCULATE_KEY	XK_section
226 #define CONFIG_DESTROY_KEY	XK_BackSpace
227 //#define CONFIG_DESTROY_KEY	XK_Delete
228 //#define CONFIG_DESTROY_KEY	XK_Insert
229 
230 // If WANT_KEYBOARD_MENU is True, then the MENU_KEY, when pressed with
231 // the modifier, will call up a client menu with keyboard navigation
232 #define CONFIG_WANT_KEYBOARD_MENU	True
233 #define CONFIG_CLIENT_MENU_KEY		XK_Menu
234 #define CONFIG_COMMAND_MENU_KEY		XK_Multi_key
235 #define CONFIG_EXIT_ON_KBD_MENU		True
236 // these are for navigating on the menu; they don't require a modifier
237 #define CONFIG_MENU_UP_KEY	XK_Up
238 #define CONFIG_MENU_DOWN_KEY	XK_Down
239 #define CONFIG_MENU_SELECT_KEY	XK_Return
240 #define CONFIG_MENU_CANCEL_KEY	XK_Escape
241 
242 // Useful for fortunate people with Sun Type-5 keyboards.  These don't
243 // require the modifier to be pressed.
244 #define CONFIG_WANT_SUNKEYS	True
245 #define CONFIG_WANT_SUNPOWERKEY	True
246 #define CONFIG_QUICKRAISE_KEY	XK_F15
247 #define CONFIG_QUICKHIDE_KEY	XK_F17
248 #define CONFIG_QUICKHEIGHT_KEY	XK_F13
249 #define CONFIG_QUICKCLOSE_KEY	XK_F11
250 #define CONFIG_QUICKRAISE_ALSO_LOWERS True
251 #define CONFIG_SUNPOWER_EXEC	"/usr/openwin/bin/sys-suspend"
252 #define CONFIG_SUNPOWER_OPTIONS	"-x","-h",0
253 #define CONFIG_SUNPOWER_SHIFTOPTIONS	"-x","-n",0
254 
255 // Mouse Configuration
256 // Use this section to remap your mouse button actions.
257 //   Button1 = LMB, Button2 = MMB, Button3 = RMB
258 //   Button4 = WheelUp, Button5 = WheelDown
259 // To prevent one or more of these from being supported
260 // at all, define it to CONFIG_NO_BUTTON.
261 #define CONFIG_NO_BUTTON 999
262 #define CONFIG_CLIENTMENU_BUTTON  Button1
263 #define CONFIG_COMMANDMENU_BUTTON Button2
264 #define CONFIG_CIRCULATE_BUTTON   Button3 // switch window, when over frame
265 #define CONFIG_PREVCHANNEL_BUTTON Button5 // flip channel, when over frame
266 #define CONFIG_NEXTCHANNEL_BUTTON Button4 // flip channel, when over frame
267 
268 
269 // ==============================
270 // Section III. Colours and fonts
271 // ==============================
272 
273 // Define CONFIG_USE_XFT to enable Xft support for drawing fonts.
274 // Otherwise plain X calls will be used.  The rest of the font
275 // configuration depends on whether or not this is set.
276 
277 #define CONFIG_USE_XFT 1
278 
279 #ifdef CONFIG_USE_XFT
280 
281 // Fonts used all over the place.  FRAME_FONT is a comma-separated
282 // list of font names to use for the frame text (the first available
283 // font in the list is used).  MENU_FONT is likewise for menu text.
284 // The SIZE values are in pixels.
285 
286 //!!! no proper way to handle italic/bold yet
287 
288 #define CONFIG_FRAME_FONT "Bitstream Vera Sans,Lucida Sans Unicode"
289 #define CONFIG_FRAME_FONT_SIZE 12
290 
291 #define CONFIG_MENU_FONT "Bitstream Vera Sans,Lucida Sans Unicode"
292 #define CONFIG_MENU_FONT_SIZE 12
293 
294 #else
295 
296 // Fonts used all over the place.  NICE_FONT is for the frames, and
297 // NICE_MENU_FONT for the menus.  NASTY_FONT is what you'll get if it
298 // can't find one of the NICE ones.  These are font lists, rather than
299 // single fonts
300 
301 #define CONFIG_NICE_FONT	  "-*-lucida-bold-r-*-*-14-*-75-75-*-*-*-*,-*-*-medium-r-*-*-14-*-75-75-*-*-*-*"
302 #define CONFIG_NICE_MENU_FONT	  "-*-lucida-medium-r-*-*-14-*-75-75-*-*-*-*,-*-*-medium-r-*-*-14-*-75-75-*-*-*-*"
303 #define CONFIG_NASTY_FONT	  "fixed,-*-*-*-*-*-*-14-*-75-75-*-*-*-*"
304 
305 #endif
306 
307 // CONFIG_TAB_MARGIN defines the size of the gap on the left and right of the
308 // text in the tab.
309 
310 #define CONFIG_TAB_MARGIN   (DynamicConfig::config.tabMargin())
311 
312 
313 // If USE_PLAIN_X_CURSORS is True, wmx will use cursors from the
314 // standard X cursor font; otherwise it will install its own.  You may
315 // wish to set this if your X client and server are on different
316 // endian machines, or if you've aliased the cursor font to something
317 // else you like better, or if you just prefer the plain X cursors
318 
319 #define CONFIG_USE_PLAIN_X_CURSORS	True
320 
321 // Colours for window decorations.  The BORDERS one is for the
322 // one-pixel border around the edge of each piece of decoration, not
323 // for the whole decoration
324 
325 #define CONFIG_TAB_FOREGROUND     (DynamicConfig::config.tabForeground())
326 #define CONFIG_TAB_BACKGROUND     (DynamicConfig::config.tabBackground())
327 #define CONFIG_FRAME_BACKGROUND   (DynamicConfig::config.frameBackground())
328 #define CONFIG_BUTTON_BACKGROUND  (DynamicConfig::config.frameBackground())
329 #define CONFIG_BORDERS            "black"
330 #define CONFIG_CHANNEL_NUMBER	  "green"
331 #define CONFIG_CLOCK_NUMBER       "gray90"
332 
333 #define CONFIG_MENU_FOREGROUND    (DynamicConfig::config.tabForeground())
334 #define CONFIG_MENU_BACKGROUND    (DynamicConfig::config.tabBackground())
335 #define CONFIG_MENU_BORDERS       "black"
336 
337 // Pixel width for the bit of frame to the left of the window and the
338 // sum of the two bits at the top
339 
340 #define CONFIG_FRAME_THICKNESS    8
341 
342 
343 // ========================
344 // Section IV. Flashy stuff
345 // ========================
346 
347 // If USE_PIXMAPS is True the frames will be decorated with the pixmap
348 // in ./background.xpm; if USE_PIXMAP_MENUS is also True, the menus
349 // will be too.  The latter screws up in palette-based visuals, but
350 // should be okay in true-colour.
351 
352 #define CONFIG_USE_PIXMAPS        True
353 #define CONFIG_USE_PIXMAP_MENUS   True
354 
355 // Set CHANNEL_SURF for multi-channel switching; CHANNEL_CLICK_SIZE is
356 // how close you have to middle-button-click to the top-right corner
357 // of the root window before the channel change happens.  Set
358 // USE_CHANNEL_KEYS if you want Alt-F1, Alt-F2 etc for quick channel
359 // changes, provided USE_KEYBOARD is also True.  Set USE_CHANNEL_MENU
360 // if you want to change channels via a keyboard-controlled menu
361 // instead of linearly up and down one at a time like TV.
362 
363 #define CONFIG_CHANNEL_SURF       True
364 #define CONFIG_CHANNEL_CLICK_SIZE 120
365 #define CONFIG_CHANNEL_NUMBER_SIZE 20
366 #define CONFIG_USE_CHANNEL_KEYS   True
367 #define CONFIG_USE_CHANNEL_MENU   False
368 
369 // FLIP_DELAY is the length of time the big green number stays in the
370 // top-right when flipping channels, before the windows reappear.
371 // QUICK_FLIP_DELAY is the equivalent figure used when flipping with
372 // the Alt-Fn keys or mouse wheel.  Milliseconds.
373 
374 #define CONFIG_FLIP_DELAY         1000
375 #define CONFIG_QUICK_FLIP_DELAY   500
376 
377 // Set MAD_FEEDBACK for skeletal representations of windows when
378 // flicking through the client menu and changing channels.  The DELAY
379 // is how long skeletal feedback has to persist before wmx decides to
380 // post the entire window contents instead; if it's negative, the
381 // contents will never be posted.  Experiment with these -- if your
382 // machine is fast and you're really hyper, you might even like a
383 // delay of 0ms.
384 
385 #define CONFIG_MAD_FEEDBACK       (DynamicConfig::config.useFeedback())
386 #define CONFIG_FEEDBACK_DELAY     (DynamicConfig::config.feedbackDelay())
387 
388 // Position of the geometry window:
389 // X < 0 left, X > 0 right,  X = 0 center
390 // Y < 0 top,  Y > 0 bottom, Y = 0 center
391 #define CONFIG_GEOMETRY_X_POS     0
392 #define CONFIG_GEOMETRY_Y_POS     0
393 
394 // Groups are fun. you can bind a bunch of windows to a number key
395 // and when you press CONFIG_ALT_KEY_MASK and the number key
396 // all the windows of that group are raised.
397 
398 // You bind a window to a group by pressing the
399 // CONFIG_ALT_KEY_MASK + CONFIG_GROUP_ADD + a number key
400 
401 // if you press CONFIG_ALT_KEY_MASK + CONFIG_GROUP_REMOVE_ALL
402 // + a number key that group is cleared of all windows.
403 
404 #define CONFIG_GROUPS             True
405 #define CONFIG_GROUP_ADD          ControlMask
406 #define CONFIG_GROUP_REMOVE_ALL   ShiftMask
407 
408 // Set CLOCK if you want wmx to display a clock permanently in the
409 // background at top-left of screen 0.  Use CONFIG_CLOCK_NUMBER
410 // to control the colour of the clock digits.
411 
412 #define CONFIG_CLOCK              False
413 
414 // This lets you choose whether to keep the regular wmx
415 // mouse button behaviour, or go w/ the GNOME-described one.
416 // If this is True, the left mouse button (button1) lets you
417 // select 1 or more gmc 'icons' and drag them around etc,
418 // the right mouse button (button3) pops up the GNOME
419 // command menu, and the middle mouse button (button2)
420 // acts like the left mouse normally does (list of windows)
421 
422 #define CONFIG_GNOME_BUTTON_COMPLIANCE   False
423 
424 #endif
425 
426