update flexipatch, reconfigure
All checks were successful
Update void-packages template / Update xbps-src template (push) Successful in 2m10s

This commit is contained in:
Luca Bilke 2024-12-12 14:45:25 +01:00
parent 7adadaf491
commit 1076d3a300
Signed by: luca
GPG key ID: F6E11C9BAA7C82F5
17 changed files with 111 additions and 342 deletions

View file

@ -194,10 +194,7 @@ static const Layout layouts[] = {
/* symbol arrange function */
{ "[]=", tile }, /* first entry is default */
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
{ "TTT", bstack },
{ "|M|", centeredmaster },
{ "[D]", deck },
{ ":::", gaplessgrid },
};
@ -240,10 +237,6 @@ static const Key keys[] = {
{ MODKEY, XK_b, togglebar, {0} },
STACKKEYS(MODKEY, focus)
STACKKEYS(MODKEY|ShiftMask, push)
{ MODKEY, XK_Left, focusdir, {.i = 0 } }, // left
{ MODKEY, XK_Right, focusdir, {.i = 1 } }, // right
{ MODKEY, XK_Up, focusdir, {.i = 2 } }, // up
{ MODKEY, XK_Down, focusdir, {.i = 3 } }, // down
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },

201
config.h
View file

@ -12,13 +12,13 @@
#define STATUSBAR "dwmblocks"
/* appearance */
static const unsigned int borderpx = 2; /* border pixel of windows */
static const unsigned int snap = 32; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
static const int focusonwheel = 0;
static int floatposgrid_x = 5; /* float grid columns */
static int floatposgrid_y = 5; /* float grid rows */
static const unsigned int borderpx = 2; /* border pixel of windows */
static const unsigned int snap = 32; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
static const int focusonwheel = 0;
static int floatposgrid_x = 5; /* float grid columns */
static int floatposgrid_y = 5; /* float grid rows */
/* Status is to be shown on: -1 (all monitors), 0 (a specific monitor by index), 'A' (active monitor) */
/* Indicators: see patch/bar_indicators.h for options */
@ -40,70 +40,70 @@ static const char font[] = "FiraCode Nerd Font 12";
#define WHITE "#c0caf5"
#define UNDEFINED "#ff0000"
static char undefined[] = UNDEFINED; // placeholder value
static char undefined[] = UNDEFINED; // placeholder value
static char normfgcolor[] = WHITE;
static char normbgcolor[] = BLACK;
static char normbordercolor[] = GRAY;
static char normfloatcolor[] = GRAY;
static char normfgcolor[] = WHITE;
static char normbgcolor[] = BLACK;
static char normbordercolor[] = GRAY;
static char normfloatcolor[] = GRAY;
static char selfgcolor[] = UNDEFINED;
static char selbgcolor[] = UNDEFINED;
static char selbordercolor[] = BLUE;
static char selfloatcolor[] = BLUE;
static char selfgcolor[] = UNDEFINED;
static char selbgcolor[] = UNDEFINED;
static char selbordercolor[] = BLUE;
static char selfloatcolor[] = BLUE;
static char titlenormfgcolor[] = WHITE;
static char titlenormbgcolor[] = BLACK;
static char titlenormbordercolor[] = UNDEFINED;
static char titlenormfloatcolor[] = UNDEFINED;
static char titlenormfgcolor[] = WHITE;
static char titlenormbgcolor[] = BLACK;
static char titlenormbordercolor[] = UNDEFINED;
static char titlenormfloatcolor[] = UNDEFINED;
static char titleselfgcolor[] = LIGHT_GRAY;
static char titleselbgcolor[] = BLACK;
static char titleselbordercolor[] = UNDEFINED;
static char titleselfloatcolor[] = UNDEFINED;
static char titleselfgcolor[] = LIGHT_GRAY;
static char titleselbgcolor[] = BLACK;
static char titleselbordercolor[] = UNDEFINED;
static char titleselfloatcolor[] = UNDEFINED;
static char tagsnormfgcolor[] = LIGHT_GRAY;
static char tagsnormbgcolor[] = BLACK;
static char tagsnormbordercolor[] = UNDEFINED;
static char tagsnormfloatcolor[] = UNDEFINED;
static char tagsnormfgcolor[] = LIGHT_GRAY;
static char tagsnormbgcolor[] = BLACK;
static char tagsnormbordercolor[] = UNDEFINED;
static char tagsnormfloatcolor[] = UNDEFINED;
static char tagsselfgcolor[] = BLACK;
static char tagsselbgcolor[] = BLUE;
static char tagsselbordercolor[] = UNDEFINED;
static char tagsselfloatcolor[] = UNDEFINED;
static char tagsselfgcolor[] = BLACK;
static char tagsselbgcolor[] = BLUE;
static char tagsselbordercolor[] = UNDEFINED;
static char tagsselfloatcolor[] = UNDEFINED;
static char hidnormfgcolor[] = UNDEFINED;
static char hidselfgcolor[] = UNDEFINED;
static char hidnormbgcolor[] = UNDEFINED;
static char hidselbgcolor[] = UNDEFINED;
static char hidnormfgcolor[] = UNDEFINED;
static char hidselfgcolor[] = UNDEFINED;
static char hidnormbgcolor[] = UNDEFINED;
static char hidselbgcolor[] = UNDEFINED;
static char urgfgcolor[] = BLACK;
static char urgbgcolor[] = RED;
static char urgbordercolor[] = RED;
static char urgfloatcolor[] = RED;
static char urgfgcolor[] = BLACK;
static char urgbgcolor[] = RED;
static char urgbordercolor[] = RED;
static char urgfloatcolor[] = RED;
static char scratchselfgcolor[] = UNDEFINED;
static char scratchselbgcolor[] = UNDEFINED;
static char scratchselbordercolor[] = BLUE;
static char scratchselfloatcolor[] = BLUE;
static char scratchselfgcolor[] = UNDEFINED;
static char scratchselbgcolor[] = UNDEFINED;
static char scratchselbordercolor[] = BLUE;
static char scratchselfloatcolor[] = BLUE;
static char scratchnormfgcolor[] = UNDEFINED;
static char scratchnormbgcolor[] = UNDEFINED;
static char scratchnormbordercolor[] = GRAY;
static char scratchnormfloatcolor[] = GRAY;
static char scratchnormfgcolor[] = UNDEFINED;
static char scratchnormbgcolor[] = UNDEFINED;
static char scratchnormbordercolor[] = GRAY;
static char scratchnormfloatcolor[] = GRAY;
static char *colors[][ColCount] = {
/* fg bg border float */
[SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor, normfloatcolor },
[SchemeSel] = { selfgcolor, selbgcolor, selbordercolor, selfloatcolor },
[SchemeTitleNorm] = { titlenormfgcolor, titlenormbgcolor, titlenormbordercolor, titlenormfloatcolor },
[SchemeTitleSel] = { titleselfgcolor, titleselbgcolor, titleselbordercolor, titleselfloatcolor },
[SchemeTagsNorm] = { tagsnormfgcolor, tagsnormbgcolor, tagsnormbordercolor, tagsnormfloatcolor },
[SchemeTagsSel] = { tagsselfgcolor, tagsselbgcolor, tagsselbordercolor, tagsselfloatcolor },
[SchemeHidNorm] = { hidnormfgcolor, hidnormbgcolor, undefined, undefined },
[SchemeHidSel] = { hidselfgcolor, hidselbgcolor, undefined, undefined },
[SchemeUrg] = { urgfgcolor, urgbgcolor, urgbordercolor, urgfloatcolor },
[SchemeScratchSel] = { scratchselfgcolor, scratchselbgcolor, scratchselbordercolor, scratchselfloatcolor },
[SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor, normfloatcolor },
[SchemeSel] = { selfgcolor, selbgcolor, selbordercolor, selfloatcolor },
[SchemeTitleNorm] = { titlenormfgcolor, titlenormbgcolor, titlenormbordercolor, titlenormfloatcolor },
[SchemeTitleSel] = { titleselfgcolor, titleselbgcolor, titleselbordercolor, titleselfloatcolor },
[SchemeTagsNorm] = { tagsnormfgcolor, tagsnormbgcolor, tagsnormbordercolor, tagsnormfloatcolor },
[SchemeTagsSel] = { tagsselfgcolor, tagsselbgcolor, tagsselbordercolor, tagsselfloatcolor },
[SchemeHidNorm] = { hidnormfgcolor, hidnormbgcolor, undefined, undefined },
[SchemeHidSel] = { hidselfgcolor, hidselbgcolor, undefined, undefined },
[SchemeUrg] = { urgfgcolor, urgbgcolor, urgbordercolor, urgfloatcolor },
[SchemeScratchSel] = { scratchselfgcolor, scratchselbgcolor, scratchselbordercolor, scratchselfloatcolor },
[SchemeScratchNorm] = { scratchnormfgcolor, scratchnormbgcolor, scratchnormbordercolor, scratchnormfloatcolor },
};
@ -164,38 +164,35 @@ static const Rule rules[] = {
};
static const BarRule barrules[] = {
/* monitor bar alignment widthfunc drawfunc clickfunc hoverfunc name */
{ -1, 0, BAR_ALIGN_LEFT, width_tags, draw_tags, click_tags, hover_tags, "tags" },
{ 'A', 0, BAR_ALIGN_LEFT, width_ltsymbol, draw_ltsymbol, click_ltsymbol, NULL, "layout" },
{ 0, 0, BAR_ALIGN_RIGHT, width_status, draw_status, click_status, NULL, "status" },
{ -1, 0, BAR_ALIGN_NONE, width_wintitle, draw_wintitle, click_wintitle, NULL, "wintitle" },
/* monitor bar alignment widthfunc drawfunc clickfunc hoverfunc name */
{ -1, 0, BAR_ALIGN_LEFT, width_tags, draw_tags, click_tags, hover_tags, "tags" },
{ -1, 0, BAR_ALIGN_LEFT, width_ltsymbol, draw_ltsymbol, click_ltsymbol, NULL, "layout" },
{ 'A', 0, BAR_ALIGN_RIGHT, width_status, draw_status, click_status, NULL, "status" },
{ -1, 0, BAR_ALIGN_NONE, width_wintitle, draw_wintitle, click_wintitle, NULL, "wintitle" },
};
/* layout(s) */
static const float mfact = 0.50; /* factor of master area size [0.05..0.95] */
static const int nmaster = 1; /* number of clients in master area */
static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */
static const float mfact = 0.50; /* factor of master area size [0.05..0.95] */
static const int nmaster = 1; /* number of clients in master area */
static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
static const Layout layouts[] = {
/* symbol arrange function */
{ "[]=", tile }, /* first entry is default */
{ "[M]", monocle },
{ "TTT", bstack },
{ "|M|", centeredmaster },
{ "[D]", deck },
{ ":::", gaplessgrid },
{ "><>", NULL }, /* no layout function means floating behavior */
/* symbol arrange function */
{ "[]=", tile }, /* first entry is default */
{ "TTT", bstack },
{ ":::", gaplessgrid },
{ "><>", NULL }, /* no layout function means floating behavior */
};
/* key definitions */
#define MODKEY Mod4Mask
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
@ -206,8 +203,8 @@ static const char *termcmd[] = { TERM, NULL };
#include <X11/XF86keysym.h>
static const Key keys[] = {
/* modifier key function argument */
/*{ MODKEY, XK_F1, togglescratch, {.v = sphelp} },*/
// { MODKEY | ShiftMask, XK_F1, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY, XK_F1, togglescratch, {.v = sphelp} },
// { MODKEY | ShiftMask, XK_F1, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_F2, spawn, SHCMD("$HOME/.local/libexec/dwm/dmenuhandler") },
// { MODKEY | ShiftMask, XK_F2, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_F3, spawn, SHCMD("$HOME/.local/libexec/dwm/togtouchpad") },
@ -241,8 +238,8 @@ static const Key keys[] = {
TAGKEYS( XK_7, 6),
TAGKEYS( XK_8, 7),
TAGKEYS( XK_9, 8),
{ MODKEY, XK_0, view, {.ui = ~0} },
{ MODKEY | ShiftMask, XK_0, tag, {.ui = ~0} },
{ MODKEY, XK_0, view, {.ui = ~0} },
{ MODKEY | ShiftMask, XK_0, tag, {.ui = ~0} },
// { MODKEY | ShiftMask, XK_0, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY, XK_bracketleft, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_bracketleft, spawn, {.v = (const char *[]){NULL}} },
@ -262,16 +259,16 @@ static const Key keys[] = {
// { MODKEY | ShiftMask, XK_p, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY, XK_y, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_y, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_f, togglefullscreen, {0} },
{ MODKEY | ShiftMask, XK_f, setlayout, {.v = &layouts[6]} },
{ MODKEY, XK_f, togglefullscreen, {0} },
// { MODKEY | ShiftMask, XK_f, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_g, setlayout, {.v = &layouts[0]} },
{ MODKEY | ShiftMask, XK_g, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_c, setlayout, {.v = &layouts[2]} },
{ MODKEY | ShiftMask, XK_c, setlayout, {.v = &layouts[3]} },
{ MODKEY, XK_r, setlayout, {.v = &layouts[4]} },
{ MODKEY | ShiftMask, XK_r, setlayout, {.v = &layouts[5]} },
{ MODKEY, XK_l, focusdir, {.i = 1} },
{ MODKEY | ShiftMask, XK_l, pushstack, {.i = INC(+1)} },
// { MODKEY | ShiftMask, XK_g, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_c, setlayout, {.v = &layouts[1]} },
// { MODKEY | ShiftMask, XK_c, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_r, setlayout, {.v = &layouts[2]} },
// { MODKEY | ShiftMask, XK_r, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_l, pushstack, {.i = INC(+1)} },
{ MODKEY | ShiftMask, XK_l, setmfact, {.f = +0.05} },
// { MODKEY, XK_slash, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_slash, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY, XK_equal, spawn, {.v = (const char *[]){NULL}} },
@ -288,29 +285,29 @@ static const Key keys[] = {
{ MODKEY | ShiftMask, XK_i, spawn, {.v = (const char *[]){"dunstctl", "history-pop", NULL}} },
{ MODKEY, XK_d, spawn, {.v = (const char *[]){"dunstctl", "context", NULL}} },
{ MODKEY | ShiftMask, XK_d, spawn, {.v = (const char *[]){"dunstctl", "action", "0", NULL}} },
{ MODKEY, XK_h, focusdir, {.i = 0 } },
{ MODKEY | ShiftMask, XK_h, pushstack, {.i = INC(-1)} },
{ MODKEY, XK_h, pushstack, {.i = INC(-1)} },
{ MODKEY | ShiftMask, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_t, spawn, {.v = (const char *[]){BROWSER, BROWSER_FLAG_1, NULL}} },
{ MODKEY | ShiftMask, XK_t, spawn, {.v = (const char *[]){BROWSER, BROWSER_FLAG_1, BROWSER_FLAG_INCOG, NULL}} },
{ MODKEY, XK_n, focusstack, {.i = PREVSEL} },
{ MODKEY | ShiftMask, XK_n, focusstack, {.i = 0} },
{ MODKEY, XK_s, setmfact, {.f = +0.05} },
{ MODKEY | ShiftMask, XK_s, setmfact, {.f = -0.05} },
// { MODKEY, XK_s, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_s, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_s, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY, XK_minus, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_minus, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY, XK_backslash, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_backslash, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_Return, zoom, {0} },
// { MODKEY | ShiftMask, XK_Return, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_Return, zoom, {0} },
// { MODKEY | ShiftMask, XK_Return, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY, XK_semicolon, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_semicolon, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_q, killclient, {0} },
// { MODKEY | ShiftMask, XK_q, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_j, focusdir, {.i = 3} },
{ MODKEY | ShiftMask, XK_j, focusstack, {.i = INC(+1) } },
{ MODKEY, XK_k, focusdir, {.i = 2} },
{ MODKEY | ShiftMask, XK_k, focusstack, {.i = INC(-1) } },
{ MODKEY, XK_j, focusstack, {.i = INC(+1) } },
/* { MODKEY | ShiftMask, XK_j, focusstack, {.i = INC(+1) } }, */
{ MODKEY, XK_k, focusstack, {.i = INC(-1) } },
/* { MODKEY | ShiftMask, XK_k, focusstack, {.i = INC(-1) } }, */
{ MODKEY, XK_x, togglefloating, {0} },
{ MODKEY | ShiftMask, XK_x, unfloatvisible, {0} },
{ MODKEY, XK_b, togglescratch, {.v = spnetm} },
@ -340,7 +337,7 @@ static const Key keys[] = {
// { MODKEY, XK_Page_Up, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_Page_Up, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY, XK_Delete, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY | ShiftMask, XK_Delete, quit, {0} },
{ MODKEY | ShiftMask, XK_Delete, quit, {0} },
// { MODKEY, XK_End, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_End, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY, XK_Page_Down, spawn, {.v = (const char *[]){NULL}} },

3
drw.c
View file

@ -187,6 +187,8 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
} else {
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
if (w < lpad)
return x + w;
d = XftDrawCreate(drw->dpy, drw->drawable,
DefaultVisual(drw->dpy, drw->screen),
DefaultColormap(drw->dpy, drw->screen));
@ -294,4 +296,3 @@ drw_cur_free(Drw *drw, Cur *cursor)
XFreeCursor(drw->dpy, cursor->cursor);
free(cursor);
}

1
dwm.c
View file

@ -61,7 +61,6 @@
#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)))
#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]))
#define LENGTH(X) (sizeof X / sizeof X[0])
#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
#define WIDTH(X) ((X)->w + 2 * (X)->bw)
#define HEIGHT(X) ((X)->h + 2 * (X)->bw)

View file

@ -17,10 +17,9 @@ attachx(Client *c)
}
}
for (at = c->mon->clients; at && at->next; at = at->next);
if (at) {
at->next = c;
c->next = NULL;
if (!(c->mon->sel == NULL || c->mon->sel == c || c->mon->sel->isfloating)) {
c->next = c->mon->sel->next;
c->mon->sel->next = c;
return;
}
attach(c); // master (default)

View file

@ -1,66 +0,0 @@
void
focusdir(const Arg *arg)
{
Client *s = selmon->sel, *f = NULL, *c, *next;
if (!s)
return;
unsigned int score = -1;
unsigned int client_score;
int dist;
int dirweight = 20;
int isfloating = s->isfloating;
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) || c->isfloating != isfloating) // || 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) {
focus(f);
restack(f->mon);
}
}

