Merge branch 'master' of github.com:seanpringle/xoat

Conflicts:
	config.h
This commit is contained in:
Sean Pringle
2013-01-27 11:40:56 +10:00
6 changed files with 76 additions and 67 deletions

1
.gitattributes vendored
View File

@@ -1 +0,0 @@
config.h merge=ours

View File

@@ -71,6 +71,7 @@ client* window_build_client(Window win)
? 1:0; ? 1:0;
// detect our own title bars // detect our own title bars
if (TITLE)
for_monitors(i, m) for_spots(j) for_monitors(i, m) for_spots(j)
if (m->bars[j] && m->bars[j]->window == c->window) if (m->bars[j] && m->bars[j]->window == c->window)
{ c->ours = 1; c->manage = 0; break; } { c->ours = 1; c->manage = 0; break; }
@@ -272,7 +273,7 @@ void client_raise_family(client *c)
client_stack_family(c, &raise); 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 // raise spot's title bar in case some other fullscreen or max v/h window has obscured
monitor *m = &monitors[c->monitor]; monitor *m = &monitors[c->monitor];

View File

@@ -6,11 +6,15 @@
#define BORDER_URGENT "Red" #define BORDER_URGENT "Red"
#define GAP 2 #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" #define TITLE "sans:size=8"
// Title bar style
#define TITLE_BLUR "Black" #define TITLE_BLUR "Black"
#define TITLE_FOCUS "White" #define TITLE_FOCUS "White"
#define TITLE_ELLIPSIS 30 #define TITLE_ELLIPSIS 32
// There are three static tiles called SPOT1, SPOT2, and SPOT3. // There are three static tiles called SPOT1, SPOT2, and SPOT3.
// Want more tiles? Different layouts? Floating? Go away ;) // Want more tiles? Different layouts? Floating? Go away ;)
@@ -115,9 +119,13 @@ binding keys[] = {
// Launcher // 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). // 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... // 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 = "xterm" }, { .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_F2, .act = action_find_or_start, .data = "chromium" },
{ .mod = AnyModifier, .key = XK_F3, .act = action_find_or_start, .data = "pcmanfm" },
}; };

View File

@@ -144,6 +144,7 @@ void button_press(XEvent *ev)
if (c && c->manage) if (c && c->manage)
client_activate(c); client_activate(c);
else else
if (TITLE)
for_monitors(i, m) for_spots(j) for_monitors(i, m) for_spots(j)
if (m->bars[j]->window == e->subwindow) if (m->bars[j]->window == e->subwindow)
spot_focus_top_window(j, i, None); spot_focus_top_window(j, i, None);

46
setup.c
View File

@@ -57,6 +57,7 @@ void setup()
// detect and adjust for panel struts // detect and adjust for panel struts
monitor padded[MONITORS]; monitor padded[MONITORS];
memmove(padded, monitors, sizeof(monitor) * MONITORS); memmove(padded, monitors, sizeof(monitor) * MONITORS);
wm_strut all_struts; memset(&all_struts, 0, sizeof(wm_strut));
for_windows(i, c) 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); int v1 = v2 ? 0: GETPROP_LONG(c->window, atoms[_NET_WM_STRUT], (unsigned long*)&strut, 4);
if (!c->visible || (!v1 && !v2)) continue; if (!c->visible || (!v1 && !v2)) continue;
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) for_monitors(j, m)
{ {
monitor *p = &padded[j]; 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? // monitor left side of root window?
if (strut.left > 0 && !m->x if (all_struts.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->x += all_struts.left;
p->w = MIN(p->w, m->x + m->w - strut.left); p->w -= all_struts.left;
} }
else
// monitor right side of root window? // monitor right side of root window?
if (strut.right > 0 && m->x + m->w == screen_w if (all_struts.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); p->w -= all_struts.right;
} }
// monitor top side of root window? // monitor top side of root window?
if (strut.top > 0 && !m->y if (all_struts.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->y += all_struts.top;
p->h = MIN(p->h, m->y + m->h - strut.top); p->h -= all_struts.top;
} }
else
// monitor bottom side of root window? // monitor bottom side of root window?
if (strut.bottom > 0 && m->y + m->h == screen_h if (all_struts.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->h -= all_struts.bottom;
}
} }
} }
memmove(monitors, padded, sizeof(monitor) * MONITORS); memmove(monitors, padded, sizeof(monitor) * MONITORS);
@@ -192,6 +185,8 @@ void setup()
XGrabButton(display, Button3, AnyModifier, root, True, ButtonPressMask, GrabModeSync, GrabModeSync, None, None); XGrabButton(display, Button3, AnyModifier, root, True, ButtonPressMask, GrabModeSync, GrabModeSync, None, None);
// create title bars // create title bars
if (TITLE)
{
STACK_FREE(&windows); STACK_FREE(&windows);
for_monitors(i, m) for_spots(j) for_monitors(i, m) for_spots(j)
{ {
@@ -203,6 +198,7 @@ void setup()
m->spots[j].h -= m->bars[j]->h; m->spots[j].h -= m->bars[j]->h;
spot_update_bar(j, i); spot_update_bar(j, i);
} }
}
// setup existing managable windows // setup existing managable windows
STACK_FREE(&windows); STACK_FREE(&windows);

6
spot.c
View File

@@ -51,6 +51,8 @@ void spot_update_bar(int spot, int mon)
} }
if (tmp) XFree(tmp); if (tmp) XFree(tmp);
} }
if (TITLE)
{
if (c && !c->full && *title && m->bars[spot]) if (c && !c->full && *title && m->bars[spot])
{ {
int focus = c->window == current || (spot == current_spot && mon == current_mon); int focus = c->window == current || (spot == current_spot && mon == current_mon);
@@ -65,11 +67,13 @@ void spot_update_bar(int spot, int mon)
if (m->bars[spot]) if (m->bars[spot])
textbox_hide(m->bars[spot]); textbox_hide(m->bars[spot]);
} }
}
void update_bars() void update_bars()
{ {
int i, j; monitor *m; 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) Window spot_focus_top_window(int spot, int mon, Window except)