Implement modified, slimmed down version of flextile_deluxe

This commit is contained in:
speedie 2022-11-16 20:48:35 +01:00
parent 259dc8e0bb
commit 5f898f0193
12 changed files with 1117 additions and 592 deletions

View file

@ -151,13 +151,11 @@
- speedwm.icon.spacing: 5 ! Spacing between icon and text in the taskbar (<num>)
!@
!! Layout options
!! Deck layout
!@
- speedwm.layout.deck.count: 0 ! Enable deck count in the deck layout (0/1)
!@
- speedwm.layout.deck.format: [%d]
!@
!@
- speedwm.layout.dgrid.forcevsplit: 1 ! Force vertical splits in the dynamic grid layout (0/1)
!@
!! Monocle layout
!@

View file

@ -4,7 +4,7 @@
- 4 - Switch to the Grid layout
- 5 - Switch to the Deck layout
- 6 - Switch to the Centered Master layout
- 7 - Switch to the Centered Floating Master layout
- 7 - Switch to the Tatami layout
- 8 - Switch to the Fibonacci Spiral layout
- 9 - Switch to the Fibonacci Dwindle layout
- 10 - Switch to the Bottom Stack Vertical layout
@ -99,4 +99,15 @@
- 99 - Reset vertical barpadding
- 100 - Reset horizontal barpadding
- 101 - Reset vertical and horizontal barpadding
- 102 - Increase stack count by 1
- 103 - Decrease stack count by 1
- 104 - Rotate forward in the layout axis
- 105 - Rotate forward in the master axis
- 106 - Rotate forward in the stack axis
- 107 - Rotate forward in the secondary stack axis
- 108 - Rotate backwards in the layout axis
- 109 - Rotate backwards in the master axis
- 110 - Rotate backwards in the stack axis
- 111 - Rotate backwards in the secondary stack axis
- 112 - Mirror the layout

View file

@ -77,6 +77,9 @@
- Super+Control+w - Increases your volume
- Super+Control+e - Decreases your volume
- Super+Control+0 - Tag all tags at once.
- Super+Control+Enter - Mirror the layout
- Super+Control+i - Increase stackcount by 1
- Super+Control+u - Decrease stack count by 1
- Super+Control+z/x - Increase/decrease gaps between windows by 5
- Super+Control+j/k - Move focus between hidden windows (Can then 'Show')
- Super+Control+Arrow - Moves a window to any corner of your screen (Arrow key)

4
draw.c
View file

