switchcol, adjacent tags
This commit is contained in:
parent
03569c5cc5
commit
544c37673c
8
config.h
8
config.h
|
@ -36,7 +36,7 @@ static const Rule rules[] = {
|
|||
/* layout(s) */
|
||||
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
||||
static const int nmaster = 1; /* number of clients in master area */
|
||||
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
||||
static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */
|
||||
|
||||
static const Layout layouts[] = {
|
||||
/* symbol arrange function */
|
||||
|
@ -69,7 +69,8 @@ static const char *mutevol[] = { "amixer", "sset", "Master", "toggle", NULL };
|
|||
static const char *enable_tp[] = { "xinput", "--enable", "13", NULL };
|
||||
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[] = { "emacsclient", "-c", "-n", "-e", "(switch-to-buffer nil)", NULL };
|
||||
static const char *emacsclient[] = { "emacs", "-bg", "#000000", NULL };
|
||||
|
||||
static Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
|
@ -106,6 +107,9 @@ static Key keys[] = {
|
|||
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||
{ MODKEY, XK_n, switchcol, {0} },
|
||||
{ MODKEY, XK_i, view_adjacent, { .i = +1 } },
|
||||
{ MODKEY, XK_u, view_adjacent, { .i = -1 } },
|
||||
TAGKEYS( XK_1, 0)
|
||||
TAGKEYS( XK_2, 1)
|
||||
TAGKEYS( XK_3, 2)
|
||||
|
|
53
dwm.c
53
dwm.c
|
@ -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[])
|
||||
{
|
||||
|
|
26
dwm.c.orig
26
dwm.c.orig
|
@ -159,6 +159,7 @@ static void configure(Client *c);
|
|||
static void configurenotify(XEvent *e);
|
||||
static void configurerequest(XEvent *e);
|
||||
static Monitor *createmon(void);
|
||||
static void deck(Monitor *m);
|
||||
static void destroynotify(XEvent *e);
|
||||
static void detach(Client *c);
|
||||
static void detachstack(Client *c);
|
||||
|
@ -672,6 +673,31 @@ createmon(void)
|
|||
return m;
|
||||
}
|
||||
|
||||
void
|
||||
deck(Monitor *m) {
|
||||
unsigned int i, n, h, mw, my;
|
||||
Client *c;
|
||||
|
||||
for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||
if(n == 0)
|
||||
return;
|
||||
|
||||
if(n > m->nmaster) {
|
||||
mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||
snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
|
||||
}
|
||||
else
|
||||
mw = m->ww;
|
||||
for(i = my = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||
if(i < m->nmaster) {
|
||||
h = (m->wh - my) / (MIN(n, m->nmaster) - i);
|
||||
resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False);
|
||||
my += HEIGHT(c);
|
||||
}
|
||||
else
|
||||
resize(c, m->wx + mw, m->wy, m->ww - mw - (2*c->bw), m->wh - (2*c->bw), False);
|
||||
}
|
||||
|
||||
void
|
||||
destroynotify(XEvent *e)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
diff -urp dwm-6.1/dwm.c dwm-6.1-patched/dwm.c
|
||||
--- dwm-6.1/dwm.c 2015-11-09 06:39:37.000000000 +0800
|
||||
+++ dwm-6.1-patched/dwm.c 2016-03-24 23:56:35.435047948 +0800
|
||||
@@ -206,6 +206,7 @@ static void setup(void);
|
||||
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 *);
|
||||
@@ -1645,6 +1646,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)
|
||||
{
|
Loading…
Reference in New Issue