diff options
| author | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2011-12-11 16:42:09 +0200 |
|---|---|---|
| committer | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2011-12-11 16:44:30 +0200 |
| commit | c76810a8c67e01972916830562310ef79ee4bbc1 (patch) | |
| tree | 4b8b378d57a5820d3e5d75f50e9f0346cdc9bb40 | |
| parent | 1df2e70b2dfaf3f06fd8108c6c9a6de11e6542ab (diff) | |
implement togglepanel() function; to "hide" the panel on runtime
togglepanel() doesn't really hide the panel
togglepanel() actually resizes the windows to ignore the panel height thus overriding it
when no windows are visible the panel is there, which is kind of a feature
| -rw-r--r-- | config.def.h | 1 | ||||
| -rw-r--r-- | config.h | 1 | ||||
| -rw-r--r-- | dminiwm.c | 15 |
3 files changed, 16 insertions, 1 deletions
diff --git a/config.def.h b/config.def.h index 0529128..4280b24 100644 --- a/config.def.h +++ b/config.def.h @@ -54,6 +54,7 @@ const char *dmenucmd[] = { "dmenu", NULL }; /** Shortcuts **/ static key keys[] = { /* modifier key function argument */ + { MOD1, XK_b, togglepanel, {NULL}}, { MOD1|ShiftMask, XK_c, killclient, {NULL}}, { MOD1, XK_j, next_win, {NULL}}, { MOD1, XK_k, prev_win, {NULL}}, @@ -65,6 +65,7 @@ const char *mtogglecmd[] = { "mpc", "toggle", NULL }; /** Shortcuts **/ static key keys[] = { /* modifier key function argument */ + { MOD1, XK_b, togglepanel, {NULL}}, { MOD1|ShiftMask, XK_c, killclient, {NULL}}, { MOD1, XK_j, next_win, {NULL}}, { MOD1, XK_k, prev_win, {NULL}}, @@ -75,6 +75,7 @@ typedef struct { int growth; client *head; client *current; + Bool showpanel; } desktop; typedef struct { @@ -109,6 +110,7 @@ static void resize_master(const Arg arg); static void resize_stack(const Arg arg); static void save_desktop(int i); static void select_desktop(int i); +static void togglepanel(); static void deletewindow(Window w); static void setup(void); static void sigchld(); @@ -145,6 +147,7 @@ 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) = { @@ -323,6 +326,7 @@ void save_desktop(int i) { desktops[i].growth = growth; desktops[i].head = head; desktops[i].current = current; + desktops[i].showpanel = showpanel; } void select_desktop(int i) { @@ -332,16 +336,25 @@ void select_desktop(int i) { growth = desktops[i].growth; head = desktops[i].head; current = desktops[i].current; + showpanel = desktops[i].showpanel; current_desktop = i; } +void togglepanel() { + showpanel = !showpanel; + save_desktop(current_desktop); + tile(); +} + void tile(void) { if(head == NULL) return; /* no need to arange anything */ client *c; int n = 0; int x = 0; - int y = (TOP_PANEL) ? PANEL_HEIGHT : 0; + int panel_height = (showpanel) ? PANEL_HEIGHT : 0; + int y = (TOP_PANEL) ? panel_height : 0; + sh = XDisplayHeight(dis, screen) - panel_height - BORDER_WIDTH; if(head->next == NULL) { XMoveResizeWindow(dis, head->win, 0, y, sw + 2*BORDER_WIDTH, sh + 2*BORDER_WIDTH); |