View file

@ -1,2 +0,0 @@
static void focusdir(const Arg *arg);

View file

@ -15,7 +15,6 @@
#include "attachx.c"
#include "cool_autostart.c"
#include "floatpos.c"
#include "focusdir.c"
#include "pertag.c"
#include "restartsig.c"
#include "renamed_scratchpads.c"
@ -27,9 +26,6 @@
/* Layouts */
#include "layout_facts.c"
#include "layout_bstack.c"
#include "layout_centeredmaster.c"
#include "layout_deck.c"
#include "layout_gapplessgrid.c"
#include "layout_monocle.c"
#include "layout_tile.c"

View file

@ -15,7 +15,6 @@
#include "attachx.h"
#include "cool_autostart.h"
#include "floatpos.h"
#include "focusdir.h"
#include "pertag.h"
#include "restartsig.h"
#include "renamed_scratchpads.h"
@ -26,9 +25,6 @@
#include "unfloatvisible.h"
/* Layouts */
#include "layout_bstack.h"
#include "layout_centeredmaster.h"
#include "layout_deck.h"
#include "layout_gapplessgrid.h"
#include "layout_monocle.h"
#include "layout_tile.h"

View file

@ -1,84 +0,0 @@
void
centeredmaster(Monitor *m)
{
unsigned int i, n;
int mx = 0, my = 0, mh = 0, mw = 0;
int lx = 0, ly = 0, lw = 0, lh = 0;
int rx = 0, ry = 0, rw = 0, rh = 0;
float mfacts = 0, lfacts = 0, rfacts = 0;
int mtotal = 0, ltotal = 0, rtotal = 0;
int mrest = 0, lrest = 0, rrest = 0;
Client *c;
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
if (n == 0)
return;
/* initialize areas */
mx = m->wx;
my = m->wy;
mh = m->wh;
mw = m->ww;
lh = m->wh;
rh = m->wh;
if (m->nmaster && n > m->nmaster) {
/* go mfact box in the center if more than nmaster clients */
if (n - m->nmaster > 1) {
/* ||<-S->|<---M--->|<-S->|| */
mw = m->ww * m->mfact;
lw = (m->ww - mw) / 2;
mx += lw;
} else {
/* ||<---M--->|<-S->|| */
mw = mw * m->mfact;
lw = m->ww - mw;
}
rw = lw;
lx = m->wx;
ly = m->wy;
rx = mx + mw;
ry = m->wy;
}
/* calculate facts */
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) {
if (!m->nmaster || n < m->nmaster)
mfacts += 1;
else if ((n - m->nmaster) % 2)
lfacts += 1; // total factor of left hand stack area
else
rfacts += 1; // total factor of right hand stack area
}
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++)
if (!m->nmaster || n < m->nmaster)
mtotal += mh / mfacts;
else if ((n - m->nmaster) % 2)
ltotal += lh / lfacts;
else
rtotal += rh / rfacts;
mrest = mh - mtotal;
lrest = lh - ltotal;
rrest = rh - rtotal;
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
if (!m->nmaster || i < m->nmaster) {
/* nmaster clients are stacked vertically, in the center of the screen */
resize(c, mx, my, mw - (2*c->bw), (mh / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), 0);
my += HEIGHT(c);
} else {
/* stack clients are stacked vertically */
if ((i - m->nmaster) % 2 ) {
resize(c, lx, ly, lw - (2*c->bw), (lh / lfacts) + ((i - 2*m->nmaster) < 2*lrest ? 1 : 0) - (2*c->bw), 0);
ly += HEIGHT(c);
} else {
resize(c, rx, ry, rw - (2*c->bw), (rh / rfacts) + ((i - 2*m->nmaster) < 2*rrest ? 1 : 0) - (2*c->bw), 0);
ry += HEIGHT(c);
}
}
}
}

