mirror of
https://github.com/eRgo35/dwm.git
synced 2025-12-16 21:56:10 +01:00
BREAKING-CHANGE: fresh start; all mods removed; synced to master
This commit is contained in:
@@ -21,7 +21,7 @@ alttab()
|
||||
|
||||
/* redraw tab */
|
||||
XRaiseWindow(dpy, alttabwin);
|
||||
drawtab(ntabs, 0, m);
|
||||
drawalttab(ntabs, 0, m);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -66,7 +66,7 @@ alttabend()
|
||||
}
|
||||
|
||||
void
|
||||
drawtab(int nwins, int first, Monitor *m)
|
||||
drawalttab(int nwins, int first, Monitor *m)
|
||||
{
|
||||
Client *c;
|
||||
int i, h;
|
||||
@@ -178,7 +178,7 @@ alttabstart(const Arg *arg)
|
||||
i++;
|
||||
}
|
||||
|
||||
drawtab(ntabs, 1, m);
|
||||
drawalttab(ntabs, 1, m);
|
||||
|
||||
struct timespec ts = { .tv_sec = 0, .tv_nsec = 1000000 };
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <time.h>
|
||||
|
||||
static void drawtab(int nwins, int first, Monitor *m);
|
||||
static void drawalttab(int nwins, int first, Monitor *m);
|
||||
static void alttabstart(const Arg *arg);
|
||||
static void alttabend();
|
||||
|
||||
81
patch/bar_launcher.c
Normal file
81
patch/bar_launcher.c
Normal file
@@ -0,0 +1,81 @@
|
||||
#if BAR_STATUS2D_PATCH
|
||||
int
|
||||
width_launcher(Bar *bar, BarArg *a)
|
||||
{
|
||||
int i, x = 0;
|
||||
|
||||
for (i = 0; i < LENGTH(launchers); i++) {
|
||||
x += status2dtextlength(launchers[i].name) + lrpad;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
int
|
||||
draw_launcher(Bar *bar, BarArg *a)
|
||||
{
|
||||
int i, w = 0;;
|
||||
|
||||
for (i = 0; i < LENGTH(launchers); i++) {
|
||||
w = status2dtextlength(launchers[i].name);
|
||||
drawstatusbar(a, launchers[i].name);
|
||||
a->x += w + lrpad;
|
||||
}
|
||||
|
||||
return a->x ;
|
||||
}
|
||||
|
||||
int
|
||||
click_launcher(Bar *bar, Arg *arg, BarArg *a)
|
||||
{
|
||||
int i, x = 0;
|
||||
|
||||
for (i = 0; i < LENGTH(launchers); i++) {
|
||||
x += status2dtextlength(launchers[i].name) + lrpad;
|
||||
if (a->x < x) {
|
||||
spawn(&launchers[i].command);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
int
|
||||
width_launcher(Bar *bar, BarArg *a)
|
||||
{
|
||||
int i, x = 0;
|
||||
|
||||
for (i = 0; i < LENGTH(launchers); i++) {
|
||||
x += TEXTW(launchers[i].name);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
int
|
||||
draw_launcher(Bar *bar, BarArg *a)
|
||||
{
|
||||
int i, x = 0, w = 0;;
|
||||
|
||||
for (i = 0; i < LENGTH(launchers); i++) {
|
||||
w = TEXTW(launchers[i].name);
|
||||
drw_text(drw, x, 0, w, bh, lrpad / 2, launchers[i].name, 0, True);
|
||||
x += w;
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
int
|
||||
click_launcher(Bar *bar, Arg *arg, BarArg *a)
|
||||
{
|
||||
int i, x = 0;
|
||||
|
||||
for (i = 0; i < LENGTH(launchers); i++) {
|
||||
x += TEXTW(launchers[i].name);
|
||||
if (a->x < x) {
|
||||
spawn(&launchers[i].command);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
#endif // BAR_STATUS2D_PATCH
|
||||
8
patch/bar_launcher.h
Normal file
8
patch/bar_launcher.h
Normal file
@@ -0,0 +1,8 @@
|
||||
typedef struct {
|
||||
char* name;
|
||||
const Arg command;
|
||||
} Launcher;
|
||||
|
||||
static int width_launcher(Bar *bar, BarArg *a);
|
||||
static int draw_launcher(Bar *bar, BarArg *a);
|
||||
static int click_launcher(Bar *bar, Arg *arg, BarArg *a);
|
||||
@@ -9,7 +9,7 @@ layoutmenu(const Arg *arg) {
|
||||
s = fgets(c, sizeof(c), p);
|
||||
pclose(p);
|
||||
|
||||
if (!s || *s == '\0' || c == '\0')
|
||||
if (!s || *s == '\0' || c[0] == '\0')
|
||||
return;
|
||||
|
||||
i = atoi(c);
|
||||
|
||||
@@ -15,4 +15,3 @@ click_ltsymbol(Bar *bar, Arg *arg, BarArg *a)
|
||||
{
|
||||
return ClkLtSymbol;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
static int width_ltsymbol(Bar *bar, BarArg *a);
|
||||
static int draw_ltsymbol(Bar *bar, BarArg *a);
|
||||
static int click_ltsymbol(Bar *bar, Arg *arg, BarArg *a);
|
||||
|
||||
|
||||
@@ -102,6 +102,65 @@ click_pwrl_tags(Bar *bar, Arg *arg, BarArg *a)
|
||||
if (i < NUMTAGS) {
|
||||
arg->ui = 1 << i;
|
||||
}
|
||||
#if BAR_TAGPREVIEW_PATCH
|
||||
if (selmon->previewshow != 0) {
|
||||
hidetagpreview(selmon);
|
||||
}
|
||||
#endif // BAR_TAGPREVIEW_PATCH
|
||||
return ClkTagBar;
|
||||
}
|
||||
|
||||
int
|
||||
hover_pwrl_tags(Bar *bar, BarArg *a, XMotionEvent *ev)
|
||||
{
|
||||
#if BAR_TAGPREVIEW_PATCH
|
||||
int i = 0, x = lrpad / 2;
|
||||
int px, py;
|
||||
int plw = drw->fonts->h / 2 + 1;
|
||||
Monitor *m = bar->mon;
|
||||
#if VANITYGAPS_PATCH
|
||||
int ov = gappov;
|
||||
int oh = gappoh;
|
||||
#else
|
||||
int ov = 0;
|
||||
int oh = 0;
|
||||
#endif // VANITYGAPS_PATCH
|
||||
|
||||
#if BAR_HIDEVACANTTAGS_PATCH
|
||||
Client *c;
|
||||
unsigned int occ = 0;
|
||||
for (c = bar->mon->clients; c; c = c->next)
|
||||
occ |= c->tags == 255 ? 0 : c->tags;
|
||||
#endif // BAR_HIDEVACANTTAGS_PATCH
|
||||
|
||||
do {
|
||||
#if BAR_HIDEVACANTTAGS_PATCH
|
||||
if (!(occ & 1 << i || bar->mon->tagset[bar->mon->seltags] & 1 << i))
|
||||
continue;
|
||||
#endif // BAR_HIDEVACANTTAGS_PATCH
|
||||
x += TEXTW(tagicon(bar->mon, i)) + plw;
|
||||
} while (a->x >= x && ++i < NUMTAGS);
|
||||
|
||||
if (i < NUMTAGS) {
|
||||
if ((i + 1) != selmon->previewshow && !(selmon->tagset[selmon->seltags] & 1 << i)) {
|
||||
if (bar->by > m->my + m->mh / 2) // bottom bar
|
||||
py = bar->by - m->mh / scalepreview - oh;
|
||||
else // top bar
|
||||
py = bar->by + bar->bh + oh;
|
||||
px = bar->bx + ev->x - m->mw / scalepreview / 2;
|
||||
if (px + m->mw / scalepreview > m->mx + m->mw)
|
||||
px = m->wx + m->ww - m->mw / scalepreview - ov;
|
||||
else if (px < bar->bx)
|
||||
px = m->wx + ov;
|
||||
selmon->previewshow = i + 1;
|
||||
showtagpreview(i, px, py);
|
||||
} else if (selmon->tagset[selmon->seltags] & 1 << i) {
|
||||
hidetagpreview(selmon);
|
||||
}
|
||||
} else if (selmon->previewshow != 0) {
|
||||
hidetagpreview(selmon);
|
||||
}
|
||||
#endif // BAR_TAGPREVIEW_PATCH
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
static int width_pwrl_tags(Bar *bar, BarArg *a);
|
||||
static int draw_pwrl_tags(Bar *bar, BarArg *a);
|
||||
static int click_pwrl_tags(Bar *bar, Arg *arg, BarArg *a);
|
||||
|
||||
static int hover_pwrl_tags(Bar *bar, BarArg *a, XMotionEvent *ev);
|
||||
|
||||
@@ -96,6 +96,7 @@ drawstatusbar(BarArg *a, char* stext)
|
||||
#else
|
||||
memcpy(text, stext, len);
|
||||
#endif // BAR_STATUSCMD_PATCH
|
||||
text[len] = '\0';
|
||||
|
||||
x += lrpad / 2;
|
||||
drw_setscheme(drw, scheme[LENGTH(colors)]);
|
||||
|
||||
@@ -94,6 +94,12 @@ draw_systray(Bar *bar, BarArg *a)
|
||||
i->mon = bar->mon;
|
||||
}
|
||||
|
||||
#if !BAR_ALPHA_PATCH
|
||||
wa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
|
||||
XChangeWindowAttributes(dpy, systray->win, CWBackPixel, &wa);
|
||||
XClearWindow(dpy, systray->win);
|
||||
#endif // BAR_ALPHA_PATCH
|
||||
|
||||
XMoveResizeWindow(dpy, systray->win, bar->bx + a->x + lrpad / 2, (w ? bar->by + a->y + (a->h - systray->h) / 2: -systray->h), MAX(w, 1), systray->h);
|
||||
return w;
|
||||
}
|
||||
|
||||
@@ -87,5 +87,55 @@ click_taglabels(Bar *bar, Arg *arg, BarArg *a)
|
||||
if (i < NUMTAGS) {
|
||||
arg->ui = 1 << i;
|
||||
}
|
||||
#if BAR_TAGPREVIEW_PATCH
|
||||
if (selmon->previewshow != 0) {
|
||||
hidetagpreview(selmon);
|
||||
}
|
||||
#endif // BAR_TAGPREVIEW_PATCH
|
||||
return ClkTagBar;
|
||||
}
|
||||
|
||||
int
|
||||
hover_taglabels(Bar *bar, BarArg *a, XMotionEvent *ev)
|
||||
{
|
||||
#if BAR_TAGPREVIEW_PATCH
|
||||
int i = 0, x = lrpad / 2;
|
||||
int px, py;
|
||||
Monitor *m = bar->mon;
|
||||
#if VANITYGAPS_PATCH
|
||||
int ov = gappov;
|
||||
int oh = gappoh;
|
||||
#else
|
||||
int ov = 0;
|
||||
int oh = 0;
|
||||
#endif // VANITYGAPS_PATCH
|
||||
|
||||
do {
|
||||
if (!m->taglabel[i][0])
|
||||
continue;
|
||||
x += TEXTW(m->taglabel[i]);
|
||||
} while (a->x >= x && ++i < NUMTAGS);
|
||||
|
||||
if (i < NUMTAGS) {
|
||||
if ((i + 1) != selmon->previewshow && !(selmon->tagset[selmon->seltags] & 1 << i)) {
|
||||
if (bar->by > m->my + m->mh / 2) // bottom bar
|
||||
py = bar->by - m->mh / scalepreview - oh;
|
||||
else // top bar
|
||||
py = bar->by + bar->bh + oh;
|
||||
px = bar->bx + ev->x - m->mw / scalepreview / 2;
|
||||
if (px + m->mw / scalepreview > m->mx + m->mw)
|
||||
px = m->wx + m->ww - m->mw / scalepreview - ov;
|
||||
else if (px < bar->bx)
|
||||
px = m->wx + ov;
|
||||
selmon->previewshow = i + 1;
|
||||
showtagpreview(i, px, py);
|
||||
} else if (selmon->tagset[selmon->seltags] & 1 << i) {
|
||||
hidetagpreview(selmon);
|
||||
}
|
||||
} else if (selmon->previewshow != 0) {
|
||||
hidetagpreview(selmon);
|
||||
}
|
||||
#endif // BAR_TAGPREVIEW_PATCH
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -2,4 +2,5 @@
|
||||
|
||||
static int width_taglabels(Bar *bar, BarArg *a);
|
||||
static int draw_taglabels(Bar *bar, BarArg *a);
|
||||
static int click_taglabels(Bar *bar, Arg *arg, BarArg *a);
|
||||
static int click_taglabels(Bar *bar, Arg *arg, BarArg *a);
|
||||
static int hover_taglabels(Bar *bar, BarArg *a, XMotionEvent *ev);
|
||||
|
||||
@@ -88,6 +88,11 @@ click_tags(Bar *bar, Arg *arg, BarArg *a)
|
||||
if (i < NUMTAGS) {
|
||||
arg->ui = 1 << i;
|
||||
}
|
||||
#if BAR_TAGPREVIEW_PATCH
|
||||
if (selmon->previewshow != 0) {
|
||||
hidetagpreview(selmon);
|
||||
}
|
||||
#endif // BAR_TAGPREVIEW_PATCH
|
||||
return ClkTagBar;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ togglewin(const Arg *arg)
|
||||
Client *c = (Client*)arg->v;
|
||||
if (!c)
|
||||
return;
|
||||
if (c == selmon->sel)
|
||||
if (!HIDDEN(c) && c == selmon->sel)
|
||||
hide(c);
|
||||
else {
|
||||
if (HIDDEN(c))
|
||||
|
||||
@@ -22,8 +22,8 @@ combotag(const Arg *arg)
|
||||
combo = 1;
|
||||
selmon->sel->tags = arg->ui & TAGMASK;
|
||||
}
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
focus(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,10 +22,10 @@ distributetags(const Arg *arg)
|
||||
#if TAGSYNC_PATCH
|
||||
}
|
||||
selmon = origselmon;
|
||||
focus(NULL);
|
||||
arrange(NULL);
|
||||
#else
|
||||
focus(NULL);
|
||||
#else
|
||||
arrange(selmon);
|
||||
focus(NULL);
|
||||
#endif // TAGSYNC_PATCH
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ case $# in
|
||||
transferall) ;&
|
||||
togglealttag) ;&
|
||||
togglebar) ;&
|
||||
toggletopbar) ;&
|
||||
togglefloating) ;&
|
||||
togglefullscreen) ;&
|
||||
fullscreen) ;&
|
||||
|
||||
@@ -6,8 +6,8 @@ tagtoleft(const Arg *arg)
|
||||
&& __builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1
|
||||
&& selmon->tagset[selmon->seltags] > 1) {
|
||||
selmon->sel->tags >>= 1;
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
focus(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ tagtoright(const Arg *arg)
|
||||
&& __builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1
|
||||
&& selmon->tagset[selmon->seltags] & (MASK >> 1)) {
|
||||
selmon->sel->tags <<= 1;
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
focus(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
9
patch/focusfollowmouse.c
Normal file
9
patch/focusfollowmouse.c
Normal file
@@ -0,0 +1,9 @@
|
||||
Client *
|
||||
getpointerclient(void)
|
||||
{
|
||||
Window dummy, win;
|
||||
int di;
|
||||
unsigned int dui;
|
||||
XQueryPointer(dpy, root, &dummy, &win, &di, &di, &di, &di, &dui);
|
||||
return wintoclient(win);
|
||||
}
|
||||
1
patch/focusfollowmouse.h
Normal file
1
patch/focusfollowmouse.h
Normal file
@@ -0,0 +1 @@
|
||||
static Client *getpointerclient(void);
|
||||
@@ -1,14 +1,42 @@
|
||||
void
|
||||
focusmaster(const Arg *arg)
|
||||
{
|
||||
Client *c;
|
||||
Client *master;
|
||||
Monitor *m = selmon;
|
||||
#if FOCUSMASTER_RETURN_PATCH
|
||||
int i;
|
||||
#endif // FOCUSMASTER_RETURN_PATCH
|
||||
|
||||
if (selmon->nmaster < 1)
|
||||
if (m->nmaster < 1)
|
||||
return;
|
||||
#if !FAKEFULLSCREEN_PATCH
|
||||
#if FAKEFULLSCREEN_CLIENT_PATCH
|
||||
if (!m->sel || (m->sel->isfullscreen && m->sel->fakefullscreen != 1 && lockfullscreen))
|
||||
return;
|
||||
#else
|
||||
if (!m->sel || (m->sel->isfullscreen && lockfullscreen))
|
||||
return;
|
||||
#endif // FAKEFULLSCREEN_CLIENT_PATCH
|
||||
#endif // FAKEFULLSCREEN_PATCH
|
||||
|
||||
master = nexttiled(m->clients);
|
||||
|
||||
if (!master)
|
||||
return;
|
||||
|
||||
c = nexttiled(selmon->clients);
|
||||
#if FOCUSMASTER_RETURN_PATCH
|
||||
for (i = 0; !(m->tagset[m->seltags] & 1 << i); i++);
|
||||
i++;
|
||||
|
||||
if (c)
|
||||
focus(c);
|
||||
if (m->sel == master) {
|
||||
if (m->tagmarked[i] && ISVISIBLE(m->tagmarked[i]))
|
||||
focus(m->tagmarked[i]);
|
||||
} else {
|
||||
m->tagmarked[i] = m->sel;
|
||||
focus(master);
|
||||
}
|
||||
#else
|
||||
focus(master);
|
||||
#endif // FOCUSMASTER_RETURN_PATCH
|
||||
restack(m);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
#if COMBO_PATCH
|
||||
#include "combo.c"
|
||||
#endif
|
||||
#if BAR_LAUNCHER_PATCH
|
||||
#include "bar_launcher.c"
|
||||
#endif
|
||||
#if BAR_LTSYMBOL_PATCH
|
||||
#include "bar_ltsymbol.c"
|
||||
#endif
|
||||
@@ -151,7 +154,10 @@
|
||||
#if FOCUSDIR_PATCH
|
||||
#include "focusdir.c"
|
||||
#endif
|
||||
#if FOCUSMASTER_PATCH
|
||||
#if FOCUSFOLLOWMOUSE_PATCH
|
||||
#include "focusfollowmouse.c"
|
||||
#endif
|
||||
#if FOCUSMASTER_PATCH || FOCUSMASTER_RETURN_PATCH
|
||||
#include "focusmaster.c"
|
||||
#endif
|
||||
#if FOCUSURGENT_PATCH
|
||||
@@ -205,6 +211,9 @@
|
||||
#if PERTAG_PATCH
|
||||
#include "pertag.c"
|
||||
#endif
|
||||
#if PLACEDIR_PATCH
|
||||
#include "placedir.c"
|
||||
#endif
|
||||
#if PLACEMOUSE_PATCH
|
||||
#include "placemouse.c"
|
||||
#endif
|
||||
@@ -310,6 +319,9 @@
|
||||
#if TOGGLEFULLSCREEN_PATCH
|
||||
#include "togglefullscreen.c"
|
||||
#endif
|
||||
#if TOGGLETOPBAR_PATCH
|
||||
#include "toggletopbar.c"
|
||||
#endif
|
||||
#if TRANSFER_PATCH
|
||||
#include "transfer.c"
|
||||
#endif
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
#if BAR_HOLDBAR_PATCH
|
||||
#include "bar_holdbar.h"
|
||||
#endif
|
||||
#if BAR_LAUNCHER_PATCH
|
||||
#include "bar_launcher.h"
|
||||
#endif
|
||||
#if BAR_LTSYMBOL_PATCH
|
||||
#include "bar_ltsymbol.h"
|
||||
#endif
|
||||
@@ -154,7 +157,10 @@
|
||||
#if FOCUSADJACENTTAG_PATCH
|
||||
#include "focusadjacenttag.h"
|
||||
#endif
|
||||
#if FOCUSMASTER_PATCH
|
||||
#if FOCUSFOLLOWMOUSE_PATCH
|
||||
#include "focusfollowmouse.h"
|
||||
#endif
|
||||
#if FOCUSMASTER_PATCH || FOCUSMASTER_RETURN_PATCH
|
||||
#include "focusmaster.h"
|
||||
#endif
|
||||
#if FOCUSURGENT_PATCH
|
||||
@@ -204,6 +210,9 @@
|
||||
#if PERTAG_PATCH
|
||||
#include "pertag.h"
|
||||
#endif
|
||||
#if PLACEDIR_PATCH
|
||||
#include "placedir.h"
|
||||
#endif
|
||||
#if PLACEMOUSE_PATCH
|
||||
#include "placemouse.h"
|
||||
#endif
|
||||
@@ -312,6 +321,9 @@
|
||||
#if TOGGLEFULLSCREEN_PATCH
|
||||
#include "togglefullscreen.h"
|
||||
#endif
|
||||
#if TOGGLETOPBAR_PATCH
|
||||
#include "toggletopbar.h"
|
||||
#endif
|
||||
#if TRANSFER_PATCH
|
||||
#include "transfer.h"
|
||||
#endif
|
||||
|
||||
@@ -643,7 +643,7 @@ arrange_tatami(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n, in
|
||||
if (j < ai + cats) {
|
||||
/* Arrange cats (all excess clients that can't be tiled as mats). Cats sleep on mats. */
|
||||
|
||||
switch (cats) {
|
||||
switch (cats) {
|
||||
case 1: // fill
|
||||
break;
|
||||
case 2: // up and down
|
||||
|
||||
@@ -21,7 +21,7 @@ struct Pertag {
|
||||
#endif // ZOOMSWAP_PATCH
|
||||
#if PERTAG_VANITYGAPS_PATCH && VANITYGAPS_PATCH
|
||||
int enablegaps[NUMTAGS + 1];
|
||||
unsigned int gaps[NUMTAGS + 1];
|
||||
int gaps[NUMTAGS + 1];
|
||||
#endif // PERTAG_VANITYGAPS_PATCH | VANITYGAPS_PATCH
|
||||
};
|
||||
|
||||
|
||||
96
patch/placedir.c
Normal file
96
patch/placedir.c
Normal file
@@ -0,0 +1,96 @@
|
||||
void
|
||||
placedir(const Arg *arg)
|
||||
{
|
||||
Client *s = selmon->sel, *f = NULL, *c, *next, *fprior, *sprior;
|
||||
|
||||
if (!s || s->isfloating)
|
||||
return;
|
||||
|
||||
unsigned int score = -1;
|
||||
unsigned int client_score;
|
||||
int dist;
|
||||
int dirweight = 20;
|
||||
|
||||
next = s->next;
|
||||
if (!next)
|
||||
next = s->mon->clients;
|
||||
for (c = next; c != s; c = next) {
|
||||
|
||||
next = c->next;
|
||||
if (!next)
|
||||
next = s->mon->clients;
|
||||
|
||||
if (!ISVISIBLE(c)) // || HIDDEN(c)
|
||||
continue;
|
||||
|
||||
switch (arg->i) {
|
||||
case 0: // left
|
||||
dist = s->x - c->x - c->w;
|
||||
client_score =
|
||||
dirweight * MIN(abs(dist), abs(dist + s->mon->ww)) +
|
||||
abs(s->y - c->y);
|
||||
break;
|
||||
case 1: // right
|
||||
dist = c->x - s->x - s->w;
|
||||
client_score =
|
||||
dirweight * MIN(abs(dist), abs(dist + s->mon->ww)) +
|
||||
abs(c->y - s->y);
|
||||
break;
|
||||
case 2: // up
|
||||
dist = s->y - c->y - c->h;
|
||||
client_score =
|
||||
dirweight * MIN(abs(dist), abs(dist + s->mon->wh)) +
|
||||
abs(s->x - c->x);
|
||||
break;
|
||||
default:
|
||||
case 3: // down
|
||||
dist = c->y - s->y - s->h;
|
||||
client_score =
|
||||
dirweight * MIN(abs(dist), abs(dist + s->mon->wh)) +
|
||||
abs(c->x - s->x);
|
||||
break;
|
||||
}
|
||||
|
||||
if (((arg->i == 0 || arg->i == 2) && client_score <= score) || client_score < score) {
|
||||
score = client_score;
|
||||
f = c;
|
||||
}
|
||||
}
|
||||
|
||||
if (f && f != s) {
|
||||
for (fprior = f->mon->clients; fprior && fprior->next != f; fprior = fprior->next);
|
||||
for (sprior = s->mon->clients; sprior && sprior->next != s; sprior = sprior->next);
|
||||
|
||||
if (s == fprior) {
|
||||
next = f->next;
|
||||
if (sprior)
|
||||
sprior->next = f;
|
||||
else
|
||||
f->mon->clients = f;
|
||||
f->next = s;
|
||||
s->next = next;
|
||||
} else if (f == sprior) {
|
||||
next = s->next;
|
||||
if (fprior)
|
||||
fprior->next = s;
|
||||
else
|
||||
s->mon->clients = s;
|
||||
s->next = f;
|
||||
f->next = next;
|
||||
} else { // clients are not adjacent to each other
|
||||
next = f->next;
|
||||
f->next = s->next;
|
||||
s->next = next;
|
||||
if (fprior)
|
||||
fprior->next = s;
|
||||
else
|
||||
s->mon->clients = s;
|
||||
if (sprior)
|
||||
sprior->next = f;
|
||||
else
|
||||
f->mon->clients = f;
|
||||
}
|
||||
|
||||
arrange(f->mon);
|
||||
}
|
||||
}
|
||||
1
patch/placedir.h
Normal file
1
patch/placedir.h
Normal file
@@ -0,0 +1 @@
|
||||
static void placedir(const Arg *arg);
|
||||
@@ -66,12 +66,13 @@ togglescratch(const Arg *arg)
|
||||
if (c->scratchkey != ((char**)arg->v)[0][0])
|
||||
continue;
|
||||
|
||||
/* awesomebar / wintitleactions compatibility, unhide scratchpad if hidden
|
||||
#if BAR_WINTITLEACTIONS_PATCH
|
||||
/* unhide scratchpad if hidden */
|
||||
if (HIDDEN(c)) {
|
||||
XMapWindow(dpy, c->win);
|
||||
setclientstate(c, NormalState);
|
||||
}
|
||||
*/
|
||||
#endif // BAR_WINTITLEACTIONS_PATCH
|
||||
|
||||
/* Record the first found scratchpad client for focus purposes, but prioritise the
|
||||
scratchpad on the current monitor if one exists */
|
||||
|
||||
@@ -62,8 +62,8 @@ togglescratch(const Arg *arg)
|
||||
if (found) {
|
||||
if (newtagset) {
|
||||
selmon->tagset[selmon->seltags] = newtagset;
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
focus(NULL);
|
||||
}
|
||||
if (ISVISIBLE(found)) {
|
||||
focus(found);
|
||||
|
||||
@@ -6,8 +6,8 @@ scratchpad_hide()
|
||||
if (selmon->sel) {
|
||||
selmon->sel->tags = SCRATCHPAD_MASK;
|
||||
selmon->sel->isfloating = 1;
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
focus(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ scratchpad_show()
|
||||
|
||||
if (scratchpad_last_showed->tags != SCRATCHPAD_MASK) {
|
||||
scratchpad_last_showed->tags = SCRATCHPAD_MASK;
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
focus(NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,12 +39,12 @@ persistclientstate(Client *c)
|
||||
int
|
||||
restoreclientstate(Client *c)
|
||||
{
|
||||
return getclienttags(c)
|
||||
| getclientfields(c)
|
||||
#if SAVEFLOATS_PATCH
|
||||
| restorewindowfloatposition(c, c->mon ? c->mon : selmon)
|
||||
#endif // SAVEFLOATS_PATCH
|
||||
;
|
||||
int restored = getclientfields(c);
|
||||
getclienttags(c);
|
||||
#if SAVEFLOATS_PATCH
|
||||
restorewindowfloatposition(c, c->mon ? c->mon : selmon);
|
||||
#endif // SAVEFLOATS_PATCH
|
||||
return restored;
|
||||
}
|
||||
|
||||
void setmonitorfields(Monitor *m)
|
||||
|
||||
@@ -15,13 +15,15 @@ setborderpx(const Arg *arg)
|
||||
int delta = 2 * (m->borderpx - prev_borderpx);
|
||||
|
||||
#if BAR_BORDER_PATCH
|
||||
for (bar = m->bar; bar; bar = bar->next) {
|
||||
bar->bh = bar->bh - 2 * bar->borderpx + 2 * m->borderpx;
|
||||
bar->borderpx = m->borderpx;
|
||||
if (!barborderpx) {
|
||||
for (bar = m->bar; bar; bar = bar->next) {
|
||||
bar->bh = bar->bh - 2 * bar->borderpx + 2 * m->borderpx;
|
||||
bar->borderpx = m->borderpx;
|
||||
}
|
||||
updatebarpos(m);
|
||||
for (bar = m->bar; bar; bar = bar->next)
|
||||
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
|
||||
}
|
||||
updatebarpos(m);
|
||||
for (bar = m->bar; bar; bar = bar->next)
|
||||
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
|
||||
#endif // BAR_BORDER_PATCH
|
||||
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
|
||||
@@ -6,7 +6,7 @@ shift(const Arg *arg, int clients)
|
||||
unsigned int tagmask = 0;
|
||||
|
||||
#if SCRATCHPADS_PATCH && !RENAMED_SCRATCHPADS_PATCH
|
||||
shifted.ui = selmon->tagset[selmon->seltags];
|
||||
shifted.ui = selmon->tagset[selmon->seltags] & ~SPTAGMASK;
|
||||
#else
|
||||
shifted.ui = selmon->tagset[selmon->seltags];
|
||||
#endif // SCRATCHPADS_PATCH
|
||||
@@ -18,6 +18,10 @@ shift(const Arg *arg, int clients)
|
||||
for (c = selmon->clients; c && clients; c = c->next) {
|
||||
if (c == selmon->sel)
|
||||
continue;
|
||||
#if STICKY_PATCH
|
||||
if (c->issticky)
|
||||
continue;
|
||||
#endif // STICKY_PATCH
|
||||
#if SCRATCHPADS_PATCH && !RENAMED_SCRATCHPADS_PATCH
|
||||
if (!(c->tags & SPTAGMASK))
|
||||
tagmask |= c->tags;
|
||||
|
||||
@@ -13,6 +13,9 @@ swallow(Client *p, Client *c)
|
||||
{
|
||||
Client *s;
|
||||
XWindowChanges wc;
|
||||
#if NOBORDER_PATCH
|
||||
int border_padding = 0;
|
||||
#endif // NOBORDER_PATCH
|
||||
|
||||
if (c->noswallow > 0 || c->isterminal)
|
||||
return 0;
|
||||
@@ -46,9 +49,21 @@ swallow(Client *p, Client *c)
|
||||
setfloatinghint(s);
|
||||
#endif // BAR_EWMHTAGS_PATCH
|
||||
|
||||
#if NOBORDER_PATCH
|
||||
wc.border_width = p->bw;
|
||||
if (noborder(p)) {
|
||||
wc.border_width = 0;
|
||||
border_padding = p->bw * 2;
|
||||
}
|
||||
|
||||
XConfigureWindow(dpy, p->win, CWBorderWidth, &wc);
|
||||
XMoveResizeWindow(dpy, p->win, s->x, s->y, s->w + border_padding, s->h + border_padding);
|
||||
#else
|
||||
wc.border_width = p->bw;
|
||||
XConfigureWindow(dpy, p->win, CWBorderWidth, &wc);
|
||||
XMoveResizeWindow(dpy, p->win, s->x, s->y, s->w, s->h);
|
||||
#endif // NOBORDER_PATCH
|
||||
|
||||
#if !BAR_FLEXWINTITLE_PATCH
|
||||
XSetWindowBorder(dpy, p->win, scheme[SchemeNorm][ColBorder].pixel);
|
||||
#endif // BAR_FLEXWINTITLE_PATCH
|
||||
@@ -65,6 +80,9 @@ unswallow(Client *c)
|
||||
{
|
||||
XWindowChanges wc;
|
||||
c->win = c->swallowing->win;
|
||||
#if NOBORDER_PATCH
|
||||
int border_padding = 0;
|
||||
#endif // NOBORDER_PATCH
|
||||
|
||||
free(c->swallowing);
|
||||
c->swallowing = NULL;
|
||||
@@ -80,9 +98,20 @@ unswallow(Client *c)
|
||||
arrange(c->mon);
|
||||
XMapWindow(dpy, c->win);
|
||||
|
||||
#if NOBORDER_PATCH
|
||||
wc.border_width = c->bw;
|
||||
if (noborder(c)) {
|
||||
wc.border_width = 0;
|
||||
border_padding = c->bw * 2;
|
||||
}
|
||||
|
||||
XConfigureWindow(dpy, c->win, CWBorderWidth, &wc);
|
||||
XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w + border_padding, c->h + border_padding);
|
||||
#else
|
||||
wc.border_width = c->bw;
|
||||
XConfigureWindow(dpy, c->win, CWBorderWidth, &wc);
|
||||
XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
|
||||
#endif // NOBORDER_PATCH
|
||||
#if !BAR_FLEXWINTITLE_PATCH
|
||||
XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel);
|
||||
#endif // BAR_FLEXWINTITLE_PATCH
|
||||
@@ -91,8 +120,8 @@ unswallow(Client *c)
|
||||
setfloatinghint(c);
|
||||
#endif // BAR_EWMHTAGS_PATCH
|
||||
setclientstate(c, NormalState);
|
||||
focus(NULL);
|
||||
arrange(c->mon);
|
||||
focus(NULL);
|
||||
}
|
||||
|
||||
pid_t
|
||||
|
||||
@@ -43,7 +43,7 @@ tagallmon(const Arg *arg)
|
||||
}
|
||||
}
|
||||
|
||||
focus(NULL);
|
||||
arrange(NULL);
|
||||
focus(NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,8 @@ tagothermon(const Arg *arg, int dir)
|
||||
sendmon(sel, newmon);
|
||||
if (arg->ui & TAGMASK) {
|
||||
sel->tags = arg->ui & TAGMASK;
|
||||
focus(NULL);
|
||||
arrange(newmon);
|
||||
focus(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ tagswapmon(const Arg *arg)
|
||||
}
|
||||
}
|
||||
|
||||
focus(NULL);
|
||||
arrange(NULL);
|
||||
focus(NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,15 @@ resizemousescroll(const Arg *arg)
|
||||
|
||||
if (!(c = selmon->sel))
|
||||
return;
|
||||
#if !FAKEFULLSCREEN_PATCH
|
||||
#if FAKEFULLSCREEN_CLIENT_PATCH
|
||||
if (c->isfullscreen && c->fakefullscreen != 1) /* no support resizing fullscreen windows by mouse */
|
||||
return;
|
||||
#else
|
||||
if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */
|
||||
return;
|
||||
#endif // FAKEFULLSCREEN_CLIENT_PATCH
|
||||
#endif // !FAKEFULLSCREEN_PATCH
|
||||
restack(selmon);
|
||||
if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
||||
None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess)
|
||||
|
||||
20
patch/toggletopbar.c
Normal file
20
patch/toggletopbar.c
Normal file
@@ -0,0 +1,20 @@
|
||||
void
|
||||
toggletopbar(const Arg *arg)
|
||||
{
|
||||
Bar *bar;
|
||||
Monitor *m = selmon;
|
||||
|
||||
for (bar = m->bar; bar; bar = bar->next)
|
||||
bar->topbar = !bar->topbar;
|
||||
|
||||
if (!m->showbar) {
|
||||
togglebar(NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
updatebarpos(m);
|
||||
|
||||
for (bar = m->bar; bar; bar = bar->next)
|
||||
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
|
||||
arrange(m);
|
||||
}
|
||||
1
patch/toggletopbar.h
Normal file
1
patch/toggletopbar.h
Normal file
@@ -0,0 +1 @@
|
||||
static void toggletopbar(const Arg *arg);
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Settings */
|
||||
#if !PERTAG_VANITYGAPS_PATCH
|
||||
#if !(PERTAG_VANITYGAPS_PATCH || PERMON_VANITYGAPS_PATCH)
|
||||
static int enablegaps = 1;
|
||||
#endif // PERTAG_VANITYGAPS_PATCH
|
||||
|
||||
@@ -69,10 +69,12 @@ setgapsex(const Arg *arg)
|
||||
#if PERTAG_VANITYGAPS_PATCH && PERTAG_PATCH
|
||||
if (!selmon->pertag->enablegaps[selmon->pertag->curtag])
|
||||
selmon->pertag->enablegaps[selmon->pertag->curtag] = 1;
|
||||
#elif PERMON_VANITYGAPS_PATCH
|
||||
selmon->enablegaps = 1;
|
||||
#else
|
||||
if (!enablegaps)
|
||||
enablegaps = 1;
|
||||
#endif // PERTAG_VANITYGAPS_PATCH
|
||||
#endif // PERTAG_VANITYGAPS_PATCH | PERMON_VANITYGAPS_PATCH
|
||||
|
||||
setgaps(oh, ov, ih, iv);
|
||||
}
|
||||
@@ -83,24 +85,35 @@ togglegaps(const Arg *arg)
|
||||
{
|
||||
#if PERTAG_VANITYGAPS_PATCH && PERTAG_PATCH
|
||||
selmon->pertag->enablegaps[selmon->pertag->curtag] = !selmon->pertag->enablegaps[selmon->pertag->curtag];
|
||||
#elif PERMON_VANITYGAPS_PATCH
|
||||
selmon->enablegaps = !selmon->enablegaps;
|
||||
#else
|
||||
enablegaps = !enablegaps;
|
||||
#endif // PERTAG_VANITYGAPS_PATCH
|
||||
#endif // PERTAG_VANITYGAPS_PATCH | PERMON_VANITYGAPS_PATCH
|
||||
|
||||
#if BAR_PADDING_VANITYGAPS_PATCH
|
||||
#if PERMON_VANITYGAPS_PATCH
|
||||
updatebarpos(selmon);
|
||||
for (Bar *bar = selmon->bar; bar; bar = bar->next)
|
||||
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
|
||||
#else
|
||||
for (Monitor *m = mons; m; m = m->next) {
|
||||
updatebarpos(m);
|
||||
for (Bar *bar = m->bar; bar; bar = bar->next)
|
||||
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
|
||||
}
|
||||
#endif // PERMON_VANITYGAPS_PATCH
|
||||
|
||||
#if BAR_SYSTRAY_PATCH
|
||||
drawbarwin(systray->bar);
|
||||
#endif // BAR_SYSTRAY_PATCH
|
||||
#endif // BAR_PADDING_VANITYGAPS_PATCH
|
||||
#if PERTAG_VANITYGAPS_PATCH && PERTAG_PATCH
|
||||
|
||||
#if (PERTAG_VANITYGAPS_PATCH && PERTAG_PATCH) || PERMON_VANITYGAPS_PATCH
|
||||
arrange(selmon);
|
||||
#else
|
||||
arrange(NULL);
|
||||
#endif // PERTAG_VANITYGAPS_PATCH
|
||||
#endif // PERTAG_VANITYGAPS_PATCH | PERMON_VANITYGAPS_PATCH
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -193,9 +206,11 @@ getgaps(Monitor *m, int *oh, int *ov, int *ih, int *iv, unsigned int *nc)
|
||||
unsigned int n, oe, ie;
|
||||
#if PERTAG_VANITYGAPS_PATCH && PERTAG_PATCH
|
||||
oe = ie = m->pertag->enablegaps[m->pertag->curtag];
|
||||
#elif PERMON_VANITYGAPS_PATCH
|
||||
oe = ie = m->enablegaps;
|
||||
#else
|
||||
oe = ie = enablegaps;
|
||||
#endif // PERTAG_VANITYGAPS_PATCH
|
||||
#endif // PERTAG_VANITYGAPS_PATCH | PERMON_VANITYGAPS_PATCH
|
||||
Client *c;
|
||||
|
||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||
|
||||
@@ -132,7 +132,11 @@ xrdb(const Arg *arg)
|
||||
#endif // BAR_ALPHA_PATCH
|
||||
ColCount
|
||||
);
|
||||
focus(NULL);
|
||||
#if BAR_SYSTRAY_PATCH && !BAR_ALPHA_PATCH
|
||||
if (systray) {
|
||||
XMoveWindow(dpy, systray->win, -32000, -32000);
|
||||
}
|
||||
#endif // BAR_SYSTRAY_PATCH
|
||||
arrange(NULL);
|
||||
focus(NULL);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user