From dadb1de174421acd44575dc07dc97b6bed16da78 Mon Sep 17 00:00:00 2001 From: seanpringle Date: Mon, 29 Oct 2012 06:43:09 +1000 Subject: [PATCH 1/7] browser --- config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.h b/config.h index b7f42c4..0e5857a 100644 --- a/config.h +++ b/config.h @@ -140,7 +140,7 @@ binding keys[] = { // Find or start apps by WM_CLASS (lower case match). // Only works for apps that use some form of their binary name as their class... { .mod = AnyModifier, .key = XK_F1, .act = action_find_or_start, .data = "konsole" }, - { .mod = AnyModifier, .key = XK_F2, .act = action_find_or_start, .data = "uzbl-tabbed" }, + { .mod = AnyModifier, .key = XK_F2, .act = action_find_or_start, .data = "chromium" }, { .mod = AnyModifier, .key = XK_F3, .act = action_find_or_start, .data = "pcmanfm" }, { .mod = AnyModifier, .key = XK_F4, .act = action_find_or_start, .data = "kate" }, From cf3a957881a1375dcf83bda2e655c428d6600900 Mon Sep 17 00:00:00 2001 From: seanpringle Date: Mon, 29 Oct 2012 07:06:35 +1000 Subject: [PATCH 2/7] use .git/info/attributes --- .gitattributes | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 5f327fd..0000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -config.h merge=ours From 4b679b3aa1b42fe444f3ab6f2baa4823165cacb4 Mon Sep 17 00:00:00 2001 From: seanpringle Date: Sun, 16 Dec 2012 12:36:00 +1000 Subject: [PATCH 3/7] config tweaks --- config.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config.h b/config.h index 291691c..bea3fca 100644 --- a/config.h +++ b/config.h @@ -110,7 +110,10 @@ binding keys[] = { { .mod = ShiftMask|Mod4Mask, .key = XK_Prior, .act = action_move_monitor, .num = -1 }, // Launcher - { .mod = Mod4Mask, .key = XK_x, .act = action_command, .data = "dmenu_run" }, + { .mod = Mod4Mask, .key = XK_x, .act = action_command, .data = "dmenu_run" }, + { .mod = Mod4Mask, .key = XK_F1, .act = action_command, .data = "konsole" }, + { .mod = Mod4Mask, .key = XK_F2, .act = action_command, .data = "chromium" }, + { .mod = Mod4Mask, .key = XK_F3, .act = action_command, .data = "pcmanfm" }, // Find or start apps by WM_CLASS (lower case match). // Only works for apps that use some form of their binary name as their class... From 6942e1c71b95d1d3a6c0e3c7b7a9789360892c3c Mon Sep 17 00:00:00 2001 From: seanpringle Date: Sun, 16 Dec 2012 15:35:33 +1000 Subject: [PATCH 4/7] strut detection bug --- setup.c | 69 ++++++++++++++++++++++++++------------------------------- 1 file changed, 31 insertions(+), 38 deletions(-) diff --git a/setup.c b/setup.c index 9d7397a..ab8789f 100644 --- a/setup.c +++ b/setup.c @@ -57,6 +57,7 @@ void setup() // detect and adjust for panel struts monitor padded[MONITORS]; memmove(padded, monitors, sizeof(monitor) * MONITORS); + wm_strut all_struts; memset(&all_struts, 0, sizeof(wm_strut)); for_windows(i, c) { @@ -65,45 +66,37 @@ void setup() int v1 = v2 ? 0: GETPROP_LONG(c->window, atoms[_NET_WM_STRUT], (unsigned long*)&strut, 4); if (!c->visible || (!v1 && !v2)) continue; - for_monitors(j, m) + all_struts.left = MAX(all_struts.left, strut.left); + all_struts.right = MAX(all_struts.right, strut.right); + all_struts.top = MAX(all_struts.top, strut.top); + all_struts.bottom = MAX(all_struts.bottom, strut.bottom); + } + + for_monitors(j, m) + { + monitor *p = &padded[j]; + + // monitor left side of root window? + if (all_struts.left > 0 && !m->x) { - monitor *p = &padded[j]; - // convert _NET_WM_STRUT to _PARTIAL - if (v1) - { - strut.ly1 = m->y; strut.ly2 = m->y + m->h; - strut.ry1 = m->y; strut.ry3 = m->y + m->h; - strut.tx1 = m->x; strut.tx2 = m->x + m->w; - strut.bx1 = m->x; strut.bx2 = m->x + m->w; - } - // monitor left side of root window? - if (strut.left > 0 && !m->x - && INTERSECT(0, strut.ly1, strut.left, strut.ly2 - strut.ly1, m->x, m->y, m->w, m->h)) - { - p->x = MAX(p->x, strut.left); - p->w = MIN(p->w, m->x + m->w - strut.left); - } - else - // monitor right side of root window? - if (strut.right > 0 && m->x + m->w == screen_w - && INTERSECT(screen_w - strut.right, strut.ry1, strut.right, strut.ry3 - strut.ry1, m->x, m->y, m->w, m->h)) - { - p->w = MIN(p->w, m->x + m->w - strut.right); - } - // monitor top side of root window? - if (strut.top > 0 && !m->y - && INTERSECT(strut.tx1, 0, strut.tx2 - strut.tx1, strut.top, m->x, m->y, m->w, m->h)) - { - p->y = MAX(p->y, strut.top); - p->h = MIN(p->h, m->y + m->h - strut.top); - } - else - // monitor bottom side of root window? - if (strut.bottom > 0 && m->y + m->h == screen_h - && INTERSECT(strut.bx1, screen_h - strut.bottom, strut.bx2 - strut.bx1, strut.bottom, m->x, m->y, m->w, m->h)) - { - p->h = MIN(p->h, m->y + m->h - strut.bottom); - } + p->x += all_struts.left; + p->w -= all_struts.left; + } + // monitor right side of root window? + if (all_struts.right > 0 && m->x + m->w == screen_w) + { + p->w -= all_struts.right; + } + // monitor top side of root window? + if (all_struts.top > 0 && !m->y) + { + p->y += all_struts.top; + p->h -= all_struts.top; + } + // monitor bottom side of root window? + if (all_struts.bottom > 0 && m->y + m->h == screen_h) + { + p->h -= all_struts.bottom; } } memmove(monitors, padded, sizeof(monitor) * MONITORS); From d8f65bb1d8b9291fe4e902d32c7a762899a62ba6 Mon Sep 17 00:00:00 2001 From: seanpringle Date: Thu, 27 Dec 2012 11:04:17 +1000 Subject: [PATCH 5/7] allow building without title bars --- client.c | 9 +++++---- config.h | 6 +++++- event.c | 1 + setup.c | 19 +++++++++++-------- spot.c | 28 ++++++++++++++++------------ 5 files changed, 38 insertions(+), 25 deletions(-) diff --git a/client.c b/client.c index 87e1414..6d0756b 100644 --- a/client.c +++ b/client.c @@ -71,9 +71,10 @@ client* window_build_client(Window win) ? 1:0; // detect our own title bars - for_monitors(i, m) for_spots(j) - if (m->bars[j] && m->bars[j]->window == c->window) - { c->ours = 1; c->manage = 0; break; } + if (TITLE) + for_monitors(i, m) for_spots(j) + if (m->bars[j] && m->bars[j]->window == c->window) + { c->ours = 1; c->manage = 0; break; } if (c->manage) { @@ -272,7 +273,7 @@ void client_raise_family(client *c) client_stack_family(c, &raise); - if (!c->full) + if (!c->full && TITLE) { // raise spot's title bar in case some other fullscreen or max v/h window has obscured monitor *m = &monitors[c->monitor]; diff --git a/config.h b/config.h index abc41f4..cf16826 100644 --- a/config.h +++ b/config.h @@ -6,8 +6,12 @@ #define BORDER_URGENT "Red" #define GAP 2 -// Title bar xft font +// Title bar xft font. +// Setting this to NULL will disable title bars +//#define TITLE NULL #define TITLE "sans:size=8" + +// Title bar style #define TITLE_BLUR "Black" #define TITLE_FOCUS "White" #define TITLE_ELLIPSIS 32 diff --git a/event.c b/event.c index 7e27861..178fffd 100644 --- a/event.c +++ b/event.c @@ -144,6 +144,7 @@ void button_press(XEvent *ev) if (c && c->manage) client_activate(c); else + if (TITLE) for_monitors(i, m) for_spots(j) if (m->bars[j]->window == e->subwindow) spot_focus_top_window(j, i, None); diff --git a/setup.c b/setup.c index ab8789f..63703f2 100644 --- a/setup.c +++ b/setup.c @@ -185,16 +185,19 @@ void setup() XGrabButton(display, Button3, AnyModifier, root, True, ButtonPressMask, GrabModeSync, GrabModeSync, None, None); // create title bars - STACK_FREE(&windows); - for_monitors(i, m) for_spots(j) + if (TITLE) { - m->bars[j] = textbox_create(root, TB_AUTOHEIGHT|TB_LEFT, m->spots[j].x, m->spots[j].y, m->spots[j].w, 0, - TITLE, TITLE_BLUR, BORDER_BLUR, NULL, NULL); - XSelectInput(display, m->bars[j]->window, ExposureMask); + STACK_FREE(&windows); + for_monitors(i, m) for_spots(j) + { + m->bars[j] = textbox_create(root, TB_AUTOHEIGHT|TB_LEFT, m->spots[j].x, m->spots[j].y, m->spots[j].w, 0, + TITLE, TITLE_BLUR, BORDER_BLUR, NULL, NULL); + XSelectInput(display, m->bars[j]->window, ExposureMask); - m->spots[j].y += m->bars[j]->h; - m->spots[j].h -= m->bars[j]->h; - spot_update_bar(j, i); + m->spots[j].y += m->bars[j]->h; + m->spots[j].h -= m->bars[j]->h; + spot_update_bar(j, i); + } } // setup existing managable windows diff --git a/spot.c b/spot.c index 5aa79ed..ce3892e 100644 --- a/spot.c +++ b/spot.c @@ -51,25 +51,29 @@ void spot_update_bar(int spot, int mon) } if (tmp) XFree(tmp); } - if (c && !c->full && *title && m->bars[spot]) + if (TITLE) { - int focus = c->window == current || (spot == current_spot && mon == current_mon); - char *color = focus && c->window == current ? TITLE_FOCUS : TITLE_BLUR; - char *border = focus && c->window == current ? BORDER_FOCUS: BORDER_BLUR; - textbox_font(m->bars[spot], TITLE, color, border); - textbox_text(m->bars[spot], title); - textbox_draw(m->bars[spot]); - textbox_show(m->bars[spot]); + if (c && !c->full && *title && m->bars[spot]) + { + int focus = c->window == current || (spot == current_spot && mon == current_mon); + char *color = focus && c->window == current ? TITLE_FOCUS : TITLE_BLUR; + char *border = focus && c->window == current ? BORDER_FOCUS: BORDER_BLUR; + textbox_font(m->bars[spot], TITLE, color, border); + textbox_text(m->bars[spot], title); + textbox_draw(m->bars[spot]); + textbox_show(m->bars[spot]); + } + else + if (m->bars[spot]) + textbox_hide(m->bars[spot]); } - else - if (m->bars[spot]) - textbox_hide(m->bars[spot]); } void update_bars() { int i, j; monitor *m; - for_monitors(i, m) for_spots(j) spot_update_bar(j, i); + if (TITLE) for_monitors(i, m) for_spots(j) + spot_update_bar(j, i); } Window spot_focus_top_window(int spot, int mon, Window except) From 4505edf250ddee631872f4ddb046c22a46f396c4 Mon Sep 17 00:00:00 2001 From: seanpringle Date: Thu, 27 Dec 2012 11:08:25 +1000 Subject: [PATCH 6/7] tweak config.h examples --- config.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/config.h b/config.h index cf16826..6c407c3 100644 --- a/config.h +++ b/config.h @@ -128,7 +128,4 @@ binding keys[] = { { .mod = AnyModifier, .key = XK_F1, .act = action_find_or_start, .data = "konsole" }, { .mod = AnyModifier, .key = XK_F2, .act = action_find_or_start, .data = "chromium" }, { .mod = AnyModifier, .key = XK_F3, .act = action_find_or_start, .data = "pcmanfm" }, - { .mod = AnyModifier, .key = XK_F4, .act = action_find_or_start, .data = "kate" }, - - { .mod = AnyModifier, .key = XK_Menu, .act = action_command, .data = "xowl" }, }; From 010427c902c48dbc07ad30c6adaf3711d3f985eb Mon Sep 17 00:00:00 2001 From: seanpringle Date: Thu, 27 Dec 2012 11:18:48 +1000 Subject: [PATCH 7/7] revert default layout change --- config.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.h b/config.h index 6c407c3..226eb0d 100644 --- a/config.h +++ b/config.h @@ -32,8 +32,8 @@ // The layout can be flipped so SPOT1 is on the right. // If you do this, review the directional move/focus key bindings too. -//#define SPOT1_ALIGN SPOT1_LEFT -#define SPOT1_ALIGN SPOT1_RIGHT +#define SPOT1_ALIGN SPOT1_LEFT +//#define SPOT1_ALIGN SPOT1_RIGHT // Width of SPOT1 as percentage of screen width. #define SPOT1_WIDTH_PCT 67