diff options
| author | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2012-03-01 19:28:00 +0200 |
|---|---|---|
| committer | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2012-12-16 02:11:13 +0200 |
| commit | 56c613830041d6902d97ac93f8bb7eb704d95039 (patch) | |
| tree | ad2740a13a27e2f2881c9501db4f817c319a0fdc | |
| parent | 91d40f6c978c94e61b3b8b4b1af2954edd68001e (diff) | |
focus urgent window with a shortcut
| -rw-r--r-- | config.def.h | 1 | ||||
| -rw-r--r-- | monsterwm.c | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/config.def.h b/config.def.h index 7b46a87..666a11d 100644 --- a/config.def.h +++ b/config.def.h @@ -57,6 +57,7 @@ static const char *menucmd[] = { "dmenu_run", NULL }; static Key keys[] = { /* modifier key function argument */ { MOD1, XK_b, togglepanel, {NULL}}, + { MOD1, XK_BackSpace, focusurgent, {NULL}}, { MOD1|SHIFT, XK_c, killclient, {NULL}}, { MOD1, XK_j, next_win, {NULL}}, { MOD1, XK_k, prev_win, {NULL}}, diff --git a/monsterwm.c b/monsterwm.c index bb1795e..00027af 100644 --- a/monsterwm.c +++ b/monsterwm.c @@ -80,6 +80,7 @@ typedef struct { /* exposed function prototypes sorted alphabetically */ static void change_desktop(const Arg *arg); static void client_to_desktop(const Arg *arg); +static void focusurgent(); static void killclient(); static void last_desktop(); static void move_down(); @@ -564,6 +565,15 @@ void focusin(XEvent *e) { } /** + * find and focus the first client which received + * an urgent hint in the current desktop + */ +void focusurgent(void) { + Desktop *d = &desktops[currdeskidx]; + for (Client *c = d->head; c; c = c->next) if (c->isurgn) focus(c, d); +} + +/** * get a pixel with the requested color to * fill some window area (such as borders) */ |
