movestack, rebinds
This commit is contained in:
parent
4c7bc4051e
commit
9b6dc5b72d
3 changed files with 91 additions and 36 deletions
34
config.h
34
config.h
|
@ -8,7 +8,7 @@ static const unsigned int gappov = 10;
|
||||||
static int smartgaps = 1;
|
static int smartgaps = 1;
|
||||||
static const int showbar = 1;
|
static const int showbar = 1;
|
||||||
static const int topbar = 1;
|
static const int topbar = 1;
|
||||||
static const char *fonts[] = { "Mononoki Nerd Font:size=12" };
|
static const char *fonts[] = { "Mononoki Nerd Font:size=12", "Noto Color Emoji" };
|
||||||
static const char dmenufont[] = "Mononoki Nerd Font:size=12";
|
static const char dmenufont[] = "Mononoki Nerd Font:size=12";
|
||||||
static const char col_gray1[] = "#222222";
|
static const char col_gray1[] = "#222222";
|
||||||
static const char col_gray2[] = "#444444";
|
static const char col_gray2[] = "#444444";
|
||||||
|
@ -37,26 +37,27 @@ static const Rule rules[] = {
|
||||||
* WM_CLASS(STRING) = instance, class
|
* WM_CLASS(STRING) = instance, class
|
||||||
* WM_NAME(STRING) = title
|
* WM_NAME(STRING) = title
|
||||||
*/
|
*/
|
||||||
/* class instance title tags mask isfloating monitor */
|
/* class instance name tags mask isfloating monitor */
|
||||||
{ "Firefox", NULL, "Picture-in-Picture", 0, 1, -1 },
|
{ "Firefox", NULL, "Picture-in-Picture", 0, 1, -1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* layout(s) */
|
/* layout(s) */
|
||||||
static const float mfact = 0.60; /* factor of master area size [0.05..0.95] */
|
static const float mfact = 0.60;
|
||||||
static const int nmaster = 1; /* number of clients in master area */
|
static const int nmaster = 1;
|
||||||
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
static const int resizehints = 1;
|
||||||
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
|
static const int lockfullscreen = 1;
|
||||||
static const int inversedirection = 1; /* 1 will attach windows to the end of the stack */
|
int inversedirection = 1;
|
||||||
|
|
||||||
#define FORCE_VSPLIT 1
|
#define FORCE_VSPLIT 1
|
||||||
#include "vanitygaps.c"
|
#include "vanitygaps.c"
|
||||||
|
|
||||||
static const Layout layouts[] = {
|
static const Layout layouts[] = {
|
||||||
/* symbol arrange function */
|
/* symbol arrange function */
|
||||||
{ "[]=", tile }, /* first entry is default */
|
{ "[\\]", dwindle},
|
||||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
{ "[]=", tile },
|
||||||
{ "[M]", monocle },
|
{ "[M]", monocle },
|
||||||
|
{ "><>", NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* key definitions */
|
/* key definitions */
|
||||||
|
@ -68,14 +69,14 @@ static const Layout layouts[] = {
|
||||||
{ MODKEY|Mod1Mask, KEY, toggletag, {.ui = 1 << TAG} }, \
|
{ MODKEY|Mod1Mask, KEY, toggletag, {.ui = 1 << TAG} }, \
|
||||||
{ MODKEY|ControlMask|ShiftMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
{ MODKEY|ControlMask|ShiftMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||||
|
|
||||||
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
|
|
||||||
#define SHCMD(...) { .v = (const char*[]){ __VA_ARGS__, NULL } }
|
#define SHCMD(...) { .v = (const char*[]){ __VA_ARGS__, NULL } }
|
||||||
|
|
||||||
/* commands */
|
/* commands */
|
||||||
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
|
static char dmenumon[2] = "0";
|
||||||
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_accent, "-sf", col_gray4, NULL };
|
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_accent, "-sf", col_gray4, NULL };
|
||||||
static const char *termcmd[] = { "st", NULL };
|
static const char *termcmd[] = { "st", NULL };
|
||||||
|
|
||||||
|
#include "movestack.c"
|
||||||
static const Key keys[] = {
|
static const Key keys[] = {
|
||||||
/* modifier key function argument */
|
/* modifier key function argument */
|
||||||
// movement
|
// movement
|
||||||
|
@ -93,12 +94,16 @@ static const Key keys[] = {
|
||||||
{ MODKEY, XK_q, killclient, {0} },
|
{ MODKEY, XK_q, killclient, {0} },
|
||||||
|
|
||||||
// layout
|
// layout
|
||||||
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
{ MODKEY, XK_y, setlayout, {.v = &layouts[0]} },
|
||||||
|
{ MODKEY, XK_u, setlayout, {.v = &layouts[1]} },
|
||||||
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||||
{ MODKEY, XK_f, togglefullscr, {0} },
|
{ MODKEY, XK_f, togglefullscr, {0} },
|
||||||
{ MODKEY|ShiftMask, XK_f, togglefloating, {0} },
|
{ MODKEY|ShiftMask, XK_f, togglefloating, {0} },
|
||||||
|
{ MODKEY|ShiftMask, XK_j, movestack, {.i = +1 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_k, movestack, {.i = -1 } },
|
||||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||||
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
||||||
|
{ MODKEY, XK_p, invertdir, {0} },
|
||||||
|
|
||||||
// apps
|
// apps
|
||||||
{ MODKEY, XK_w, spawn, SHCMD("firefox") },
|
{ MODKEY, XK_w, spawn, SHCMD("firefox") },
|
||||||
|
@ -107,11 +112,6 @@ static const Key keys[] = {
|
||||||
{ MODKEY, XK_i, spawn, SHCMD("dunstctl", "history-pop") },
|
{ MODKEY, XK_i, spawn, SHCMD("dunstctl", "history-pop") },
|
||||||
{ MODKEY, XK_o, spawn, SHCMD("dunstctl", "close") },
|
{ MODKEY, XK_o, spawn, SHCMD("dunstctl", "close") },
|
||||||
|
|
||||||
/*
|
|
||||||
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
|
||||||
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
|
||||||
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
|
||||||
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },*/
|
|
||||||
// tags
|
// tags
|
||||||
TAGKEYS( XK_1, 0)
|
TAGKEYS( XK_1, 0)
|
||||||
TAGKEYS( XK_2, 1)
|
TAGKEYS( XK_2, 1)
|
||||||
|
|
7
dwm.c
7
dwm.c
|
@ -183,6 +183,7 @@ static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
|
||||||
static void grabbuttons(Client *c, int focused);
|
static void grabbuttons(Client *c, int focused);
|
||||||
static void grabkeys(void);
|
static void grabkeys(void);
|
||||||
static void incnmaster(const Arg *arg);
|
static void incnmaster(const Arg *arg);
|
||||||
|
static void invertdir(const Arg *arg);
|
||||||
static void keypress(XEvent *e);
|
static void keypress(XEvent *e);
|
||||||
static void killclient(const Arg *arg);
|
static void killclient(const Arg *arg);
|
||||||
static void manage(Window w, XWindowAttributes *wa);
|
static void manage(Window w, XWindowAttributes *wa);
|
||||||
|
@ -1017,6 +1018,12 @@ incnmaster(const Arg *arg)
|
||||||
arrange(selmon);
|
arrange(selmon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
invertdir(const Arg *arg)
|
||||||
|
{
|
||||||
|
inversedirection = !inversedirection;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef XINERAMA
|
#ifdef XINERAMA
|
||||||
static int
|
static int
|
||||||
isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info)
|
isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info)
|
||||||
|
|
48
movestack.c
Normal file
48
movestack.c
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
void
|
||||||
|
movestack(const Arg *arg) {
|
||||||
|
Client *c = NULL, *p = NULL, *pc = NULL, *i;
|
||||||
|
|
||||||
|
if(arg->i > 0) {
|
||||||
|
/* find the client after selmon->sel */
|
||||||
|
for(c = selmon->sel->next; c && (!ISVISIBLE(c) || c->isfloating); c = c->next);
|
||||||
|
if(!c)
|
||||||
|
for(c = selmon->clients; c && (!ISVISIBLE(c) || c->isfloating); c = c->next);
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* find the client before selmon->sel */
|
||||||
|
for(i = selmon->clients; i != selmon->sel; i = i->next)
|
||||||
|
if(ISVISIBLE(i) && !i->isfloating)
|
||||||
|
c = i;
|
||||||
|
if(!c)
|
||||||
|
for(; i; i = i->next)
|
||||||
|
if(ISVISIBLE(i) && !i->isfloating)
|
||||||
|
c = i;
|
||||||
|
}
|
||||||
|
/* find the client before selmon->sel and c */
|
||||||
|
for(i = selmon->clients; i && (!p || !pc); i = i->next) {
|
||||||
|
if(i->next == selmon->sel)
|
||||||
|
p = i;
|
||||||
|
if(i->next == c)
|
||||||
|
pc = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* swap c and selmon->sel selmon->clients in the selmon->clients list */
|
||||||
|
if(c && c != selmon->sel) {
|
||||||
|
Client *temp = selmon->sel->next==c?selmon->sel:selmon->sel->next;
|
||||||
|
selmon->sel->next = c->next==selmon->sel?c:c->next;
|
||||||
|
c->next = temp;
|
||||||
|
|
||||||
|
if(p && p != c)
|
||||||
|
p->next = c;
|
||||||
|
if(pc && pc != selmon->sel)
|
||||||
|
pc->next = selmon->sel;
|
||||||
|
|
||||||
|
if(selmon->sel == selmon->clients)
|
||||||
|
selmon->clients = c;
|
||||||
|
else if(c == selmon->clients)
|
||||||
|
selmon->clients = selmon->sel;
|
||||||
|
|
||||||
|
arrange(selmon);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue