diff options
| author | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2011-12-11 17:06:08 +0200 |
|---|---|---|
| committer | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2011-12-11 17:06:08 +0200 |
| commit | defb03539a9e5ad4afacf5a1f1c3b4e586b12bf5 (patch) | |
| tree | 0aa3ca724f7523d68bed1f428ff8772b0088fa6f | |
| parent | c76810a8c67e01972916830562310ef79ee4bbc1 (diff) | |
set default desktop to focus and whether or not the panel should be shown on exec
| -rw-r--r-- | config.def.h | 2 | ||||
| -rw-r--r-- | config.h | 2 | ||||
| -rw-r--r-- | dminiwm.c | 15 |
3 files changed, 11 insertions, 8 deletions
diff --git a/config.def.h b/config.def.h index 4280b24..9d59b74 100644 --- a/config.def.h +++ b/config.def.h @@ -24,6 +24,7 @@ #define MOD1 Mod1Mask /* ALT key */ #define MOD4 Mod4Mask /* Super/Windows key */ #define MASTER_SIZE 0.52 +#define SHOW_PANEL True /* show panel by default on exec */ #define TOP_PANEL True /* False mean panel is on bottom */ #define PANEL_HEIGHT 18 /* 0 for no space for panel, thus no panel */ #define DEFAULT_MODE TILE /* TILE MONOCYCLE BSTACK GRID */ @@ -35,6 +36,7 @@ #define FOCUS "#ff950e" /* focused window border color */ #define UNFOCUS "#444444" /* unfocused window border color */ #define DESKTOPS 4 /* number of desktops - edit DESKTOPCHANGE keys to suit */ +#define DEFAULT_DESKTOP 0 /* the desktop to focus on exec */ /** open applications to specified desktop **/ static const AppRule rules[] = { \ @@ -24,6 +24,7 @@ #define MOD1 Mod1Mask /* ALT key */ #define MOD4 Mod4Mask /* Super/Windows key */ #define MASTER_SIZE 0.52 +#define SHOW_PANEL True /* show panel by default on exec */ #define TOP_PANEL True /* False mean panel is on bottom */ #define PANEL_HEIGHT 18 /* 0 for no space for panel, thus no panel */ #define DEFAULT_MODE TILE /* TILE MONOCYCLE BSTACK GRID */ @@ -35,6 +36,7 @@ #define FOCUS "#ff950e" /* focused window border color */ #define UNFOCUS "#444444" /* unfocused window border color */ #define DESKTOPS 4 /* number of desktops - edit DESKTOPCHANGE keys to suit */ +#define DEFAULT_DESKTOP 0 /* the desktop to focus on exec */ /** open applications to specified desktop **/ static const AppRule rules[] = { \ @@ -125,8 +125,8 @@ static void update_current(void); #include "config.h" /* variables */ -static Display *dis; static Bool running = True; +static Bool showpanel = SHOW_PANEL; static int retval = 0; static int current_desktop = 0; static int previous_desktop = 0; @@ -136,18 +136,18 @@ static int master_size; static int sh; static int sw; static int screen; -static Window root; static int xerror(Display *dis, XErrorEvent *ee); static int (*xerrorxlib)(Display *, XErrorEvent *); static unsigned int win_focus; static unsigned int win_unfocus; static unsigned int numlockmask = 0; /* dynamic key lock mask */ static unsigned int nrules = LENGTH(rules); +static Display *dis; +static Window root; static client *head = NULL; static client *current = NULL; static Atom atoms[ATOM_COUNT]; static desktop desktops[DESKTOPS]; -static Bool showpanel = True; /* events array */ static void (*events[LASTEvent])(XEvent *e) = { @@ -695,12 +695,11 @@ void setup(void) { root = RootWindow(dis, screen); sw = XDisplayWidth(dis, screen) - BORDER_WIDTH; - sh = XDisplayHeight(dis, screen) - PANEL_HEIGHT - BORDER_WIDTH; - + sh = XDisplayHeight(dis, screen) - ((showpanel) ? PANEL_HEIGHT : 0) - BORDER_WIDTH; master_size = ((mode == BSTACK) ? sh : sw) * MASTER_SIZE; - for(int i=0; i < DESKTOPS; i++) + for(int i=0; i<DESKTOPS; i++) save_desktop(i); - change_desktop((Arg){.i = 0}); + change_desktop((Arg){.i = DEFAULT_DESKTOP}); win_focus = getcolor(FOCUS); win_unfocus = getcolor(UNFOCUS); @@ -708,7 +707,7 @@ void setup(void) { XModifierKeymap *modmap = XGetModifierMapping(dis); for (int k=0; k<8; k++) for (int j=0; j<modmap->max_keypermod; j++) - if(modmap->modifiermap[k*modmap->max_keypermod + j] == XKeysymToKeycode(dis, XK_Num_Lock)) + if(modmap->modifiermap[modmap->max_keypermod*k + j] == XKeysymToKeycode(dis, XK_Num_Lock)) numlockmask = (1 << k); XFreeModifiermap(modmap); |
