support urgent hint
This commit is contained in:
20
cerberus.c
20
cerberus.c
@@ -183,6 +183,7 @@ client* window_client(Window win)
|
|||||||
: SPOT1;
|
: SPOT1;
|
||||||
|
|
||||||
window_get_atom_prop(c->window, atoms[_NET_WM_STATE], c->states, MAX_NET_WM_STATES);
|
window_get_atom_prop(c->window, atoms[_NET_WM_STATE], c->states, MAX_NET_WM_STATES);
|
||||||
|
c->urgent = client_state(c, atoms[_NET_WM_STATE_DEMANDS_ATTENTION]);
|
||||||
|
|
||||||
if (c->visible)
|
if (c->visible)
|
||||||
{
|
{
|
||||||
@@ -195,7 +196,7 @@ client* window_client(Window win)
|
|||||||
long sr;
|
long sr;
|
||||||
XGetWMNormalHints(display, c->window, &c->size, &sr);
|
XGetWMNormalHints(display, c->window, &c->size, &sr);
|
||||||
c->input = c->hints.flags & InputHint && c->hints.input ? 1:0;
|
c->input = c->hints.flags & InputHint && c->hints.input ? 1:0;
|
||||||
c->urgent = c->hints.flags & XUrgencyHint ? 1: 0;
|
c->urgent = c->urgent || c->hints.flags & XUrgencyHint ? 1: 0;
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
@@ -611,7 +612,9 @@ void window_listen(Window win)
|
|||||||
// set border color based on focus
|
// set border color based on focus
|
||||||
void client_review(client *c)
|
void client_review(client *c)
|
||||||
{
|
{
|
||||||
XSetWindowBorder(display, c->window, color_get(c->window == current ? BORDER_FOCUS: BORDER_BLUR));
|
XSetWindowBorder(display, c->window,
|
||||||
|
color_get(c->window == current ? BORDER_FOCUS:
|
||||||
|
(c->urgent ? BORDER_URGENT: BORDER_BLUR)));
|
||||||
XSetWindowBorderWidth(display, c->window, client_state(c, atoms[_NET_WM_STATE_FULLSCREEN]) ? 0: BORDER);
|
XSetWindowBorderWidth(display, c->window, client_state(c, atoms[_NET_WM_STATE_FULLSCREEN]) ? 0: BORDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -886,6 +889,16 @@ void focus_change(XFocusChangeEvent *e)
|
|||||||
client_free(c);
|
client_free(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void property_notify(XPropertyEvent *e)
|
||||||
|
{
|
||||||
|
client *c = window_client(e->window);
|
||||||
|
|
||||||
|
if (c && c->manage)
|
||||||
|
client_review(c);
|
||||||
|
|
||||||
|
client_free(c);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
@@ -1049,6 +1062,9 @@ int main(int argc, char *argv[])
|
|||||||
case FocusOut:
|
case FocusOut:
|
||||||
focus_change(&ev.xfocus);
|
focus_change(&ev.xfocus);
|
||||||
break;
|
break;
|
||||||
|
case PropertyNotify:
|
||||||
|
property_notify(&ev.xproperty);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
1
config.h
1
config.h
@@ -3,6 +3,7 @@
|
|||||||
#define BORDER 2
|
#define BORDER 2
|
||||||
#define BORDER_BLUR "Dark Gray"
|
#define BORDER_BLUR "Dark Gray"
|
||||||
#define BORDER_FOCUS "Royal Blue"
|
#define BORDER_FOCUS "Royal Blue"
|
||||||
|
#define BORDER_URGENT "Red"
|
||||||
|
|
||||||
// There are three static tiles called SPOT1, SPOT2, and SPOT3.
|
// There are three static tiles called SPOT1, SPOT2, and SPOT3.
|
||||||
// Want more? Different layouts? Go away ;)
|
// Want more? Different layouts? Go away ;)
|
||||||
|
|||||||
1
proto.h
1
proto.h
@@ -40,4 +40,5 @@ void key_press(XKeyEvent *e);
|
|||||||
void button_press(XButtonEvent *e);
|
void button_press(XButtonEvent *e);
|
||||||
void client_message(XClientMessageEvent *e);
|
void client_message(XClientMessageEvent *e);
|
||||||
void focus_change(XFocusChangeEvent *e);
|
void focus_change(XFocusChangeEvent *e);
|
||||||
|
void property_notify(XPropertyEvent *e);
|
||||||
int main(int argc, char *argv[]);
|
int main(int argc, char *argv[]);
|
||||||
|
|||||||
Reference in New Issue
Block a user