Add attachasideandbelow and keybinds
This commit is contained in:
1
README
1
README
@@ -7,6 +7,7 @@ Patches
|
|||||||
+ fakefullscreen
|
+ fakefullscreen
|
||||||
+ actualfullscreen
|
+ actualfullscreen
|
||||||
+ swallow
|
+ swallow
|
||||||
|
+ attachasideandbelow
|
||||||
|
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
|
|||||||
14
config.h
14
config.h
@@ -34,7 +34,7 @@ static const Rule rules[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* layout(s) */
|
/* layout(s) */
|
||||||
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
static const float mfact = 0.5; /* factor of master area size [0.05..0.95] */
|
||||||
static const int nmaster = 1; /* number of clients in master area */
|
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 = 1; /* 1 means respect size hints in tiled resizals */
|
||||||
|
|
||||||
@@ -58,9 +58,11 @@ static const Layout layouts[] = {
|
|||||||
|
|
||||||
/* commands */
|
/* commands */
|
||||||
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
|
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
|
||||||
//static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
|
static const char *dmenucmd[] = { "dmenu_run", NULL };
|
||||||
static const char *dmenucmd[] = { "dmenu_run", NULL };
|
static const char *termcmd[] = { "alacritty", NULL };
|
||||||
static const char *termcmd[] = { "alacritty", NULL };
|
static const char *browser[] = { "firefox-nightly", NULL };
|
||||||
|
static const char *discord[] = { "discord", NULL };
|
||||||
|
static const char *pavu[] = { "pavucontrol", NULL };
|
||||||
|
|
||||||
static Key keys[] = {
|
static Key keys[] = {
|
||||||
/* modifier key function argument */
|
/* modifier key function argument */
|
||||||
@@ -69,6 +71,10 @@ static Key keys[] = {
|
|||||||
{ MODKEY|ShiftMask, XK_q, killclient, {0} }, // kill window
|
{ MODKEY|ShiftMask, XK_q, killclient, {0} }, // kill window
|
||||||
{ MODKEY|ShiftMask, XK_Escape, quit, {0} }, // quit dwm TODO: NOT WORKING
|
{ MODKEY|ShiftMask, XK_Escape, quit, {0} }, // quit dwm TODO: NOT WORKING
|
||||||
|
|
||||||
|
{ MODKEY|ControlMask, XK_f, spawn, {.v = browser } },
|
||||||
|
{ MODKEY|ControlMask, XK_d, spawn, {.v = discord } },
|
||||||
|
{ MODKEY|ControlMask, XK_p, spawn, {.v = pavu } },
|
||||||
|
|
||||||
{ MODKEY, XK_space, setlayout, {0} }, // swap layout
|
{ MODKEY, XK_space, setlayout, {0} }, // swap layout
|
||||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} }, // toggle float per window
|
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} }, // toggle float per window
|
||||||
// { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
// { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
||||||
|
|||||||
42
dwm.c
42
dwm.c
@@ -55,7 +55,8 @@
|
|||||||
#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
|
#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
|
||||||
#define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \
|
#define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \
|
||||||
* MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy)))
|
* MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy)))
|
||||||
#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]))
|
#define ISVISIBLEONTAG(C, T) ((C->tags & T))
|
||||||
|
#define ISVISIBLE(C) ISVISIBLEONTAG(C, C->mon->tagset[C->mon->seltags])
|
||||||
#define LENGTH(X) (sizeof X / sizeof X[0])
|
#define LENGTH(X) (sizeof X / sizeof X[0])
|
||||||
#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
|
#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
|
||||||
#define WIDTH(X) ((X)->w + 2 * (X)->bw)
|
#define WIDTH(X) ((X)->w + 2 * (X)->bw)
|
||||||
@@ -157,6 +158,7 @@ static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interac
|
|||||||
static void arrange(Monitor *m);
|
static void arrange(Monitor *m);
|
||||||
static void arrangemon(Monitor *m);
|
static void arrangemon(Monitor *m);
|
||||||
static void attach(Client *c);
|
static void attach(Client *c);
|
||||||
|
static void attachBelow(Client *c);
|
||||||
static void attachstack(Client *c);
|
static void attachstack(Client *c);
|
||||||
static void buttonpress(XEvent *e);
|
static void buttonpress(XEvent *e);
|
||||||
static void checkotherwm(void);
|
static void checkotherwm(void);
|
||||||
@@ -194,6 +196,7 @@ static void maprequest(XEvent *e);
|
|||||||
static void monocle(Monitor *m);
|
static void monocle(Monitor *m);
|
||||||
static void motionnotify(XEvent *e);
|
static void motionnotify(XEvent *e);
|
||||||
static void movemouse(const Arg *arg);
|
static void movemouse(const Arg *arg);
|
||||||
|
static Client *nexttagged(Client *c);
|
||||||
static Client *nexttiled(Client *c);
|
static Client *nexttiled(Client *c);
|
||||||
static void pop(Client *);
|
static void pop(Client *);
|
||||||
static void propertynotify(XEvent *e);
|
static void propertynotify(XEvent *e);
|
||||||
@@ -428,6 +431,28 @@ attach(Client *c)
|
|||||||
c->mon->clients = c;
|
c->mon->clients = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
attachBelow(Client *c)
|
||||||
|
{
|
||||||
|
//If there is nothing on the monitor or the selected client is floating, attach as normal
|
||||||
|
if(c->mon->sel == NULL || c->mon->sel->isfloating) {
|
||||||
|
Client *at = nexttagged(c);
|
||||||
|
if(!at) {
|
||||||
|
attach(c);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
c->next = at->next;
|
||||||
|
at->next = c;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Set the new client's next property to the same as the currently selected clients next
|
||||||
|
c->next = c->mon->sel->next;
|
||||||
|
//Set the currently selected clients next property to the new client
|
||||||
|
c->mon->sel->next = c;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
attachstack(Client *c)
|
attachstack(Client *c)
|
||||||
{
|
{
|
||||||
@@ -1132,7 +1157,7 @@ manage(Window w, XWindowAttributes *wa)
|
|||||||
c->isfloating = c->oldstate = trans != None || c->isfixed;
|
c->isfloating = c->oldstate = trans != None || c->isfixed;
|
||||||
if (c->isfloating)
|
if (c->isfloating)
|
||||||
XRaiseWindow(dpy, c->win);
|
XRaiseWindow(dpy, c->win);
|
||||||
attach(c);
|
attachBelow(c);
|
||||||
attachstack(c);
|
attachstack(c);
|
||||||
XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
|
XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
|
||||||
(unsigned char *) &(c->win), 1);
|
(unsigned char *) &(c->win), 1);
|
||||||
@@ -1262,6 +1287,16 @@ movemouse(const Arg *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Client *
|
||||||
|
nexttagged(Client *c) {
|
||||||
|
Client *walked = c->mon->clients;
|
||||||
|
for(;
|
||||||
|
walked && (walked->isfloating || !ISVISIBLEONTAG(walked, c->tags));
|
||||||
|
walked = walked->next
|
||||||
|
);
|
||||||
|
return walked;
|
||||||
|
}
|
||||||
|
|
||||||
Client *
|
Client *
|
||||||
nexttiled(Client *c)
|
nexttiled(Client *c)
|
||||||
{
|
{
|
||||||
@@ -1485,7 +1520,7 @@ sendmon(Client *c, Monitor *m)
|
|||||||
detachstack(c);
|
detachstack(c);
|
||||||
c->mon = m;
|
c->mon = m;
|
||||||
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
|
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
|
||||||
attach(c);
|
attachBelow(c);
|
||||||
attachstack(c);
|
attachstack(c);
|
||||||
focus(NULL);
|
focus(NULL);
|
||||||
arrange(NULL);
|
arrange(NULL);
|
||||||
@@ -1976,6 +2011,7 @@ updategeom(void)
|
|||||||
detachstack(c);
|
detachstack(c);
|
||||||
c->mon = mons;
|
c->mon = mons;
|
||||||
attach(c);
|
attach(c);
|
||||||
|
attachBelow(c);
|
||||||
attachstack(c);
|
attachstack(c);
|
||||||
}
|
}
|
||||||
if (m == selmon)
|
if (m == selmon)
|
||||||
|
|||||||
Reference in New Issue
Block a user