summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorProsperousPotato <114923153+ProsperousPotato@users.noreply.github.com>2024-06-22 19:06:17 +0000
committerGitHub <noreply@github.com>2024-06-22 19:06:17 +0000
commitb63379b1af27832b944d7ab8750839c35e6ebf0c (patch)
tree9df46f6231b4eb1fa6c2295c4cac6ae599d6c83b
parent39aa575a37aab32fa386bc6c20841b222298f922 (diff)
Add files via upload
-rw-r--r--config.def.h6
-rw-r--r--config.h6
-rw-r--r--dwm.c73
3 files changed, 78 insertions, 7 deletions
diff --git a/config.def.h b/config.def.h
index aa90099..e6b7c73 100644
--- a/config.def.h
+++ b/config.def.h
@@ -2,7 +2,7 @@
/* Constants */
#define TERMINAL "st"
-#define BROWSER "floorp"
+#define BROWSER "librewolf"
#define FILE_EXPLORER "pcmanfm"
#define HOME "/home/arch/"
/* appearance */
@@ -95,6 +95,8 @@ static const Key keys[] = {
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
+ { MODKEY|ShiftMask, XK_j, rotatestack, {.i = +1 } },
+ { MODKEY|ShiftMask, XK_k, rotatestack, {.i = -1 } },
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
{ MODKEY, XK_u, incnmaster, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
@@ -104,7 +106,7 @@ static const Key keys[] = {
{ MODKEY, XK_q, killclient, {0} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
- { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
+ { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_Return, setlayout, {0} },
{ MODKEY|ShiftMask, XK_Return, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
diff --git a/config.h b/config.h
index aa90099..e6b7c73 100644
--- a/config.h
+++ b/config.h
@@ -2,7 +2,7 @@
/* Constants */
#define TERMINAL "st"
-#define BROWSER "floorp"
+#define BROWSER "librewolf"
#define FILE_EXPLORER "pcmanfm"
#define HOME "/home/arch/"
/* appearance */
@@ -95,6 +95,8 @@ static const Key keys[] = {
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
+ { MODKEY|ShiftMask, XK_j, rotatestack, {.i = +1 } },
+ { MODKEY|ShiftMask, XK_k, rotatestack, {.i = -1 } },
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
{ MODKEY, XK_u, incnmaster, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
@@ -104,7 +106,7 @@ static const Key keys[] = {
{ MODKEY, XK_q, killclient, {0} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
- { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
+ { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_Return, setlayout, {0} },
{ MODKEY|ShiftMask, XK_Return, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
diff --git a/dwm.c b/dwm.c
index 17e3f82..d5859c2 100644
--- a/dwm.c
+++ b/dwm.c
@@ -147,6 +147,7 @@ static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interac
static void arrange(Monitor *m);
static void arrangemon(Monitor *m);
static void attach(Client *c);
+static void attachbottom(Client *c);
static void attachstack(Client *c);
static void buttonpress(XEvent *e);
static void checkotherwm(void);
@@ -163,6 +164,8 @@ static void detachstack(Client *c);
static Monitor *dirtomon(int dir);
static void drawbar(Monitor *m);
static void drawbars(void);
+static void enqueue(Client *c);
+static void enqueuestack(Client *c);
static void enternotify(XEvent *e);
static void expose(XEvent *e);
static void focus(Client *c);
@@ -193,6 +196,7 @@ static void resize(Client *c, int x, int y, int w, int h, int interact);
static void resizeclient(Client *c, int x, int y, int w, int h);
static void resizemouse(const Arg *arg);
static void restack(Monitor *m);
+static void rotatestack(const Arg *arg);
static void run(void);
static void scan(void);
static int sendevent(Client *c, Atom proto);
@@ -409,6 +413,15 @@ attach(Client *c)
}
void
+attachbottom(Client *c)
+{
+ Client **tc;
+ c->next = NULL;
+ for (tc = &c->mon->clients; *tc; tc = &(*tc)->next);
+ *tc = c;
+}
+
+void
attachstack(Client *c)
{
c->snext = c->mon->stack;
@@ -759,6 +772,28 @@ drawbars(void)
}
void
+enqueue(Client *c)
+{
+ Client *l;
+ for (l = c->mon->clients; l && l->next; l = l->next);
+ if (l) {
+ l->next = c;
+ c->next = NULL;
+ }
+}
+
+void
+enqueuestack(Client *c)
+{
+ Client *l;
+ for (l = c->mon->stack; l && l->snext; l = l->snext);
+ if (l) {
+ l->snext = c;
+ c->snext = NULL;
+ }
+}
+
+void
enternotify(XEvent *e)
{
Client *c;
@@ -1075,7 +1110,7 @@ manage(Window w, XWindowAttributes *wa)
c->isfloating = c->oldstate = trans != None || c->isfixed;
if (c->isfloating)
XRaiseWindow(dpy, c->win);
- attach(c);
+ attachbottom(c);
attachstack(c);
XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
(unsigned char *) &(c->win), 1);
@@ -1381,6 +1416,38 @@ restack(Monitor *m)
}
void
+rotatestack(const Arg *arg)
+{
+ Client *c = NULL, *f;
+
+ if (!selmon->sel)
+ return;
+ f = selmon->sel;
+ if (arg->i > 0) {
+ for (c = nexttiled(selmon->clients); c && nexttiled(c->next); c = nexttiled(c->next));
+ if (c){
+ detach(c);
+ attach(c);
+ detachstack(c);
+ attachstack(c);
+ }
+ } else {
+ if ((c = nexttiled(selmon->clients))){
+ detach(c);
+ enqueue(c);
+ detachstack(c);
+ enqueuestack(c);
+ }
+ }
+ if (c){
+ arrange(selmon);
+ //unfocus(f, 1);
+ focus(f);
+ restack(selmon);
+ }
+}
+
+void
run(void)
{
XEvent ev;
@@ -1427,8 +1494,8 @@ sendmon(Client *c, Monitor *m)
detach(c);
detachstack(c);
c->mon = m;
- c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
- attach(c);
+ attach(c);
+ attachbottom(c);
attachstack(c);
focus(NULL);
arrange(NULL);