ewmh above, only above fullscreen

This commit is contained in:
seanpringle
2012-09-03 16:09:49 +10:00
parent 9675f3c927
commit db944a1a25
5 changed files with 43 additions and 12 deletions

View File

@@ -4,6 +4,7 @@
#define BORDER_BLUR "Dark Gray"
#define BORDER_FOCUS "Royal Blue"
#define BORDER_URGENT "Red"
#define BORDER_ABOVE "Dark Green"
// There are three static tiles called SPOT1, SPOT2, and SPOT3.
// Want more tiles? Different layouts? Floating? Go away ;)
@@ -68,6 +69,9 @@ binding keys[] = {
// Toggle current window full screen.
{ .mod = Mod4Mask, .key = XK_f, .act = ACTION_FULLSCREEN_TOGGLE },
// Toggle current window above.
{ .mod = Mod4Mask, .key = XK_a, .act = ACTION_ABOVE_TOGGLE },
// Switch focus between monitors.
{ .mod = Mod4Mask, .key = XK_Right, .act = ACTION_FOCUS_MONITOR_INC },
{ .mod = Mod4Mask, .key = XK_Left, .act = ACTION_FOCUS_MONITOR_DEC },

7
xoat.1
View File

@@ -62,11 +62,16 @@ Close a window.
.RE
.TP
.B Mod4-f
Toggle fullscreen.
Toggle state fullscreen.
While in fullscreen mode, an window is considered to be in tile 1.
.RS
.RE
.TP
.B Mod4-a
Toggle state above (only placed above fullscreen windows).
.RS
.RE
.TP
.B Mod4-Right
Focus next monitor.
.RS

37
xoat.c
View File

@@ -490,6 +490,8 @@ void client_stack(client *c, stack *all, stack *raise)
// raise a window and all its transients
void client_raise(client *c)
{
if (!c) return;
int i; stack raise, all, family;
memset(&raise, 0, sizeof(stack));
memset(&family, 0, sizeof(stack));
@@ -498,21 +500,23 @@ void client_raise(client *c)
for (i = 0; i < all.depth; i++)
{
client *o = all.clients[i];
// docks stay on top
if (o && o->type == atoms[_NET_WM_WINDOW_TYPE_DOCK])
client_stack(o, &all, &raise);
}
// above only counts for fullscreen windows
if (client_state(c, atoms[_NET_WM_STATE_FULLSCREEN]))
{
raise.clients[raise.depth] = o;
raise.windows[raise.depth++] = o->window;
for (i = 0; i < all.depth; i++)
{
client *o = all.clients[i];
if (o && client_state(o, atoms[_NET_WM_STATE_ABOVE]))
client_stack(o, &all, &raise);
}
}
while (c->trans)
{
client *t = window_client(c->transient_for);
if (t)
{
family.clients[family.depth++] = t;
c = t;
}
if (t) c = family.clients[family.depth++] = t;
}
client_stack(c, &all, &raise);
@@ -526,6 +530,9 @@ void client_raise(client *c)
// lower a window and all its transients
void client_lower(client *c)
{
if (!c || client_state(c, atoms[_NET_WM_STATE_ABOVE]))
return;
stack lower, all;
memset(&lower, 0, sizeof(stack));
windows_visible(&all);
@@ -596,8 +603,8 @@ void window_listen(Window win)
void client_review(client *c)
{
XSetWindowBorder(display, c->window,
color_get(c->window == current ? BORDER_FOCUS:
(c->urgent ? BORDER_URGENT: BORDER_BLUR)));
color_get(c->window == current ? BORDER_FOCUS: (c->urgent ? BORDER_URGENT:
(client_state(c, atoms[_NET_WM_STATE_ABOVE]) ? BORDER_ABOVE: BORDER_BLUR))));
XSetWindowBorderWidth(display, c->window, client_state(c, atoms[_NET_WM_STATE_FULLSCREEN]) ? 0: BORDER);
}
@@ -829,6 +836,16 @@ void key_press(XKeyEvent *e)
client_review(c);
client_spot(c, c->spot, 1);
break;
case ACTION_ABOVE_TOGGLE:
spot = c->spot;
client_raise(c);
if (client_state(c, atoms[_NET_WM_STATE_ABOVE]))
client_drop_state(c, atoms[_NET_WM_STATE_ABOVE]);
else
client_add_state(c, atoms[_NET_WM_STATE_ABOVE]);
client_review(c);
client_raise(c);
break;
case ACTION_TAG:
c->tags |= (unsigned int)num;
client_set_tags(c);

2
xoat.h
View File

@@ -129,6 +129,7 @@ int struts[4] = { 0, 0, 0, 0 };
X(_NET_WM_WINDOW_TYPE_DIALOG),\
X(_NET_WM_STATE),\
X(_NET_WM_STATE_FULLSCREEN),\
X(_NET_WM_STATE_ABOVE),\
X(_NET_WM_STATE_DEMANDS_ATTENTION),\
X(WM_DELETE_WINDOW),\
X(WM_TAKE_FOCUS),\
@@ -158,6 +159,7 @@ enum {
ACTION_FOCUS_MONITOR_INC,
ACTION_FOCUS_MONITOR_DEC,
ACTION_FULLSCREEN_TOGGLE,
ACTION_ABOVE_TOGGLE,
ACTION_TAG,
ACTION_UNTAG,
ACTION_RAISE_TAG,

View File

@@ -48,7 +48,10 @@ Mod4-Escape
: Close a window.
Mod4-f
: Toggle fullscreen. While in fullscreen mode, an window is considered to be in tile 1.
: Toggle state fullscreen. While in fullscreen mode, an window is considered to be in tile 1.
Mod4-a
: Toggle state above (only placed above fullscreen windows).
Mod4-Right
: Focus next monitor.