sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 9372006af3b61436af04bf8f37e2aaef43400012
parent 1f1f11f631003e21c9d2983fb57c4280608308a3
Author: ivoarch <ivkuzev@gmail.com>
Date:   Fri, 17 Jan 2014 11:30:57 +0100

add runorraise

Diffstat:
Adwm.suckless.org/patches/dwm-6.1-runorraise.diff | 41+++++++++++++++++++++++++++++++++++++++++
Adwm.suckless.org/patches/dwm-6.1-runorraise.md | 35+++++++++++++++++++++++++++++++++++
2 files changed, 76 insertions(+), 0 deletions(-)

diff --git a/dwm.suckless.org/patches/dwm-6.1-runorraise.diff b/dwm.suckless.org/patches/dwm-6.1-runorraise.diff @@ -0,0 +1,41 @@ +--- dwm.c.orig 2013-11-29 13:58:49.673588564 +0100 ++++ dwm.c 2013-11-23 22:56:49.725007370 +0100 +@@ -193,6 +193,7 @@ + static void resizemouse(const Arg *arg); + static void restack(Monitor *m); + static void run(void); ++static void runorraise(const Arg *arg); + static void scan(void); + static Bool sendevent(Client *c, Atom proto); + static void sendmon(Client *c, Monitor *m); +@@ -1349,6 +1350,30 @@ + } + + void ++runorraise(const Arg *arg) { ++ char *app = ((char **)arg->v)[4]; ++ Arg a = { .ui = ~0 }; ++ Monitor *mon; ++ Client *c; ++ XClassHint hint = { NULL, NULL }; ++ /* Tries to find the client */ ++ for (mon = mons; mon; mon = mon->next) { ++ for (c = mon->clients; c; c = c->next) { ++ XGetClassHint(dpy, c->win, &hint); ++ if (hint.res_class && strcmp(app, hint.res_class) == 0) { ++ a.ui = c->tags; ++ view(&a); ++ focus(c); ++ XRaiseWindow(dpy, c->win); ++ return; ++ } ++ } ++ } ++ /* Client not found: spawn it */ ++ spawn(arg); ++} ++ ++void + scan(void) { + unsigned int i, num; +} diff --git a/dwm.suckless.org/patches/dwm-6.1-runorraise.md b/dwm.suckless.org/patches/dwm-6.1-runorraise.md @@ -0,0 +1,35 @@ +runorraise +========== + +Description +----------- +This patch adds a equivalent to stumpwm's [run-or-raise] action for DWM. + +The idea is to have each frequently-used application one key combination away at all times, irrespective of which workspace it is on, +or how recently it has been used, or even whether it’s running or not. + +Usage +----- + +1. In your config.h: + + static const char *emacs[] = { "emacsclient", "-c", NULL, NULL, "Emacs" }; + static const char *browser[] = { "firefox", NULL, NULL, NULL, "Firefox" }; + +1. In your keybindings add something like: + + { Modkey, XK_e, runorraise, {.v = emacs } }, + { Modkey, XK_f, runorraise, {.v = firefox } }, + +Download +-------- + +* [dwm-6.1-runorraise.diff](dwm-6.1-runorraise.diff) + +Authors +------- +* Quentin Stievenart (acieroid) - `<quentin.stievenart at gmail dot com>` + +Contributors +------------ +* Ivaylo Kuzev (ivoarch) - `<ivkuzev at gmail dot com>`