This commit is contained in:
opfez 2021-07-15 11:00:25 +02:00
parent 4c8a0e7711
commit ab920d89e9
3 changed files with 61 additions and 3 deletions

View File

@ -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 } },

2
dwm.c
View File

@ -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)

View File

@ -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[])
{