aboutsummaryrefslogtreecommitdiff
path: root/dminiwm.c
diff options
context:
space:
mode:
authorIvan Kanakarakis <ivan.kanak@gmail.com>2011-12-11 16:42:09 +0200
committerIvan Kanakarakis <ivan.kanak@gmail.com>2011-12-11 16:44:30 +0200
commitc76810a8c67e01972916830562310ef79ee4bbc1 (patch)
tree4b8b378d57a5820d3e5d75f50e9f0346cdc9bb40 /dminiwm.c
parent1df2e70b2dfaf3f06fd8108c6c9a6de11e6542ab (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
Diffstat (limited to 'dminiwm.c')
-rw-r--r--dminiwm.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/dminiwm.c b/dminiwm.c
index 6bdd872..f82da04 100644
--- a/dminiwm.c
+++ b/dminiwm.c
@@ -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);