From: A-Larsen Date: Tue, 13 Oct 2026 14:14:32 +0000 (-0400) Subject: goto window dwm shortcut X-Git-Url: https://nyquistdev.net/git/?a=commitdiff_plain;h=d11d1ac0f42a78498356bbd9acfed75a433c6403;p=dwm-config.git goto window dwm shortcut --- diff --git a/config.def.h b/config.def.h index acb14fb..9bc0e21 100644 --- a/config.def.h +++ b/config.def.h @@ -179,6 +179,7 @@ static const char *ffsrecstopcmd[] = { "/usr/local/bin/ffsrec-stop-recording", static const char *wakeupcmd[] = { "/usr/local/bin/wake-up", "toggle", NULL }; static const char *calendarcmd[] = { "/usr/local/bin/dwm-calendar", NULL }; static const char *windowcontainercmd[] = { "/usr/local/bin/dwm-window-container-toggle", NULL }; +static const char *gotowindowcmd[] = { "/usr/local/bin/dwm-goto-window", NULL }; static const Key keys[] = { /* modifier key function argument */ @@ -196,7 +197,8 @@ static const Key keys[] = { { MODKEY|ShiftMask, XK_m, spawn, {.v = cpucmd } }, // { MODKEY, XK_e, spawn, {.v = calc_mccw_cmd } }, // { MODKEY|ControlMask, XK_e, spawn, {.v = calc_mcw_cmd } }, - { MODKEY, XK_o, focuscalculator, {0} }, + { MODKEY, XK_c, focuscalculator, {0} }, + { MODKEY, XK_o, spawn, {.v = gotowindowcmd} }, { MODKEY|ShiftMask, XK_f, spawn, {.v = facecamcmd } }, { MODKEY|ShiftMask, XK_b, spawn, {.v = brightnesscmd} }, { MODKEY|ShiftMask, XK_p, spawn, {.v = calendarcmd} }, diff --git a/config.h b/config.h index acb14fb..9bc0e21 100644 --- a/config.h +++ b/config.h @@ -179,6 +179,7 @@ static const char *ffsrecstopcmd[] = { "/usr/local/bin/ffsrec-stop-recording", static const char *wakeupcmd[] = { "/usr/local/bin/wake-up", "toggle", NULL }; static const char *calendarcmd[] = { "/usr/local/bin/dwm-calendar", NULL }; static const char *windowcontainercmd[] = { "/usr/local/bin/dwm-window-container-toggle", NULL }; +static const char *gotowindowcmd[] = { "/usr/local/bin/dwm-goto-window", NULL }; static const Key keys[] = { /* modifier key function argument */ @@ -196,7 +197,8 @@ static const Key keys[] = { { MODKEY|ShiftMask, XK_m, spawn, {.v = cpucmd } }, // { MODKEY, XK_e, spawn, {.v = calc_mccw_cmd } }, // { MODKEY|ControlMask, XK_e, spawn, {.v = calc_mcw_cmd } }, - { MODKEY, XK_o, focuscalculator, {0} }, + { MODKEY, XK_c, focuscalculator, {0} }, + { MODKEY, XK_o, spawn, {.v = gotowindowcmd} }, { MODKEY|ShiftMask, XK_f, spawn, {.v = facecamcmd } }, { MODKEY|ShiftMask, XK_b, spawn, {.v = brightnesscmd} }, { MODKEY|ShiftMask, XK_p, spawn, {.v = calendarcmd} }, diff --git a/dwm b/dwm index 78f5eea..3f6f18e 100755 Binary files a/dwm and b/dwm differ diff --git a/dwm.c b/dwm.c index 578ccf0..5ad38e4 100644 --- a/dwm.c +++ b/dwm.c @@ -1100,11 +1100,62 @@ clientmessage(XEvent *e) setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */ || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen))); } else if (cme->message_type == netatom[NetActiveWindow]) { - if (c != selmon->sel && !c->isurgent) +// /* cme->data.l[0] == 2 means it came from an external pager/script like wmctrl */ + if (cme->data.l[0] == 2) { + /* --- NATIVE TAG, MONITOR, AND MOUSE JUMP ON ACTIVATION --- */ + selmon = c->mon; + if (!(c->tags & selmon->tagset[selmon->seltags])) { + view(&(Arg){ .ui = c->tags }); + } + focus(c); + restack(selmon); + + /* Optional: Warp cursor to the center of the target monitor */ + XWarpPointer(dpy, None, root, 0, 0, 0, 0, + selmon->wx + selmon->ww / 2, + selmon->wy + selmon->wh / 2); + /* ------------------------------------------------------- */ + + } else if (c != selmon->sel && !c->isurgent) seturgent(c, 1); } } +// void +// clientmessage(XEvent *e) +// { +// XClientMessageEvent *cme = &e->xclient; +// Client *c = wintoclient(cme->window); + +// if (!c) +// return; +// if (cme->message_type == netatom[NetWMState]) { +// if (cme->data.l[1] == netatom[NetWMFullscreen] +// || cme->data.l[2] == netatom[NetWMFullscreen]) +// setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */ +// || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen))); +// } else if (cme->message_type == netatom[NetActiveWindow]) { +// /* cme->data.l[0] == 2 means it came from an external pager/script like wmctrl */ +// if (cme->data.l[0] == 2 || c->switchto) { +// selmon = c->mon; +// if (!(c->tags & selmon->tagset[selmon->seltags])) { +// view(&(Arg){ .ui = c->tags }); +// } +// focus(c); +// restack(selmon); + +// XWarpPointer(dpy, None, root, 0, 0, 0, 0, +// selmon->wx + selmon->ww / 2, +// selmon->wy + selmon->wh / 2); +// c->switchto = 0; +// } else { +// /* App launch when switchto is false: focus quietly without moving tags */ +// focus(c); +// restack(selmon); +// } +// } +// } + void configure(Client *c) { diff --git a/dwm.o b/dwm.o index 42f27b5..ab42e77 100644 Binary files a/dwm.o and b/dwm.o differ