@ -337,8 +337,8 @@ int
drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert, Bool markup)
{
char buf[1024];
int ty, th;
unsigned int ew, eh;
int ty, th = 0;
unsigned int ew = 0, eh = 0;
XftDraw *d = NULL;
size_t i, len;

View file

@ -14,7 +14,8 @@ PAGEDIR = "/home/anon/Projects/page-improved/projects"
# If you use GNU/Linux, uncomment these lines (remove the # at the start of the line below)
FREETYPELIBS = -lfontconfig -lXft
FREETYPEINC = /usr/include/freetype2
CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Wno-unused-variable -Wno-unused-result -Wno-unused-function -Ofast -march=native ${INCS} ${CPPFLAGS}
EXCFLAGS = -Wno-unused-variable -Wno-unused-function
CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Wno-unused-result -Ofast -march=native ${INCS} ${CPPFLAGS} ${EXCFLAGS}
LDFLAGS = ${LIBS} -g
# OpenBSD support

View file

@ -110,6 +110,7 @@ static Key keys[] = {
{ MODIFIER1|CONTROL|SHIFT, -1, XK_j, setcfact, {.f = -0.25} },
{ MODIFIER1|CONTROL|SHIFT, -1, XK_0, setcfact, {.f = 0.00} },
{ MODIFIER1, -1, XK_Return, zoom, {0} },
{ MODIFIER1|CONTROL, -1, XK_Return, mirrorlayout, {0} },
{ MODIFIER1|SHIFT, -1, XK_q, killclient, {0} },
{ MODIFIER1|SHIFT, -1, XK_space, togglefloating, {0} },
{ MODIFIER1|CONTROL, -1, XK_0, view, {.ui = ~0 } },
@ -130,6 +131,8 @@ static Key keys[] = {
#if USESWITCHER
{ MODIFIER1, -1, XK_Tab, switcherstart, {0} },
#endif
{ MODIFIER1|CONTROL, -1, XK_i, incstackcount, {.i = +1 } },
{ MODIFIER1|CONTROL, -1, XK_u, incstackcount, {.i = -1 } },
/* Floating mode keybinds */
{ MODIFIER1, -1, XK_w, moveresizeaspect, {.i = +24} },

1328
layouts.c

File diff suppressed because it is too large Load diff

View file

@ -49,7 +49,7 @@
* - If you want to modify mouse binds, edit mouse.h.
* - If you want to extensively change alpha and color options (probably not necessary), you can modify the colors.h header.
*
* The goal of this is to decrease the size of headers and make it easier to find what you want to find, because if I were to combine all of this into one big file, it would be really difficult to hack on it (see dwm-flexipatch for an example).
* The goal of this is to decrease the size of headers and make it easier to find what you want to find, because if I were to combine all of this into one big file, it would be really difficult to hack on it (see dwm-tileipatch for an example).
*
* Also note that:
*
@ -80,7 +80,8 @@
/* Window alignment options */
static int bordersize = 1; /* How big your border is in pixels */
static int snap = 20; /* Snap pixel */
static int mastercount = 1; /* Number of masters */
static int mastercount = 1; /* Number of clients in the master area */
static int stackcount = 0; /* Number of clients in the stack area */
static int resizehints = 0; /* Show resize hints */
static int decorhints = 1; /* Respect decoration hints */
static int savefloat = 1; /* Save position of floating windows */
@ -235,9 +236,6 @@ static char monocleformat[] = "[%d/%d]"; /* Format of the mono
static int deckcount = 0; /* Display deck count in the deck layout */
static char deckformat[] = "[%d]"; /* Format of the deck count. deckcount must be set to 1 for this to be used. */
/* Dynamic Grid layout */
static int forcevsplit = 1; /* Force two clients to always split vertically in the dynamic grid layout */
/* Custom layout */
#define customhistfile ".config/speedwm/history" /* History file */
#define customprompt "dmenu -i -l 10 -p 'Enter an S expression >' <" /* Run launcher to use for the custom layout */

View file

@ -11,7 +11,7 @@ static Signal signals[] = {
{ 4, setlayout, {.v = &layouts[3]} }, /* Grid layout */
{ 5, setlayout, {.v = &layouts[4]} }, /* Deck layout */
{ 6, setlayout, {.v = &layouts[5]} }, /* Centered Master layout */
{ 7, setlayout, {.v = &layouts[6]} }, /* Centered Floating Master layout */
{ 7, setlayout, {.v = &layouts[6]} }, /* Tatami layout */
{ 8, setlayout, {.v = &layouts[7]} }, /* Fibonacci Spiral layout */
{ 9, setlayout, {.v = &layouts[8]} }, /* Fibonacci Dwindle layout */
{ 10, setlayout, {.v = &layouts[9]} }, /* Bottom Stack layout */
@ -112,4 +112,15 @@ static Signal signals[] = {
{ 99, resetbarpaddingv, {0} },
{ 100, resetbarpaddingh, {0} },
{ 101, resetbarpadding, {0} },
{ 102, incstackcount, {.i = +1 } },
{ 103, incstackcount, {.i = -1 } },
{ 104, rotatelayoutaxis, {.i = +1 } },
{ 105, rotatelayoutaxis, {.i = +2 } },
{ 106, rotatelayoutaxis, {.i = +3 } },
{ 107, rotatelayoutaxis, {.i = +4 } },
{ 108, rotatelayoutaxis, {.i = -1 } },
{ 109, rotatelayoutaxis, {.i = -2 } },
{ 110, rotatelayoutaxis, {.i = -3 } },
{ 111, rotatelayoutaxis, {.i = -4 } },
{ 112, mirrorlayout, {0} },
};

275
speedwm.c
View file

@ -226,6 +226,16 @@ typedef struct {
const Arg arg;
} Key;
typedef struct {
int mastercount;
int stackcount;
int layout;
int masteraxis; // master stack area
int stack1axis; // primary stack area
int stack2axis; // secondary stack area, e.g. centered master
void (*symbolfunc)(Monitor *, unsigned int);
} LayoutPreset;
typedef struct {
unsigned int signum;
void (*func)(const Arg *);
@ -235,6 +245,7 @@ typedef struct {
typedef struct {
const char *symbol;
void (*arrange)(Monitor *);
LayoutPreset preset;
} Layout;
typedef struct Pertag Pertag;
@ -245,6 +256,8 @@ struct Monitor {
#endif
float mfact; /* mfact value */
float cfact; /* cfact value */
int ltaxis[4];
int stackcount;
int mastercount; /* number of clients in the master stack */
int num;
int by, bh; /* bar geometry */
@ -435,13 +448,11 @@ static void dragmfact(const Arg *arg);
#endif
static void drawbaritems(Monitor *m);
static void drawbar(void);
static int drawarrows(Monitor *m);
#if USEROUNDCORNERS
static void drawroundedcorners(Client *c);
#endif
static int drawstatusbar(Monitor *m, int bh, char* text);
static int statuslength(char *stext);
static int textlength(char* stext);
static void enternotify(XEvent *e);
static void expose(XEvent *e);
static void focus(Client *c);
@ -526,12 +537,16 @@ static void resizeclient(Client *c, int x, int y, int w, int h);
#if USEMOUSE
static void resizemouse(const Arg *arg);
#endif
static void changebarpos(const Arg *arg);
static void restack(Monitor *m);
static void run(void);
static void scantray(void);
static void scan(void);
/* tile functions */
static void mirrorlayout(const Arg *arg);
static void rotatelayoutaxis(const Arg *arg);
static void incstackcount(const Arg *arg);
/* scratchpad functions */
static void scratchpad_hide();
static _Bool scratchpad_last_showed_is_killed(void);
@ -592,19 +607,42 @@ static void unmanagetray(Window w);
static void tagmon(const Arg *arg);
/* layouts */
static void setltsymbols(Monitor *m, unsigned int n);
static void monoclesymbols(Monitor *m, unsigned int n);
static void decksymbols(Monitor *m, unsigned int n);
static void layout_no_split(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n);
static void layout_split_vertical(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n);
static void layout_split_horizontal(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n);
static void layout_split_vertical_dual_stack(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n);
static void layout_split_horizontal_dual_stack(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n);
static void layout_split_centered_vertical(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n);
static void layout_split_centered_horizontal(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n);
static void layout_floating_master(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n);
static void layout_split_vertical_fixed(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n);
static void layout_split_horizontal_fixed(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n);
static void layout_split_vertical_dual_stack_fixed(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n);
static void layout_split_horizontal_dual_stack_fixed(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n);
static void layout_split_centered_vertical_fixed(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n);
static void layout_split_centered_horizontal_fixed(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n);
static void layout_floating_master_fixed(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n);
static void arrange_left_to_right(Monitor *m, int ax, int ay, int ah, int aw, int ih, int iv, int n, int an, int ai);
static void arrange_top_to_bottom(Monitor *m, int ax, int ay, int ah, int aw, int ih, int iv, int n, int an, int ai);
static void arrange_monocle(Monitor *m, int ax, int ay, int ah, int aw, int ih, int iv, int n, int an, int ai);
static void arrange_dynamicgrid(Monitor *m, int ax, int ay, int ah, int aw, int ih, int iv, int n, int an, int ai);
static void arrange_dynamicgrid_alt1(Monitor *m, int ax, int ay, int ah, int aw, int ih, int iv, int n, int an, int ai);
static void arrange_dynamicgrid_alt2(Monitor *m, int ax, int ay, int ah, int aw, int ih, int iv, int n, int an, int ai);
static void arrange_gridmode(Monitor *m, int ax, int ay, int ah, int aw, int ih, int iv, int n, int an, int ai);
static void arrange_horizgrid(Monitor *m, int ax, int ay, int ah, int aw, int ih, int iv, int n, int an, int ai);
static void arrange_dwindle(Monitor *m, int ax, int ay, int ah, int aw, int ih, int iv, int n, int an, int ai);
static void arrange_spiral(Monitor *m, int ax, int ay, int ah, int aw, int ih, int iv, int n, int an, int ai);
static void arrange_tatami(Monitor *m, int ax, int ay, int ah, int aw, int ih, int iv, int n, int an, int ai);
static void tile(Monitor *m);
static void monocle(Monitor *m);
static void grid(Monitor *m);
static void deck(Monitor *m);
static void spiral(Monitor *m);
static void dwindle(Monitor *m);
static void bstack(Monitor *m);
static void bstackhoriz(Monitor *m);
static void horizgrid(Monitor *m);
static void dynamicgrid(Monitor *m);
static void hgrid(Monitor *m);
static void ngrid(Monitor *m);
static void centeredmaster(Monitor *m);
static void centeredfloatingmaster(Monitor *m);
static void stairs(Monitor *m);
#if LAYOUT_CUSTOM
static void custom(Monitor *m);
static void set_s_layout(const Arg *arg);
@ -636,9 +674,6 @@ static void resetbar(const Arg *arg);
/* layout indicator */
static void togglelayoutpos(const Arg *arg);
/* layout toggles */
static void toggleltpos(const Arg *arg);
/* misc toggles */
static void togglefloating(const Arg *arg);
static void toggleopacity(const Arg *arg);
@ -805,6 +840,81 @@ static Monitor *mons, *selmon;
static Monitor *lastselmon; /* IPC */
#endif
/* See tile_deluxe for reference */
enum {
layout,
master,
stack,
stack2,
ltaxislast,
};
enum {
nosplit,
splitvertical,
splithorizontal,
splitcenteredvertical,
splitcenteredhorizontal,
splitverticaldualstack,
splithorizontaldualstack,
floatingmaster,
splitverticalfixed,
splithorizontalfixed,
splitcenteredverticalfixed,
splitcenteredhorizontalfixed,
splitverticaldualstackfixed,
splithorizontaldualstackfixed,
floatingmasterfixed,
layoutlast,
};
static char layoutsymb[] = {
32,
124,
61,
94,
126,
58,
59,
43,
124,
61,
94,
126,
58,
59,
43,
};
enum {
toptobottom,
lefttoright,
monocle,
dynamicgrid,
dynamicgridalt1,
dynamicgridalt2,
grid,
horizgrid,
dwindle,
spiral,
tatami,
axislast,
};
static char tilesymb[] = {
61,
124,
68,
71,
49,
50,
35,
126,
92,
64,
84,
};
static Window root, wmcheckwin;
static KeySym keychain = -1;
@ -875,9 +985,6 @@ static int systraypinningfailfirst = 1;
/* Signals */
#include "signal.h" /* Include signal support */
/* Layout code */
#include "layouts.c" /* Enable patched layouts */
/* Rest of the IPC support */
#if USEIPC
#include "toggle/ipc-yajl.c"
@ -890,7 +997,9 @@ struct Pertag {
int mastercounts[LENGTH(tags) + 1]; /* number of windows in master area */
float mfacts[LENGTH(tags) + 1]; /* mfacts per tag */
unsigned int sellts[LENGTH(tags) + 1]; /* selected layouts */
const Layout *ltidxs[LENGTH(tags) + 1][2]; /* matrix of tags and layouts indexes */
int stackcounts[LENGTH(tags) + 1]; /* number of windows in primary stack area */
int ltaxis[LENGTH(tags) + 1][ltaxislast];
const Layout *ltidxs[LENGTH(tags) + 1][3]; /* matrix of tags and layouts indexes */
int showbars[LENGTH(tags) + 1]; /* display bar for the current tag */
unsigned int gaps[LENGTH(tags) + 1];
};
@ -1735,6 +1844,7 @@ createmon(void)
m->tagset[0] = m->tagset[1] = startontag ? 1 : 0;
m->mfact = mfact;
m->mastercount = mastercount;
m->stackcount = stackcount;
m->showbar = !hidebar;
/* bar items */
@ -1789,17 +1899,28 @@ createmon(void)
/* pertag */
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
m->ltaxis[layout] = m->lt[0]->preset.layout;
m->ltaxis[master] = m->lt[0]->preset.masteraxis;
m->ltaxis[stack] = m->lt[0]->preset.stack1axis;
m->ltaxis[stack2] = m->lt[0]->preset.stack2axis;
m->pertag = ecalloc(1, sizeof(Pertag));
m->pertag->curtag = m->pertag->prevtag = 1;
/* pertag */
for (i = 0; i <= LENGTH(tags); i++) {
m->pertag->mastercounts[i] = m->mastercount;
m->pertag->stackcounts[i] = m->stackcount;
m->pertag->mfacts[i] = m->mfact;
m->pertag->ltidxs[i][0] = m->lt[0];
m->pertag->ltidxs[i][1] = m->lt[1];
m->pertag->sellts[i] = m->sellt;
m->pertag->showbars[i] = m->showbar;
m->pertag->ltaxis[i][layout] = m->ltaxis[layout];
m->pertag->ltaxis[i][master] = m->ltaxis[master];
m->pertag->ltaxis[i][stack] = m->ltaxis[stack];
m->pertag->ltaxis[i][stack2] = m->ltaxis[stack2];
}
#if USETAGPREVIEW
@ -2040,7 +2161,7 @@ readAndSetColor(int clrIdx, char* txt) {
int
statuslength(char* stext)
{
int ret, i = -1, j = 0, w, len;
int i = -1, w, len;
short isCode = 0;
char *text;
char *p;
@ -2231,8 +2352,6 @@ dragmfact(const Arg *arg)
return;
else if (m->lt[m->sellt]->arrange == &centeredmaster && (fixed || n - m->mastercount > 1))
center = 1;
else if (m->lt[m->sellt]->arrange == &centeredfloatingmaster)
center = 1;
else if (m->lt[m->sellt]->arrange == &bstack)
horizontal = 1;
else if (m->lt[m->sellt]->arrange == &bstackhoriz)
@ -2241,10 +2360,6 @@ dragmfact(const Arg *arg)
/* do not allow mfact to be modified under certain conditions */
if (!m->lt[m->sellt]->arrange /* floating layout */
|| (!fixed && m->mastercount && n <= m->mastercount) /* no master */
|| m->lt[m->sellt]->arrange == &monocle /* monocle lt */
|| m->lt[m->sellt]->arrange == &grid /* grid lt */
|| m->lt[m->sellt]->arrange == &horizgrid /* horizgrid lt */
|| m->lt[m->sellt]->arrange == &dynamicgrid /* dgrid lt */
)
return;
@ -2339,7 +2454,6 @@ drawbaritems(Monitor *m)
unsigned int i, occ = 0, urg = 0, n = 0;
/* powerline */
int wt;
Clr *prevscheme, *nxtscheme; /* powerline schemes */
if (!selmon->hidetagpowerline || !selmon->hidetitlepowerline) {
@ -2352,9 +2466,6 @@ drawbaritems(Monitor *m)
int boxs = drw->font->h / 9;
int boxw = drw->font->h / 6 + 2;
/* monocle layout */
unsigned int s = 0, a = 0;
const char *tagtext;
Client *c;
@ -2474,18 +2585,6 @@ resizebarwin(m);
}
}
/* override layout icon with number of layouts */
if (monoclecount) {
if (m->lt[m->sellt]->arrange == monocle) {
for (c = nexttiled(m->clients), a = 0, s = 0; c; c = nexttiled(c->next), a++)
if (c == m->stack)
s = a + 1;
if (!s && a)
s = 1;
snprintf(m->ltsymbol, sizeof m->ltsymbol, monocleformat, s, a);
}
}
/* draw the layout bar on the right if selmon->layoutposition is not 0 */
if (!selmon->layoutposition && !selmon->hidelayout) {
w = TEXTW(m->ltsymbol);
@ -2506,7 +2605,6 @@ resizebarwin(m);
int remainder;
int tabw;
int docontinue = 0;
/* we're doing this to make sure the title does not get truncated when there's only supposed to be one title anyway */
if (!selmon->hideunselectedtitle) {
@ -2738,8 +2836,6 @@ focus(Client *c)
XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
}
selmon->sel = c;
if (selmon->lt[selmon->sellt]->arrange == monocle)
arrangemon(selmon);
drawbar();
}
@ -3151,6 +3247,57 @@ incmastercount(const Arg *arg)
arrange(selmon);
}
void
mirrorlayout(const Arg *arg)
{
if (!selmon->lt[selmon->sellt]->arrange)
return;
selmon->ltaxis[layout] *= -1;
selmon->pertag->ltaxis[selmon->pertag->curtag][0] = selmon->ltaxis[layout];
arrange(selmon);
}
void
rotatelayoutaxis(const Arg *arg)
{
int incr = (arg->i > 0 ? 1 : -1);
int axis = abs(arg->i) - 1;
if (!selmon->lt[selmon->sellt]->arrange)
return;
if (axis == layout) {
if (selmon->ltaxis[layout] >= 0) {
selmon->ltaxis[layout] += incr;
if (selmon->ltaxis[layout] >= layoutlast)
selmon->ltaxis[layout] = 0;
else if (selmon->ltaxis[layout] < 0)
selmon->ltaxis[layout] = layoutlast - 1;
} else {
selmon->ltaxis[layout] -= incr;
if (selmon->ltaxis[layout] <= -layoutlast)
selmon->ltaxis[layout] = 0;
else if (selmon->ltaxis[layout] > 0)
selmon->ltaxis[layout] = -layoutlast + 1;
}
} else {
selmon->ltaxis[axis] += incr;
if (selmon->ltaxis[axis] >= axislast)
selmon->ltaxis[axis] = 0;
else if (selmon->ltaxis[axis] < 0)
selmon->ltaxis[axis] = axislast - 1;
}
selmon->pertag->ltaxis[selmon->pertag->curtag][axis] = selmon->ltaxis[axis];
arrange(selmon);
setltsymbols(selmon, 0);
}
void
incstackcount(const Arg *arg)
{
selmon->stackcount = selmon->pertag->stackcounts[selmon->pertag->curtag] = MAX(selmon->stackcount + arg->i, 0);
arrange(selmon);
}
#ifdef XINERAMA
static int
isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info)
@ -3630,10 +3777,6 @@ manage(Window w, XWindowAttributes *wa)
Client *c, *t = NULL, *term = NULL;
Window trans = None;
XWindowChanges wc;
int format;
unsigned int *ptags;
unsigned long n, extra;
Atom atom;
c = ecalloc(1, sizeof(Client));
c->win = w;
@ -3730,9 +3873,12 @@ manage(Window w, XWindowAttributes *wa)
updatemotifhints(c);
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
grabbuttons(c, 0);
if (!c->isfloating)
if (!c->isfloating) {
c->isfloating = c->oldstate = t || c->isfixed;
}
XRaiseWindow(dpy, c->win);
switch(attachdirection){
case 1:
attachabove(c);
@ -4200,10 +4346,11 @@ switcherstart(const Arg *arg)
if (warpcursor) {
selmon->allowwarp = 1;
if (m == selmon && selmon->allowwarp && (m->tagset[m->seltags] & m->sel->tags) && selmon->lt[selmon->sellt] != &layouts[2])
if (m == selmon && selmon->allowwarp && (m->tagset[m->seltags] & m->sel->tags) && selmon->lt[selmon->sellt] != &layouts[2]) {
warp(m->sel);
selmon->allowwarp = 0;
}
}
restack(selmon);
}
@ -5352,6 +5499,22 @@ setlayout(const Arg *arg)
selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag] ^= 1;
if (arg && arg->v)
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt] = (Layout *)arg->v;
if (selmon->lt[selmon->sellt]->preset.mastercount && selmon->lt[selmon->sellt]->preset.mastercount != -1)
selmon->mastercount = selmon->lt[selmon->sellt]->preset.mastercount;
if (selmon->lt[selmon->sellt]->preset.stackcount && selmon->lt[selmon->sellt]->preset.stackcount != -1)
selmon->stackcount = selmon->lt[selmon->sellt]->preset.stackcount;
selmon->ltaxis[layout] = selmon->lt[selmon->sellt]->preset.layout;
selmon->ltaxis[master] = selmon->lt[selmon->sellt]->preset.masteraxis;
selmon->ltaxis[stack] = selmon->lt[selmon->sellt]->preset.stack1axis;
selmon->ltaxis[stack2] = selmon->lt[selmon->sellt]->preset.stack2axis;
selmon->pertag->ltaxis[selmon->pertag->curtag][layout] = selmon->ltaxis[layout];
selmon->pertag->ltaxis[selmon->pertag->curtag][master] = selmon->ltaxis[master];
selmon->pertag->ltaxis[selmon->pertag->curtag][stack] = selmon->ltaxis[stack];
selmon->pertag->ltaxis[selmon->pertag->curtag][stack2] = selmon->ltaxis[stack2];
if (selmon->sel)
arrange(selmon);
else
@ -5484,7 +5647,7 @@ setup(void)
netatom[NetWMWindowTypeDesktop] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DESKTOP", False);
netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False);
netatom[NetClientInfo] = XInternAtom(dpy, "_NET_CLIENT_INFO", False);
netatom[NetClientListStacking] = XInternAtom(dpy, "_NET_CLIENT_LIST_STACKING", False);
netatom[NetClientListStacking] = XInternAtom(dpy, "_NET_CLIENT_LIST_stackING", False);
#if USEFADE
netatom[NetWMWindowsOpacity] = XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False);
#endif
@ -6770,10 +6933,15 @@ view(const Arg *arg)
}
selmon->mastercount = selmon->pertag->mastercounts[selmon->pertag->curtag];
selmon->stackcount = selmon->pertag->stackcounts[selmon->pertag->curtag];
selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
selmon->ltaxis[layout] = selmon->pertag->ltaxis[selmon->pertag->curtag][layout];
selmon->ltaxis[master] = selmon->pertag->ltaxis[selmon->pertag->curtag][master];
selmon->ltaxis[stack] = selmon->pertag->ltaxis[selmon->pertag->curtag][stack];
selmon->ltaxis[stack2] = selmon->pertag->ltaxis[selmon->pertag->curtag][stack2];
if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
togglebar(NULL);
@ -7413,3 +7581,6 @@ inplacerotate(const Arg *arg)
arrange(selmon);
focus(c);
}
/* Layout code */
#include "layouts.c" /* Enable patched layouts */

