Upload files to ".suckless/patch"
This commit is contained in:
parent
65b080631e
commit
ad220d66d7
5 changed files with 290 additions and 0 deletions
2
.suckless/patch/togglefullscreen.h
Normal file
2
.suckless/patch/togglefullscreen.h
Normal file
|
@ -0,0 +1,2 @@
|
|||
static void togglefullscreen(const Arg *arg);
|
||||
|
177
.suckless/patch/vanitygaps.c
Normal file
177
.suckless/patch/vanitygaps.c
Normal file
|
@ -0,0 +1,177 @@
|
|||
/* Settings */
|
||||
static int enablegaps = 1;
|
||||
|
||||
static void
|
||||
setgaps(int oh, int ov, int ih, int iv)
|
||||
{
|
||||
if (oh < 0) oh = 0;
|
||||
if (ov < 0) ov = 0;
|
||||
if (ih < 0) ih = 0;
|
||||
if (iv < 0) iv = 0;
|
||||
|
||||
selmon->gappoh = oh;
|
||||
selmon->gappov = ov;
|
||||
selmon->gappih = ih;
|
||||
selmon->gappiv = iv;
|
||||
|
||||
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
/* External function that takes one integer and splits it
|
||||
* into four gap values:
|
||||
* - outer horizontal (oh)
|
||||
* - outer vertical (ov)
|
||||
* - inner horizontal (ih)
|
||||
* - inner vertical (iv)
|
||||
*
|
||||
* Each value is represented as one byte with the uppermost
|
||||
* bit of each byte indicating whether or not to keep the
|
||||
* current value.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* 10000000 10000000 00001111 00001111
|
||||
* | | | |
|
||||
* + keep oh + keep ov + ih 15px + iv 15px
|
||||
*
|
||||
* This gives an int of:
|
||||
* 10000000100000000000111100001111 = 2155876111
|
||||
*
|
||||
* Thus this command should set inner gaps to 15:
|
||||
* xsetroot -name "fsignal:setgaps i 2155876111"
|
||||
*/
|
||||
static void
|
||||
setgapsex(const Arg *arg)
|
||||
{
|
||||
int oh = selmon->gappoh;
|
||||
int ov = selmon->gappov;
|
||||
int ih = selmon->gappih;
|
||||
int iv = selmon->gappiv;
|
||||
|
||||
if (!(arg->i & (1 << 31)))
|
||||
oh = (arg->i & 0x7f000000) >> 24;
|
||||
if (!(arg->i & (1 << 23)))
|
||||
ov = (arg->i & 0x7f0000) >> 16;
|
||||
if (!(arg->i & (1 << 15)))
|
||||
ih = (arg->i & 0x7f00) >> 8;
|
||||
if (!(arg->i & (1 << 7)))
|
||||
iv = (arg->i & 0x7f);
|
||||
|
||||
/* Auto enable gaps if disabled */
|
||||
if (!enablegaps)
|
||||
enablegaps = 1;
|
||||
|
||||
setgaps(oh, ov, ih, iv);
|
||||
}
|
||||
|
||||
static void
|
||||
togglegaps(const Arg *arg)
|
||||
{
|
||||
enablegaps = !enablegaps;
|
||||
|
||||
arrange(NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
defaultgaps(const Arg *arg)
|
||||
{
|
||||
setgaps(gappoh, gappov, gappih, gappiv);
|
||||
}
|
||||
|
||||
static void
|
||||
incrgaps(const Arg *arg)
|
||||
{
|
||||
setgaps(
|
||||
selmon->gappoh + arg->i,
|
||||
selmon->gappov + arg->i,
|
||||
selmon->gappih + arg->i,
|
||||
selmon->gappiv + arg->i
|
||||
);
|
||||
}
|
||||
|
||||
static void
|
||||
incrigaps(const Arg *arg)
|
||||
{
|
||||
setgaps(
|
||||
selmon->gappoh,
|
||||
selmon->gappov,
|
||||
selmon->gappih + arg->i,
|
||||
selmon->gappiv + arg->i
|
||||
);
|
||||
}
|
||||
|
||||
static void
|
||||
incrogaps(const Arg *arg)
|
||||
{
|
||||
setgaps(
|
||||
selmon->gappoh + arg->i,
|
||||
selmon->gappov + arg->i,
|
||||
selmon->gappih,
|
||||
selmon->gappiv
|
||||
);
|
||||
}
|
||||
|
||||
static void
|
||||
incrohgaps(const Arg *arg)
|
||||
{
|
||||
setgaps(
|
||||
selmon->gappoh + arg->i,
|
||||
selmon->gappov,
|
||||
selmon->gappih,
|
||||
selmon->gappiv
|
||||
);
|
||||
}
|
||||
|
||||
static void
|
||||
incrovgaps(const Arg *arg)
|
||||
{
|
||||
setgaps(
|
||||
selmon->gappoh,
|
||||
selmon->gappov + arg->i,
|
||||
selmon->gappih,
|
||||
selmon->gappiv
|
||||
);
|
||||
}
|
||||
|
||||
static void
|
||||
incrihgaps(const Arg *arg)
|
||||
{
|
||||
setgaps(
|
||||
selmon->gappoh,
|
||||
selmon->gappov,
|
||||
selmon->gappih + arg->i,
|
||||
selmon->gappiv
|
||||
);
|
||||
}
|
||||
|
||||
static void
|
||||
incrivgaps(const Arg *arg)
|
||||
{
|
||||
setgaps(
|
||||
selmon->gappoh,
|
||||
selmon->gappov,
|
||||
selmon->gappih,
|
||||
selmon->gappiv + arg->i
|
||||
);
|
||||
}
|
||||
|
||||
static void
|
||||
getgaps(Monitor *m, int *oh, int *ov, int *ih, int *iv, unsigned int *nc)
|
||||
{
|
||||
unsigned int n, oe, ie;
|
||||
oe = ie = enablegaps;
|
||||
Client *c;
|
||||
|
||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||
if (n == 1) {
|
||||
oe *= smartgaps_fact; // outer gaps disabled or multiplied when only one client
|
||||
}
|
||||
|
||||
*oh = m->gappoh*oe; // outer horizontal gap
|
||||
*ov = m->gappov*oe; // outer vertical gap
|
||||
*ih = m->gappih*ie; // inner horizontal gap
|
||||
*iv = m->gappiv*ie; // inner vertical gap
|
||||
*nc = n; // number of clients
|
||||
}
|
||||
|
16
.suckless/patch/vanitygaps.h
Normal file
16
.suckless/patch/vanitygaps.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
/* Key binding functions */
|
||||
static void defaultgaps(const Arg *arg);
|
||||
static void incrgaps(const Arg *arg);
|
||||
static void incrigaps(const Arg *arg);
|
||||
static void incrogaps(const Arg *arg);
|
||||
static void incrohgaps(const Arg *arg);
|
||||
static void incrovgaps(const Arg *arg);
|
||||
static void incrihgaps(const Arg *arg);
|
||||
static void incrivgaps(const Arg *arg);
|
||||
static void togglegaps(const Arg *arg);
|
||||
|
||||
/* Internals */
|
||||
static void getgaps(Monitor *m, int *oh, int *ov, int *ih, int *iv, unsigned int *nc);
|
||||
static void setgaps(int oh, int ov, int ih, int iv);
|
||||
static void setgapsex(const Arg *arg);
|
||||
|
73
.suckless/patch/xrdb.c
Normal file
73
.suckless/patch/xrdb.c
Normal file
|
@ -0,0 +1,73 @@
|
|||
void
|
||||
loadxrdb()
|
||||
{
|
||||
Display *display;
|
||||
char * resm;
|
||||
XrmDatabase xrdb;
|
||||
char *type;
|
||||
XrmValue value;
|
||||
|
||||
display = XOpenDisplay(NULL);
|
||||
|
||||
if (display != NULL) {
|
||||
resm = XResourceManagerString(display);
|
||||
|
||||
if (resm != NULL) {
|
||||
xrdb = XrmGetStringDatabase(resm);
|
||||
|
||||
if (xrdb != NULL) {
|
||||
XRDB_LOAD_COLOR("dwm.normfgcolor", normfgcolor);
|
||||
XRDB_LOAD_COLOR("dwm.normbgcolor", normbgcolor);
|
||||
XRDB_LOAD_COLOR("dwm.normbordercolor", normbordercolor);
|
||||
XRDB_LOAD_COLOR("dwm.normfloatcolor", normfloatcolor);
|
||||
XRDB_LOAD_COLOR("dwm.selfgcolor", selfgcolor);
|
||||
XRDB_LOAD_COLOR("dwm.selbgcolor", selbgcolor);
|
||||
XRDB_LOAD_COLOR("dwm.selbordercolor", selbordercolor);
|
||||
XRDB_LOAD_COLOR("dwm.selfloatcolor", selfloatcolor);
|
||||
XRDB_LOAD_COLOR("dwm.titlenormfgcolor", titlenormfgcolor);
|
||||
XRDB_LOAD_COLOR("dwm.titlenormbgcolor", titlenormbgcolor);
|
||||
XRDB_LOAD_COLOR("dwm.titlenormbordercolor", titlenormbordercolor);
|
||||
XRDB_LOAD_COLOR("dwm.titlenormfloatcolor", titlenormfloatcolor);
|
||||
XRDB_LOAD_COLOR("dwm.titleselfgcolor", titleselfgcolor);
|
||||
XRDB_LOAD_COLOR("dwm.titleselbgcolor", titleselbgcolor);
|
||||
XRDB_LOAD_COLOR("dwm.titleselbordercolor", titleselbordercolor);
|
||||
XRDB_LOAD_COLOR("dwm.titleselfloatcolor", titleselfloatcolor);
|
||||
XRDB_LOAD_COLOR("dwm.tagsnormfgcolor", tagsnormfgcolor);
|
||||
XRDB_LOAD_COLOR("dwm.tagsnormbgcolor", tagsnormbgcolor);
|
||||
XRDB_LOAD_COLOR("dwm.tagsnormbordercolor", tagsnormbordercolor);
|
||||
XRDB_LOAD_COLOR("dwm.tagsnormfloatcolor", tagsnormfloatcolor);
|
||||
XRDB_LOAD_COLOR("dwm.tagsselfgcolor", tagsselfgcolor);
|
||||
XRDB_LOAD_COLOR("dwm.tagsselbgcolor", tagsselbgcolor);
|
||||
XRDB_LOAD_COLOR("dwm.tagsselbordercolor", tagsselbordercolor);
|
||||
XRDB_LOAD_COLOR("dwm.tagsselfloatcolor", tagsselfloatcolor);
|
||||
XRDB_LOAD_COLOR("dwm.hidnormfgcolor", hidnormfgcolor);
|
||||
XRDB_LOAD_COLOR("dwm.hidnormbgcolor", hidnormbgcolor);
|
||||
XRDB_LOAD_COLOR("dwm.hidselfgcolor", hidselfgcolor);
|
||||
XRDB_LOAD_COLOR("dwm.hidselbgcolor", hidselbgcolor);
|
||||
XRDB_LOAD_COLOR("dwm.urgfgcolor", urgfgcolor);
|
||||
XRDB_LOAD_COLOR("dwm.urgbgcolor", urgbgcolor);
|
||||
XRDB_LOAD_COLOR("dwm.urgbordercolor", urgbordercolor);
|
||||
XRDB_LOAD_COLOR("dwm.urgfloatcolor", urgfloatcolor);
|
||||
|
||||
XrmDestroyDatabase(xrdb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
XCloseDisplay(display);
|
||||
}
|
||||
|
||||
void
|
||||
xrdb(const Arg *arg)
|
||||
{
|
||||
loadxrdb();
|
||||
int i;
|
||||
for (i = 0; i < LENGTH(colors); i++)
|
||||
scheme[i] = drw_scm_create(drw, colors[i],
|
||||
alphas[i],
|
||||
ColCount
|
||||
);
|
||||
focus(NULL);
|
||||
arrange(NULL);
|
||||
}
|
||||
|
22
.suckless/patch/xrdb.h
Normal file
22
.suckless/patch/xrdb.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#include <X11/Xresource.h>
|
||||
|
||||
#define XRDB_LOAD_COLOR(R,V) if (XrmGetResource(xrdb, R, NULL, &type, &value) == True) { \
|
||||
if (value.addr != NULL && strnlen(value.addr, 8) == 7 && value.addr[0] == '#') { \
|
||||
int i = 1; \
|
||||
for (; i <= 6; i++) { \
|
||||
if (value.addr[i] < 48) break; \
|
||||
if (value.addr[i] > 57 && value.addr[i] < 65) break; \
|
||||
if (value.addr[i] > 70 && value.addr[i] < 97) break; \
|
||||
if (value.addr[i] > 102) break; \
|
||||
} \
|
||||
if (i == 7) { \
|
||||
strncpy(V, value.addr, 7); \
|
||||
V[7] = '\0'; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
static void loadxrdb(void);
|
||||
static void xrdb(const Arg *arg);
|
||||
|
||||
|
Loading…
Add table
Reference in a new issue