awesome/config.h

799 lines
17 KiB
C
Raw Normal View History

2007-12-10 11:55:00 +01:00
*
2007-09-12 14:29:51 +02:00
* config.h - configuration management header
*
* Copyright © 2007 Julien Danjou <julien@danjou.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
2007-09-12 14:29:51 +02:00
*/
2007-09-05 20:15:00 +02:00
#ifndef AWESOME_CONFIG_H
#define AWESOME_CONFIG_H
2007-09-05 20:15:00 +02:00
#include <X11/Xlib.h>
2007-10-01 19:22:57 +02:00
#include <X11/Xft/Xft.h>
2007-10-15 12:40:45 +02:00
#include <regex.h>
2007-09-05 20:15:00 +02:00
/** Bar possible position */
enum
{ BarTop, BarBot, BarLeft, BarRight, BarOff };
2007-09-05 20:15:00 +02:00
enum
{ ColBorder, ColFG, ColBG, ColLast }; /* color */
enum
{ CurNormal, CurResize, CurMove, CurLast }; /* cursor */
2007-09-12 18:16:20 +02:00
2007-11-12 19:25:10 +01:00
typedef struct Rule Rule;
struct Rule
2007-09-05 20:15:00 +02:00
{
char *prop;
char *tags;
2007-11-12 18:21:03 +01:00
int screen;
2007-09-05 20:15:00 +02:00
Bool isfloating;
2007-10-15 12:40:45 +02:00
regex_t *propregex;
regex_t *tagregex;
2007-11-12 19:25:10 +01:00
Rule *next;
};
2007-09-05 20:15:00 +02:00
2007-09-10 12:06:54 +02:00
typedef struct awesome_config awesome_config;
2007-09-05 20:15:00 +02:00
typedef struct
{
char *symbol;
2007-10-11 23:35:45 +02:00
void (*arrange) (awesome_config *);
2007-09-05 20:15:00 +02:00
} Layout;
typedef struct Key Key;
struct Key
2007-09-05 20:15:00 +02:00
{
unsigned long mod;
KeySym keysym;
2007-10-11 23:32:29 +02:00
void (*func) (awesome_config *, char *);
char *arg;
Key *next;
};
2007-09-05 20:15:00 +02:00
typedef struct Button Button;
struct Button
{
unsigned long mod;
unsigned int button;
void (*func) (awesome_config *, char *);
char *arg;
Button *next;
};
/** Status bar */
typedef struct
{
/** Bar width */
int width;
/** Bar height */
int height;
/** Layout txt width */
int txtlayoutwidth;
/** Default position */
int dposition;
/** Bar position */
int position;
2007-09-07 17:29:36 +02:00
/** Window */
Window window;
/** Screen */
int screen;
} Statusbar;
2007-10-11 21:50:32 +02:00
typedef struct Client Client;
struct Client
{
/** Client name */
char name[256];
/** Window geometry */
int x, y, w, h;
/** Real window geometry for floating */
int rx, ry, rw, rh;
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
int minax, maxax, minay, maxay;
long flags;
int border, oldborder;
/** Store previous floating state before maximizing */
Bool wasfloating;
/** True if the window is floating */
Bool isfloating;
/** True if the window is fixed */
Bool isfixed;
/** True if the window is maximized */
Bool ismax;
2007-10-11 21:50:32 +02:00
/** Tags for the client */
Bool *tags;
/** Next client */
Client *next;
/** Previous client */
Client *prev;
/** Window of the client */
Window win;
/** Client display */
Display *display;
/** Client logical screen */
int screen;
/** Client physical screen */
int phys_screen;
};
/** Tag type */
typedef struct
{
/** Tag name */
char *name;
/** True if selected */
Bool selected;
/** True if was selected before selecting others tags */
Bool was_selected;
/** Current tag layout */
Layout *layout;
/** Selected client on this tag */
Client *client_sel;
2007-11-11 11:48:26 +01:00
/** Master width factor */
double mwfact;
2007-11-11 11:53:10 +01:00
/** Number of master windows */
int nmaster;
2007-11-11 11:55:20 +01:00
/** Number of columns in tile layout */
int ncol;
} Tag;
2007-11-27 23:03:55 +01:00
/** Padding type */
typedef struct
{
/** Padding at top */
int top;
/** Padding at bottom */
int bottom;
/** Padding at left */
int left;
/** Padding at right */
int right;
} Padding;
2007-09-05 20:15:00 +02:00
/** Main configuration structure */
2007-09-10 12:06:54 +02:00
struct awesome_config
2007-09-05 20:15:00 +02:00
{
2007-10-01 15:31:43 +02:00
/** Display ref */
Display *display;
2007-10-01 15:23:05 +02:00
/** Config virtual screen number */
int screen;
2007-10-01 15:23:05 +02:00
/** Config physical screen */
int phys_screen;
2007-09-05 20:15:00 +02:00
/** Tag list */
2007-09-24 15:37:52 +02:00
Tag *tags;
2007-09-05 20:15:00 +02:00
/** Number of tags in **tags */
int ntags;
/** Layout list */
Layout *layouts;
int nlayouts;
/** Rules list */
Rule *rules;
/** Keys bindings list */
2007-09-05 20:15:00 +02:00
Key *keys;
/** Mouse bindings list */
struct
{
Button *tag;
Button *title;
Button *layout;
Button *root;
Button *client;
} buttons;
2007-09-05 20:15:00 +02:00
/** Numlock mask */
unsigned int numlockmask;
/** Border size */
int borderpx;
/** Number of pixels to snap windows */
int snap;
/** Transparency of unfocused clients */
int opacity_unfocused;
/** Focus move pointer */
Bool focus_move_pointer;
2007-10-12 16:03:18 +02:00
/** Allow floats to be lowered on focus change */
Bool allow_lower_floats;
2007-09-10 12:01:36 +02:00
/** Respect resize hints */
Bool resize_hints;
2007-09-05 20:15:00 +02:00
/** Text displayed in bar */
char statustext[256];
/** Status bar */
Statusbar statusbar;
2007-09-13 15:57:35 +02:00
/** Check for XShape extension */
Bool have_shape;
2007-09-13 16:00:03 +02:00
/** Check for XRandR extension */
Bool have_randr;
2007-10-10 13:07:12 +02:00
/** Normal colors */
XColor colors_normal[ColLast];
/** Selected colors */
XColor colors_selected[ColLast];
2007-10-10 13:29:46 +02:00
/** Cursors */
Cursor cursor[CurLast];
2007-11-27 23:03:55 +01:00
/** Padding */
Padding padding;
2007-10-10 13:34:25 +02:00
/** Font */
XftFont *font;
2007-10-11 21:50:32 +02:00
/** Clients list */
Client **clients;
2007-10-31 11:37:38 +01:00
/** Path to config file */
char *configpath;
2007-09-05 20:15:00 +02:00
};
#define AWESOME_DEFAULT_CONFIG \
"screen 0 \
{ \
tags \
{ \
tag one { } \
tag two { } \
tag three { } \
tag four { } \
tag five { } \
tag six { } \
tag seven { } \
tag eight { } \
tag nine { } \
} \
layouts \
{ \
layout tile { symbol = \"[]=\" } \
layout tileleft { symbol = \"=[]\" } \
layout max { symbol = \"[ ]\" } \
layout floating { symbol = \"><>\" } \
} \
} \
\
mouse \
{ \
tag \
{ \
button = \"1\" \
command = \"tag_view\" \
} \
tag \
{ \
button = \"1\" \
modkey = {\"Mod4\"} \
command = \"client_tag\" \
} \
tag \
{ \
button = \"3\" \
command = \"tag_toggleview\" \
} \
tag \
{ \
button = \"3\" \
modkey = {\"Mod4\"} \
command = \"client_toggletag\" \
} \
tag \
{ \
button = \"4\" \
command = \"tag_viewnext\" \
} \
tag \
{ \
button = \"5\" \
command = \"tag_viewprev\" \
} \
layout \
{ \
button = \"1\" \
command = \"tag_setlayout\" \
arg = \"+1\" \
} \
layout \
{ \
button = \"4\" \
command = \"tag_setlayout\" \
arg = \"+1\" \
} \
layout \
{ \
button = \"3\" \
command = \"tag_setlayout\" \
arg = \"-1\" \
} \
layout \
{ \
button = \"5\" \
command = \"tag_setlayout\" \
arg = \"-1\" \
} \
root \
{ \
button = \"3\" \
command = \"spawn\" \
arg = \"exec urxvt\" \
} \
root \
{ \
button = \"4\" \
command = \"tag_viewnext\" \
} \
root \
{ \
button = \"5\" \
command = \"tag_viewprev\" \
} \
client \
{ \
modkey = {\"Mod4\"} \
button = \"1\" \
command = \"client_movemouse\" \
} \
client \
{ \
modkey = {\"Mod4\"} \
button = \"2\" \
command = \"client_zoom\" \
} \
client \
{ \
modkey = {\"Mod4\"} \
button = \"3\" \
command = \"client_resizemouse\" \
} \
} \
\
keys \
{ \
key \
{ \
modkey = {\"Mod4\"} \
key = \"Return\" \
command = \"spawn\" \
arg = \"exec xterm\" \
} \
key \
{ \
modkey = {\"Mod4\"} \
key = \"space\" \
command = \"tag_setlayout\" \
arg = \"+1\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Shift\"} \
key = \"space\" \
command = \"tag_setlayout\" \
arg = \"-1\" \
} \
key \
{ \
modkey = {\"Mod4\"} \
key = \"b\" \
command = \"togglebar\" \
} \
key \
{ \
modkey = {\"Mod4\"} \
key = \"j\" \
command = \"client_focusnext\" \
} \
key \
{ \
modkey = {\"Mod4\"} \
key = \"k\" \
command = \"client_focusprev\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Shift\"} \
key = \"j\" \
command = \"client_swapnext\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Shift\"} \
key = \"k\" \
command = \"client_swapprev\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Control\"} \
key = \"j\" \
command = \"screen_focusnext\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Control\"} \
key = \"k\" \
command = \"screen_focusprev\" \
} \
key \
{ \
modkey = {\"Mod4\"} \
key = \"h\" \
command = \"tag_setmwfact\" \
arg = \"-0.05\" \
} \
key \
{ \
modkey = {\"Mod4\"} \
key = \"l\" \
command = \"tag_setmwfact\" \
arg = \"+0.05\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Shift\"} \
key = \"h\" \
command = \"tag_setnmaster\" \
arg = \"+1\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Shift\"} \
key = \"l\" \
command = \"tag_setnmaster\" \
arg = \"-1\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Control\"} \
key = \"h\" \
command = \"tag_setncol\" \
arg = \"+1\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Control\"} \
key = \"l\" \
command = \"tag_setncol\" \
arg = \"-1\" \
} \
key \
{ \
modkey = {\"Mod4\"} \
key = \"Escape\" \
command = \"tag_viewprev_selected\" \
} \
key \
{ \
modkey = {\"Mod4\"} \
key = \"Left\" \
command = \"tag_viewprev\" \
} \
key \
{ \
modkey = {\"Mod4\"} \
key = \"Right\" \
command = \"tag_viewnext\" \
} \
key \
{ \
modkey = {\"Mod4\"} \
key = \"m\" \
command = \"client_togglemax\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Control\"} \
key = \"Return\" \
command = \"client_zoom\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Control\"} \
key = \"space\" \
command = \"client_togglefloating\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Shift\"} \
key = \"c\" \
command = \"client_kill\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Shift\"} \
key = \"q\" \
command = \"quit\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Control\"} \
key = \"r\" \
command = \"reloadconfig\" \
} \
key \
{ \
modkey = {\"Mod4\"} \
key = \"0\" \
command = \"tag_view\" \
} \
key \
{ \
modkey = {\"Mod4\"} \
key = \"1\" \
command = \"tag_view\" \
arg = \"1\" \
} \
key \
{ \
modkey = {\"Mod4\"} \
key = \"2\" \
command = \"tag_view\" \
arg = \"2\" \
} \
key \
{ \
modkey = {\"Mod4\"} \
key = \"3\" \
command = \"tag_view\" \
arg = \"3\" \
} \
key \
{ \
modkey = {\"Mod4\"} \
key = \"4\" \
command = \"tag_view\" \
arg = \"4\" \
} \
key \
{ \
modkey = {\"Mod4\"} \
key = \"5\" \
command = \"tag_view\" \
arg = \"5\" \
} \
key \
{ \
modkey = {\"Mod4\"} \
key = \"6\" \
command = \"tag_view\" \
arg = \"6\" \
} \
key \
{ \
modkey = {\"Mod4\"} \
key = \"7\" \
command = \"tag_view\" \
arg = \"7\" \
} \
key \
{ \
modkey = {\"Mod4\"} \
key = \"8\" \
command = \"tag_view\" \
arg = \"8\" \
} \
key \
{ \
modkey = {\"Mod4\"} \
key = \"9\" \
command = \"tag_view\" \
arg = \"9\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Control\"} \
key = \"0\" \
command = \"tag_toggleview\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Control\"} \
key = \"1\" \
command = \"tag_toggleview\" \
arg = \"1\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Control\"} \
key = \"2\" \
command = \"tag_toggleview\" \
arg = \"2\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Control\"} \
key = \"3\" \
command = \"tag_toggleview\" \
arg = \"3\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Control\"} \
key = \"4\" \
command = \"tag_toggleview\" \
arg = \"4\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Control\"} \
key = \"5\" \
command = \"tag_toggleview\" \
arg = \"5\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Control\"} \
key = \"6\" \
command = \"tag_toggleview\" \
arg = \"6\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Control\"} \
key = \"7\" \
command = \"tag_toggleview\" \
arg = \"7\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Control\"} \
key = \"8\" \
command = \"tag_toggleview\" \
arg = \"8\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Control\"} \
key = \"9\" \
command = \"tag_toggleview\" \
arg = \"9\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Shift\"} \
key = \"0\" \
command = \"client_tag\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Shift\"} \
key = \"1\" \
command = \"client_tag\" \
arg = \"1\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Shift\"} \
key = \"2\" \
command = \"client_tag\" \
arg = \"2\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Shift\"} \
key = \"3\" \
command = \"client_tag\" \
arg = \"3\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Shift\"} \
key = \"4\" \
command = \"client_tag\" \
arg = \"4\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Shift\"} \
key = \"5\" \
command = \"client_tag\" \
arg = \"5\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Shift\"} \
key = \"6\" \
command = \"client_tag\" \
arg = \"6\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Shift\"} \
key = \"7\" \
command = \"client_tag\" \
arg = \"7\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Shift\"} \
key = \"8\" \
command = \"client_tag\" \
arg = \"8\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Shift\"} \
key = \"9\" \
command = \"client_tag\" \
arg = \"9\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Shift\", \"Control\"} \
key = \"0\" \
command = \"client_toggletag\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Shift\", \"Control\"} \
key = \"1\" \
command = \"client_toggletag\" \
arg = \"1\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Shift\", \"Control\"} \
key = \"2\" \
command = \"client_toggletag\" \
arg = \"2\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Shift\", \"Control\"} \
key = \"3\" \
command = \"client_toggletag\" \
arg = \"3\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Shift\", \"Control\"} \
key = \"4\" \
command = \"client_toggletag\" \
arg = \"4\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Shift\", \"Control\"} \
key = \"5\" \
command = \"client_toggletag\" \
arg = \"5\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Shift\", \"Control\"} \
key = \"6\" \
command = \"client_toggletag\" \
arg = \"6\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Shift\", \"Control\"} \
key = \"7\" \
command = \"client_toggletag\" \
arg = \"7\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Shift\", \"Control\"} \
key = \"8\" \
command = \"client_toggletag\" \
arg = \"8\" \
} \
key \
{ \
modkey = {\"Mod4\", \"Shift\", \"Control\"} \
key = \"9\" \
command = \"client_toggletag\" \
arg = \"9\" \
} \
}"
void parse_config(const char *, awesome_config *);
2007-09-05 20:15:00 +02:00
2007-10-31 11:37:38 +01:00
void uicb_reloadconfig(awesome_config *, const char *);
2007-09-05 20:15:00 +02:00
#endif
2007-10-15 13:56:24 +02:00
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99