45
text.h
View file

@ -26,21 +26,36 @@ static char *usedtags[] = { text_tag1_used, /* Tag 1 text
/* Text for layouts */
static Layout layouts[] = {
{ text_layout1, tile, }, /* tile layout */
{ text_layout2, NULL, }, /* floating layout */
{ text_layout3, monocle, }, /* monocle layout */
{ text_layout4, grid }, /* grid layout */
{ text_layout5, deck }, /* deck layout */
{ text_layout6, centeredmaster }, /* centered master layout */
{ text_layout7, centeredfloatingmaster }, /* centered floating layout */
{ text_layout8, spiral }, /* spiral layout */
{ text_layout9, dwindle }, /* dwindle layout */
{ text_layout10, bstack }, /* bottom stack layout */
{ text_layout11, bstackhoriz }, /* horiz bottom stack layout */
{ text_layout12, horizgrid }, /* horiz grid layout */
{ text_layout13, dynamicgrid }, /* dynamic grid layout */
/* Tiling */
{ text_layout1, tile, { -1, -1, splitvertical, toptobottom, toptobottom, 0, NULL } },
/* Floating */
{ text_layout2, NULL, {0} },
/* Monocle */
{ text_layout3, tile, { -1, -1, nosplit, monocle, monocle, 0, NULL } },
/* Grid */
{ text_layout4, ngrid, {0} },
/* Deck */
{ text_layout5, tile, { -1, -1, splitvertical, toptobottom, monocle, 0, NULL } },
/* Centered Master */
{ text_layout6, tile, { -1, -1, splithorizontal, lefttoright, toptobottom, 0, monoclesymbols } },
/* Tatami */
{ text_layout7, tile, { -1, -1, splitvertical, lefttoright, tatami, 0, NULL } },
/* Spiral */
{ text_layout8, tile, { -1, -1, nosplit, spiral, spiral, 0, NULL } },
/* Dwindle */
{ text_layout9, tile, { -1, -1, nosplit, dwindle, dwindle, 0, NULL } },
/* Bottom Stack */
{ text_layout10, tile, { -1, -1, splithorizontal, lefttoright, lefttoright, 0, NULL } },
/* Bottom Stack (Horizontal */
{ text_layout11, tile, { -1, -1, splithorizontal, lefttoright, toptobottom, 0, NULL } },
/* Horizontal Grid */
{ text_layout12, hgrid, {0} },
/* Dynamic Grid */
{ text_layout13, tile, { -1, -1, nosplit, dynamicgrid, dynamicgrid, 0, NULL } },
/* Custom */
#if LAYOUT_CUSTOM
{ text_layout14, custom }, /* custom layout */
{ text_layout14, custom, {0} },
#endif
{ NULL, NULL },
/* Reset to layout 1 */
{ NULL, NULL, {0} },
};