View file

@ -1,2 +0,0 @@
static void centeredmaster(Monitor *m);

View file

@ -1,40 +0,0 @@
static void
deck(Monitor *m)
{
unsigned int i, n;
int mx = 0, my = 0, mh = 0, mw = 0;
int sx = 0, sy = 0, sh = 0, sw = 0;
float mfacts, sfacts;
int mrest, srest;
Client *c;
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
if (n == 0)
return;
sx = mx = m->wx;
sy = my = m->wy;
sh = mh = m->wh;
sw = mw = m->ww;
if (m->nmaster && n > m->nmaster) {
sw = mw * (1 - m->mfact);
mw = mw * m->mfact;
sx = mx + mw;
}
getfacts(m, mh, sh, &mfacts, &sfacts, &mrest, &srest);
if (n - m->nmaster > 0) /* override layout symbol */
snprintf(m->ltsymbol, sizeof m->ltsymbol, "D %d", n - m->nmaster);
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
if (i < m->nmaster) {
resize(c, mx, my, mw - (2*c->bw), (mh / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), 0);
my += HEIGHT(c);
} else {
resize(c, sx, sy, sw - (2*c->bw), sh - (2*c->bw), 0);
}
}

View file

@ -1,2 +0,0 @@
static void deck(Monitor *m);

