From ab920d89e98dbfc0da6ef1cd689774fea2b34b1d Mon Sep 17 00:00:00 2001 From: opfez Date: Thu, 15 Jul 2021 11:00:25 +0200 Subject: [PATCH] AAAAAA --- config.h | 9 ++++++--- dwm.c | 2 ++ dwm.c.orig | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 3 deletions(-) diff --git a/config.h b/config.h index 53b029c..21b3169 100644 --- a/config.h +++ b/config.h @@ -9,13 +9,14 @@ static const char dmenufont[] = "monospace:size=10"; static const char col_gray1[] = "#222222"; //static const char col_gray1[] = "#890a01"; static const char col_gray2[] = "#333333"; +static const char col_gray5[] = "#666666"; static const char col_gray3[] = "#eeeeee"; static const char col_gray4[] = "#ffffff"; static const char col_bg[] = "#111111"; static const char *colors[][3] = { /* fg bg border */ - [SchemeNorm] = { col_gray3, col_gray1, col_bg }, - [SchemeSel] = { col_gray4, col_bg, col_gray2 }, + [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, + [SchemeSel] = { col_gray4, col_bg, col_gray5 }, }; /* tagging */ @@ -72,6 +73,8 @@ static const char *disable_tp[] = { "xinput", "--disable", "13", NULL }; //static const char *emacsclient[] = { "emacsclient", "-c", "-n", "-e", "(switch-to-buffer nil)", NULL }; static const char *emacsclient[] = { "emacs", "-bg", "#000000", NULL }; +static const char *switchkb[] = { "switchkb", NULL }; + static Key keys[] = { /* modifier key function argument */ { MODKEY, XK_equal, spawn, {.v = increasevol } }, @@ -98,7 +101,7 @@ static Key keys[] = { { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, { MODKEY, XK_c, setlayout, {.v = &layouts[3]} }, - { MODKEY, XK_space, setlayout, {0} }, + { MODKEY, XK_space, spawn, {.v = switchkb} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, { MODKEY, XK_s, togglesticky, {0} }, { MODKEY, XK_0, view, {.ui = ~0 } }, diff --git a/dwm.c b/dwm.c index e09b625..44c3131 100644 --- a/dwm.c +++ b/dwm.c @@ -1112,6 +1112,8 @@ manage(Window w, XWindowAttributes *wa) updatewindowtype(c); updatesizehints(c); updatewmhints(c); + c->x = c->mon->mx + (c->mon->mw - WIDTH(c)) / 2; + c->y = c->mon->my + (c->mon->mh - HEIGHT(c)) / 2; XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); grabbuttons(c, 0); if (!c->isfloating) diff --git a/dwm.c.orig b/dwm.c.orig index d10f9ec..e09b625 100644 --- a/dwm.c.orig +++ b/dwm.c.orig @@ -210,6 +210,7 @@ static void seturgent(Client *c, int urg); static void showhide(Client *c); static void sigchld(int unused); static void spawn(const Arg *arg); +static void switchcol(const Arg *arg); static void tag(const Arg *arg); static void tagmon(const Arg *arg); static void tile(Monitor *); @@ -232,6 +233,7 @@ static void updatetitle(Client *c); static void updatewindowtype(Client *c); static void updatewmhints(Client *c); static void view(const Arg *arg); +static void view_adjacent(const Arg *arg); static Client *wintoclient(Window w); static Monitor *wintomon(Window w); static int xerror(Display *dpy, XErrorEvent *ee); @@ -1730,6 +1732,35 @@ spawn(const Arg *arg) } } +void +switchcol(const Arg *arg) +{ + Client *c, *t; + int col = 0; + int i; + + if (!selmon->sel) + return; + for (i = 0, c = nexttiled(selmon->clients); c ; + c = nexttiled(c->next), i++) { + if (c == selmon->sel) + col = (i + 1) > selmon->nmaster; + } + if (i <= selmon->nmaster) + return; + for (c = selmon->stack; c; c = c->snext) { + if (!ISVISIBLE(c)) + continue; + for (i = 0, t = nexttiled(selmon->clients); t && t != c; + t = nexttiled(t->next), i++); + if (t && (i + 1 > selmon->nmaster) != col) { + focus(c); + restack(selmon); + break; + } + } +} + void tag(const Arg *arg) { @@ -2263,6 +2294,28 @@ zoom(const Arg *arg) pop(c); } +void +view_adjacent(const Arg *arg) +{ + int i, curtags; + int seltag = 0; + Arg a; + + curtags = selmon->tagset[selmon->seltags]; + for(i = 0; i < LENGTH(tags); i++) + if(curtags & (1 << i)){ + seltag = i; + break; + } + + seltag = (seltag + arg->i) % (int)LENGTH(tags); + if(seltag < 0) + seltag += LENGTH(tags); + + a.i = (1 << seltag); + view(&a); +} + int main(int argc, char *argv[]) {