View file

@ -1,15 +0,0 @@
void
monocle(Monitor *m)
{
unsigned int n = 0;
Client *c;
for (c = m->clients; c; c = c->next)
if (ISVISIBLE(c))
n++;
if (n > 0) /* override layout symbol */
snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
}

View file

@ -1,2 +0,0 @@
static void monocle(Monitor *m);

12
util.c
View file

@ -1,4 +1,5 @@
/* See LICENSE file for copyright and license details. */
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
@ -10,17 +11,16 @@ void
die(const char *fmt, ...)
{
va_list ap;
int saved_errno;
saved_errno = errno;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
if (fmt[0] && fmt[strlen(fmt)-1] == ':') {
fputc(' ', stderr);
perror(NULL);
} else {
fputc('\n', stderr);
}
if (fmt[0] && fmt[strlen(fmt)-1] == ':')
fprintf(stderr, " %s", strerror(saved_errno));
fputc('\n', stderr);
exit(1);
}

1
util.h
View file

@ -7,6 +7,7 @@
#define MIN(A, B) ((A) < (B) ? (A) : (B))
#endif
#define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B))
#define LENGTH(X) (sizeof (X) / sizeof (X)[0])
#ifdef _DEBUG
#define DEBUG(...) fprintf(stderr, __VA_ARGS__)