make most layouts non-optional for maintainence sake
This commit is contained in:
parent
1ef5ee9734
commit
d0cbbe9718
52
layouts.c
52
layouts.c
|
@ -1,11 +1,6 @@
|
|||
/* This C code handles all layouts.
|
||||
* You may choose to remove layouts here if you don't find them useful.
|
||||
*
|
||||
* Luckily for you though, I've added simple options to disable them from getting compiled into the code at all.
|
||||
* To change options, edit toggle.h.
|
||||
/* This C code handles all built in layouts.
|
||||
*/
|
||||
|
||||
#if LAYOUT_TILE
|
||||
static void
|
||||
tile(Monitor *m)
|
||||
{
|
||||
|
@ -44,9 +39,7 @@ tile(Monitor *m)
|
|||
sy += HEIGHT(c) + ih;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LAYOUT_MONOCLE
|
||||
void
|
||||
monocle(Monitor *m)
|
||||
{
|
||||
|
@ -71,9 +64,7 @@ monocle(Monitor *m)
|
|||
if (!c->isfloating && ISVISIBLE(c))
|
||||
XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LAYOUT_GRID
|
||||
void
|
||||
grid(Monitor *m)
|
||||
{
|
||||
|
@ -103,9 +94,7 @@ grid(Monitor *m)
|
|||
resize(c, cx, cy, cw + (cc < cwrest ? 1 : 0) - 2*c->bw, ch + (cr < chrest ? 1 : 0) - 2*c->bw, False);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LAYOUT_FIBO
|
||||
void
|
||||
fibonacci(Monitor *m, int s)
|
||||
{
|
||||
|
@ -192,25 +181,19 @@ fibonacci(Monitor *m, int s)
|
|||
resize(c, nx, ny, nw - (2*c->bw), nh - (2*c->bw), False);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LAYOUT_DWINDLE
|
||||
void
|
||||
dwindle(Monitor *m)
|
||||
{
|
||||
fibonacci(m, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LAYOUT_SPIRAL
|
||||
void
|
||||
spiral(Monitor *m)
|
||||
{
|
||||
fibonacci(m, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LAYOUT_BSTACK
|
||||
static void
|
||||
bstack(Monitor *m)
|
||||
{
|
||||
|
@ -251,9 +234,7 @@ bstack(Monitor *m)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LAYOUT_BSTACKH
|
||||
static void
|
||||
bstackhoriz(Monitor *m)
|
||||
{
|
||||
|
@ -295,9 +276,7 @@ bstackhoriz(Monitor *m)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LAYOUT_HGRID
|
||||
void
|
||||
horizgrid(Monitor *m) {
|
||||
Client *c;
|
||||
|
@ -358,9 +337,7 @@ horizgrid(Monitor *m) {
|
|||
sx += WIDTH(c) + iv;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LAYOUT_DGRID
|
||||
void
|
||||
dynamicgrid(Monitor *m)
|
||||
{
|
||||
|
@ -414,9 +391,7 @@ dynamicgrid(Monitor *m)
|
|||
resize(c, cx, cy, cw - (2*c->bw), ch - (2*c->bw), 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LAYOUT_TATAMI
|
||||
void
|
||||
tatami(Monitor *m) {
|
||||
unsigned int i, n, nx, ny, nw, nh,
|
||||
|
@ -574,9 +549,7 @@ tatami(Monitor *m) {
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LAYOUT_CM
|
||||
void
|
||||
centeredmaster(Monitor *m)
|
||||
{
|
||||
|
@ -661,9 +634,7 @@ centeredmaster(Monitor *m)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LAYOUT_CFM
|
||||
void
|
||||
centeredfloatingmaster(Monitor *m)
|
||||
{
|
||||
|
@ -716,9 +687,7 @@ centeredfloatingmaster(Monitor *m)
|
|||
sx += WIDTH(c) + iv;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LAYOUT_DECK
|
||||
void
|
||||
deck(Monitor *m)
|
||||
{
|
||||
|
@ -759,7 +728,6 @@ deck(Monitor *m)
|
|||
resize(c, sx, sy, sw - (2*c->bw), sh - (2*c->bw), 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LAYOUT_CUSTOM
|
||||
enum node_type_t
|
||||
|
@ -855,7 +823,8 @@ int is_terminal(char c)
|
|||
|| c == '\0';
|
||||
}
|
||||
|
||||
void free_node(node_t *node)
|
||||
void
|
||||
free_node(node_t *node)
|
||||
{
|
||||
for ( node_t *n = node;
|
||||
n != NULL; )
|
||||
|
@ -890,7 +859,8 @@ node_t* reverse_node(node_t *node)
|
|||
return (b ? b : a);
|
||||
}
|
||||
|
||||
void node_length(node_t *node, unsigned *len, float *weight)
|
||||
void
|
||||
node_length(node_t *node, unsigned *len, float *weight)
|
||||
{
|
||||
unsigned n = 0;
|
||||
float w = 0.0;
|
||||
|
@ -926,7 +896,8 @@ struct client_ref_t* copy_clients(Client *clients)
|
|||
return head.next;
|
||||
}
|
||||
|
||||
void free_clients(struct client_ref_t *clients)
|
||||
void
|
||||
free_clients(struct client_ref_t *clients)
|
||||
{
|
||||
struct client_ref_t *nxt = NULL;
|
||||
while (clients != NULL) {
|
||||
|
@ -1093,7 +1064,8 @@ struct frame_t
|
|||
int x, y, w, h;
|
||||
};
|
||||
|
||||
void s_recur_resize(node_t *node, struct frame_t frame)
|
||||
void
|
||||
s_recur_resize(node_t *node, struct frame_t frame)
|
||||
{
|
||||
if (node == NULL) return;
|
||||
|
||||
|
@ -1182,7 +1154,8 @@ void s_recur_resize(node_t *node, struct frame_t frame)
|
|||
}
|
||||
|
||||
/* Main layout function. */
|
||||
void custom(Monitor *m)
|
||||
void
|
||||
custom(Monitor *m)
|
||||
{
|
||||
/* Need to clone the client stack, as we might need to pull items from it. */
|
||||
struct client_ref_t *clients = copy_clients(m->clients),
|
||||
|
@ -1500,7 +1473,8 @@ node_t* parse_sexp(string_token_t **token)
|
|||
return head;
|
||||
}
|
||||
|
||||
void set_s_layout(const Arg *arg)
|
||||
void
|
||||
set_s_layout(const Arg *arg)
|
||||
{
|
||||
FILE *pp, *hf;
|
||||
|
||||
|
|
55
signal.h
55
signal.h
|
@ -5,7 +5,21 @@
|
|||
* Once you're done with your edits, run 'make clean install'. */
|
||||
static Signal signals[] = {
|
||||
/* signum function argument */
|
||||
{ 1, setlayout, {.v = &layouts[0]} }, /* Tiling layout */
|
||||
{ 2, setlayout, {.v = &layouts[1]} }, /* Floating layout */
|
||||
{ 3, setlayout, {.v = &layouts[2]} }, /* Monocle layout */
|
||||
{ 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 */
|
||||
{ 8, setlayout, {.v = &layouts[7]} }, /* Fibonacci Spiral layout */
|
||||
{ 9, setlayout, {.v = &layouts[8]} }, /* Fibonacci Dwindle layout */
|
||||
{ 10, setlayout, {.v = &layouts[9]} }, /* Bottom Stack layout */
|
||||
{ 11, setlayout, {.v = &layouts[10]} }, /* Horizontal Bottom Stack layout */
|
||||
{ 12, setlayout, {.v = &layouts[11]} }, /* Horizontal Grid layout */
|
||||
{ 13, setlayout, {.v = &layouts[12]} }, /* Dynamic Grid layout */
|
||||
#if LAYOUT_CUSTOM
|
||||
{ 14, setlayout, {.v = &layouts[13]} }, /* Custom layout */
|
||||
{ 15, set_s_layout, {.v = &layouts[13]} },
|
||||
#endif
|
||||
{ 16, cyclelayout, {.i = +1 } },
|
||||
|
@ -90,45 +104,4 @@ static Signal signals[] = {
|
|||
{ 91, resetbarpaddingv, {0} },
|
||||
{ 92, resetbarpaddingh, {0} },
|
||||
{ 93, resetbarpadding, {0} },
|
||||
|
||||
#if LAYOUT_TILE
|
||||
{ 1, setlayout, {.v = &layouts[0]} }, /* Tiling layout */
|
||||
#endif
|
||||
{ 2, setlayout, {.v = &layouts[1]} }, /* Floating layout */
|
||||
#if LAYOUT_MONOCLE
|
||||
{ 3, setlayout, {.v = &layouts[2]} }, /* Monocle layout */
|
||||
#endif
|
||||
#if LAYOUT_GRID
|
||||
{ 4, setlayout, {.v = &layouts[3]} }, /* Grid layout */
|
||||
#endif
|
||||
#if LAYOUT_DECK
|
||||
{ 5, setlayout, {.v = &layouts[4]} }, /* Deck layout */
|
||||
#endif
|
||||
#if LAYOUT_CM
|
||||
{ 6, setlayout, {.v = &layouts[5]} }, /* Centered Master layout */
|
||||
#endif
|
||||
#if LAYOUT_CFM
|
||||
{ 7, setlayout, {.v = &layouts[6]} }, /* Centered Floating Master layout */
|
||||
#endif
|
||||
#if LAYOUT_SPIRAL
|
||||
{ 8, setlayout, {.v = &layouts[7]} }, /* Fibonacci Spiral layout */
|
||||
#endif
|
||||
#if LAYOUT_DWINDLE
|
||||
{ 9, setlayout, {.v = &layouts[8]} }, /* Fibonacci Dwindle layout */
|
||||
#endif
|
||||
#if LAYOUT_BSTACK
|
||||
{ 10, setlayout, {.v = &layouts[9]} }, /* Bottom Stack layout */
|
||||
#endif
|
||||
#if LAYOUT_BSTACKH
|
||||
{ 11, setlayout, {.v = &layouts[10]} }, /* Horizontal Bottom Stack layout */
|
||||
#endif
|
||||
#if LAYOUT_HGRID
|
||||
{ 12, setlayout, {.v = &layouts[11]} }, /* Horizontal Grid layout */
|
||||
#endif
|
||||
#if LAYOUT_DGRID
|
||||
{ 13, setlayout, {.v = &layouts[12]} }, /* Dynamic Grid layout */
|
||||
#endif
|
||||
#if LAYOUT_CUSTOM
|
||||
{ 14, setlayout, {.v = &layouts[13]} }, /* Custom layout */
|
||||
#endif
|
||||
};
|
||||
|
|
192
speedwm.c
192
speedwm.c
|
@ -177,23 +177,23 @@ typedef struct {
|
|||
typedef struct Monitor Monitor;
|
||||
typedef struct Client Client;
|
||||
struct Client {
|
||||
char name[256];
|
||||
char name[256]; /* window manager name */
|
||||
float mina, maxa;
|
||||
float cfact;
|
||||
int x, y, w, h;
|
||||
float cfact; /* cfact for the client */
|
||||
int x, y, w, h; /* x/y position, width and height */
|
||||
int sfx, sfy, sfw, sfh; /* stored float geometry, used on mode revert */
|
||||
int oldx, oldy, oldw, oldh;
|
||||
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
||||
int hintsvalid; /* https://git.suckless.org/dwm/commit/8806b6e2379372900e3d9e0bf6604bc7f727350b.html */
|
||||
int bw, oldbw;
|
||||
unsigned int tags;
|
||||
int isfixed, ispermanent, isfloating, isurgent, neverfocus, oldstate, isfullscreen, ignoretransient, issticky, isterminal, noswallow, needresize;
|
||||
unsigned int tags; /* tags */
|
||||
int isfixed, ispermanent, isfloating, isurgent, neverfocus, oldstate, isfullscreen, ignoretransient, issticky, isterminal, noswallow, needresize; /* window rules */
|
||||
pid_t pid;
|
||||
char scratchkey;
|
||||
char scratchkey; /* scratchpad key */
|
||||
#if USEWINICON
|
||||
unsigned int icw, ich; Picture icon;
|
||||
unsigned int icw, ich; Picture icon; /* icon height/width */
|
||||
#endif
|
||||
int issteam;
|
||||
int issteam; /* steam specific fix */
|
||||
int beingmoved;
|
||||
Client *next;
|
||||
Client *snext;
|
||||
|
@ -226,13 +226,13 @@ typedef struct {
|
|||
|
||||
typedef struct Pertag Pertag;
|
||||
struct Monitor {
|
||||
char ltsymbol[16];
|
||||
char ltsymbol[16]; /* current layout symbol */
|
||||
#if USEIPC
|
||||
char lastltsymbol[16];
|
||||
char lastltsymbol[16]; /* previous layout symbol */
|
||||
#endif
|
||||
float mfact;
|
||||
float cfact;
|
||||
int mastercount;
|
||||
float mfact; /* mfact value */
|
||||
float cfact; /* cfact value */
|
||||
int mastercount; /* number of clients in the master stack */
|
||||
int num;
|
||||
int by, bh; /* bar geometry */
|
||||
int tx, tw; /* bar tray geometry */
|
||||
|
@ -240,16 +240,16 @@ struct Monitor {
|
|||
int bt;
|
||||
int mx, my, mw, mh; /* screen size */
|
||||
int wx, wy, ww, wh; /* window area */
|
||||
int gapsizeih; /* horizontal gap between windows */
|
||||
int gapsizeiv; /* vertical gap between windows */
|
||||
int gapsizeoh; /* horizontal outer gaps */
|
||||
int gapsizeov; /* vertical outer gaps */
|
||||
int gapsizeih; /* horizontal gap between windows */
|
||||
int gapsizeiv; /* vertical gap between windows */
|
||||
int gapsizeoh; /* horizontal outer gaps */
|
||||
int gapsizeov; /* vertical outer gaps */
|
||||
#if USESWITCHER
|
||||
int switchern; /* move that many clients forward */
|
||||
int nclients; /* number of active clients in tag */
|
||||
int isswitching; /* 1,0 */
|
||||
int maxwidth;
|
||||
int maxheight;
|
||||
int maxwidth; /* max width of window */
|
||||
int maxheight; /* max height of window */
|
||||
#endif
|
||||
unsigned int seltags;
|
||||
unsigned int sellt;
|
||||
|
@ -283,7 +283,9 @@ struct Monitor {
|
|||
|
||||
int hidsel;
|
||||
int isreset;
|
||||
int allowwarp;
|
||||
#if USEMOUSE
|
||||
int allowwarp; /* allow warping or not. this allows us to only allow warping under certain conditions and disable it whenever we want */
|
||||
#endif
|
||||
Client *clients;
|
||||
Client *sel;
|
||||
#if USEIPC
|
||||
|
@ -354,20 +356,8 @@ typedef struct {
|
|||
|
||||
/* function declarations */
|
||||
static void applyrules(Client *c);
|
||||
#if LAYOUT_CM
|
||||
static void centeredmaster(Monitor *m);
|
||||
#endif
|
||||
#if LAYOUT_CFM
|
||||
static void centeredfloatingmaster(Monitor *m);
|
||||
#endif
|
||||
#if LAYOUT_TW
|
||||
static void tilewide(Monitor *m);
|
||||
#endif
|
||||
static void getgaps(Monitor *m, int *oh, int *ov, int *ih, int *iv, unsigned int *nc);
|
||||
static void getfacts(Monitor *m, int msize, int ssize, float *mf, float *sf, int *mr, int *sr);
|
||||
#if LAYOUT_STAIRS
|
||||
static void stairs(Monitor *m);
|
||||
#endif
|
||||
static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact);
|
||||
static void inplacerotate(const Arg *arg);
|
||||
static void togglesticky(const Arg *arg);
|
||||
|
@ -401,9 +391,6 @@ static void autostart_exec(void);
|
|||
static void moveresize(const Arg *arg);
|
||||
static void moveresizeedge(const Arg *arg);
|
||||
static Monitor *createmon(void);
|
||||
#if LAYOUT_DECK
|
||||
static void deck(Monitor *m);
|
||||
#endif
|
||||
static void cyclelayout(const Arg *arg);
|
||||
static void destroynotify(XEvent *e);
|
||||
static void detach(Client *c);
|
||||
|
@ -571,40 +558,23 @@ static void unmanagetray(Window w);
|
|||
static void tagmon(const Arg *arg);
|
||||
|
||||
/* layouts */
|
||||
#if LAYOUT_TILE
|
||||
static void tile(Monitor *m);
|
||||
#endif
|
||||
#if LAYOUT_DECK
|
||||
static void deck(Monitor *m);
|
||||
#endif
|
||||
#if LAYOUT_MONOCLE
|
||||
static void monocle(Monitor *m);
|
||||
#endif
|
||||
#if LAYOUT_GRID
|
||||
static void grid(Monitor *m);
|
||||
#endif
|
||||
#if LAYOUT_SPIRAL
|
||||
static void deck(Monitor *m);
|
||||
static void spiral(Monitor *m);
|
||||
#endif
|
||||
#if LAYOUT_BSTACK
|
||||
static void dwindle(Monitor *m);
|
||||
static void bstack(Monitor *m);
|
||||
#endif
|
||||
#if LAYOUT_BSTACKH
|
||||
static void bstackhoriz(Monitor *m);
|
||||
#endif
|
||||
#if LAYOUT_HGRID
|
||||
static void horizgrid(Monitor *m);
|
||||
#endif
|
||||
#if LAYOUT_DGRID
|
||||
static void dynamicgrid(Monitor *m);
|
||||
#endif
|
||||
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);
|
||||
#endif
|
||||
#if LAYOUT_DWINDLE
|
||||
static void dwindle(Monitor *m);
|
||||
#endif
|
||||
|
||||
/* bar items */
|
||||
static void togglebar(const Arg *arg);
|
||||
|
@ -638,15 +608,28 @@ static void togglebarpaddingv(const Arg *arg);
|
|||
static void togglebarpaddingh(const Arg *arg);
|
||||
static void togglebarpadding(const Arg *arg);
|
||||
|
||||
/* icon */
|
||||
#if USEWINICON
|
||||
static void updateicon(Client *c);
|
||||
static void freeicon(Client *c);
|
||||
#endif
|
||||
|
||||
/* tag previews */
|
||||
#if USETAGPREVIEW
|
||||
static void updatepreview(void);
|
||||
#endif
|
||||
|
||||
/* mouse */
|
||||
#if USEMOUSE
|
||||
static void togglewin(const Arg *arg);
|
||||
static void resizemouse(const Arg *arg);
|
||||
static void warp(const Client *c);
|
||||
#endif
|
||||
static void unfocus(Client *c, int setfocus);
|
||||
static void unmanage(Client *c, int destroyed);
|
||||
static void unmapnotify(XEvent *e);
|
||||
|
||||
/* update functions */
|
||||
static void updatecurrentdesktop(void);
|
||||
static void updatebarpos(Monitor *m);
|
||||
static void updatebars(void);
|
||||
|
@ -654,47 +637,49 @@ static void updateclientlist(void);
|
|||
static int updategeom(void);
|
||||
static void updatemotifhints(Client *c);
|
||||
static void updatenumlockmask(void);
|
||||
#if USEMOUSE
|
||||
static void resizemouse(const Arg *arg);
|
||||
#endif
|
||||
static void updatesizehints(Client *c);
|
||||
static void updatestatus(void);
|
||||
static void updaterules(Client *c);
|
||||
static void updatetitle(Client *c);
|
||||
#if USETAGPREVIEW
|
||||
static void updatepreview(void);
|
||||
#endif
|
||||
#if USEWINICON
|
||||
static void updateicon(Client *c);
|
||||
#endif
|
||||
static void updatewindowtype(Client *c);
|
||||
static void updatewmhints(Client *c);
|
||||
|
||||
static void toggleview(const Arg *arg);
|
||||
static void tag(const Arg *arg);
|
||||
|
||||
/* view functions */
|
||||
static void view(const Arg *arg);
|
||||
static void viewtoleft(const Arg *arg);
|
||||
static void viewtoright(const Arg *arg);
|
||||
static void viewtoleft_vacant(const Arg *arg);
|
||||
static void viewtoright_vacant(const Arg *arg);
|
||||
static void warp(const Client *c);
|
||||
|
||||
static Client *wintoclient(Window w);
|
||||
static Monitor *wintomon(Window w);
|
||||
static int wmclasscontains(Window win, const char *class, const char *name);
|
||||
|
||||
/* X11 error */
|
||||
static int xerror(Display *dpy, XErrorEvent *ee);
|
||||
static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
||||
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
||||
|
||||
static void xinitvisual();
|
||||
static void zoom(const Arg *arg);
|
||||
|
||||
/* switcher funcs */
|
||||
#if USESWITCHER
|
||||
void drawswitcher(int nwins, int first, Monitor *m);
|
||||
void switcherstart(const Arg *arg);
|
||||
static void switcherend();
|
||||
#endif
|
||||
|
||||
/* Xresources funcs */
|
||||
#if USEXRESOURCES
|
||||
static void load_xresources(void);
|
||||
static void reloadcolors(const Arg *arg);
|
||||
static void resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst);
|
||||
#endif
|
||||
|
||||
static pid_t getparentprocess(pid_t p);
|
||||
static int isdescprocess(pid_t p, pid_t c);
|
||||
static Client *swallowingclient(Window w);
|
||||
|
@ -798,9 +783,8 @@ static xcb_connection_t *xcon;
|
|||
/* Shell command */
|
||||
#define RCMD(cmd) {.v = (const char*[]){ shell, "-c", cmd, NULL } },
|
||||
#define cmd( cmd ) {.v = (const char*[]){ shell, "-c", cmd, NULL } },
|
||||
#define SESSION_FILE "/tmp/speedwm-session"
|
||||
|
||||
static const char *statuscmd[] = { "/bin/sh", "-c", NULL, NULL };
|
||||
static const char *statuscmd[] = { "/bin/sh", "-c", NULL, NULL }; /* for running click scripts */
|
||||
|
||||
/* Media controls */
|
||||
#if USEMEDIA
|
||||
|
@ -1344,6 +1328,7 @@ checkotherwm(void)
|
|||
XSync(dpy, False);
|
||||
}
|
||||
|
||||
/* clean up the wm */
|
||||
void
|
||||
cleanup(void)
|
||||
{
|
||||
|
@ -1395,6 +1380,7 @@ cleanup(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
/* clean up on the selected monitor only */
|
||||
void
|
||||
cleanupmon(Monitor *mon)
|
||||
{
|
||||
|
@ -1555,6 +1541,7 @@ configurenotify(XEvent *e)
|
|||
}
|
||||
}
|
||||
|
||||
/* draw rounded corners for current client */
|
||||
#if USEROUNDCORNERS
|
||||
void
|
||||
drawroundedcorners(Client *c)
|
||||
|
@ -1658,6 +1645,7 @@ configurerequest(XEvent *e)
|
|||
XSync(dpy, False);
|
||||
}
|
||||
|
||||
/* copy status chars so we can hack on the text */
|
||||
void
|
||||
copyvalidchars(char *text, char *rawtext)
|
||||
{
|
||||
|
@ -1671,6 +1659,7 @@ copyvalidchars(char *text, char *rawtext)
|
|||
text[j] = '\0';
|
||||
}
|
||||
|
||||
/* init monitor */
|
||||
Monitor *
|
||||
createmon(void)
|
||||
{
|
||||
|
@ -1773,6 +1762,7 @@ destroynotify(XEvent *e)
|
|||
unmanagetray(ev->window);
|
||||
}
|
||||
|
||||
/* run ltmenu */
|
||||
#if USEMOUSE
|
||||
void
|
||||
layoutmenu(const Arg *arg) {
|
||||
|
@ -1855,6 +1845,7 @@ dirtomon(int dir)
|
|||
return m;
|
||||
}
|
||||
|
||||
/* drag cfact with mouse */
|
||||
#if USEMOUSE
|
||||
void
|
||||
dragcfact(const Arg *arg)
|
||||
|
@ -1952,6 +1943,9 @@ readAndSetColor(int clrIdx, char* txt) {
|
|||
}
|
||||
}
|
||||
|
||||
/* get length of printed status
|
||||
*
|
||||
* w/o this, status2d chars are included in click pos */
|
||||
int
|
||||
statuslength(char* stext)
|
||||
{
|
||||
|
@ -1992,6 +1986,7 @@ statuslength(char* stext)
|
|||
return w;
|
||||
}
|
||||
|
||||
/* draw statusbar text */
|
||||
int
|
||||
drawstatusbar(Monitor *m, int bh, char* stext) {
|
||||
int ret, i, j, w, x, len;
|
||||
|
@ -2113,6 +2108,7 @@ drawstatusbar(Monitor *m, int bh, char* stext) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* drag mfact with mouse */
|
||||
#if USEMOUSE
|
||||
void
|
||||
dragmfact(const Arg *arg)
|
||||
|
@ -2142,41 +2138,22 @@ dragmfact(const Arg *arg)
|
|||
|
||||
if (!n)
|
||||
return;
|
||||
#if LAYOUT_CM
|
||||
else if (m->lt[m->sellt]->arrange == ¢eredmaster && (fixed || n - m->mastercount > 1))
|
||||
center = 1;
|
||||
#endif
|
||||
#if LAYOUT_CFM
|
||||
else if (m->lt[m->sellt]->arrange == ¢eredfloatingmaster)
|
||||
center = 1;
|
||||
#endif
|
||||
#if LAYOUT_BSTACK
|
||||
else if (m->lt[m->sellt]->arrange == &bstack)
|
||||
horizontal = 1;
|
||||
#endif
|
||||
#if LAYOUT_BSTACKH
|
||||
else if (m->lt[m->sellt]->arrange == &bstackhoriz)
|
||||
horizontal = 1;
|
||||
#endif
|
||||
|
||||
/* 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 */
|
||||
#if LAYOUT_MONOCLE
|
||||
|| m->lt[m->sellt]->arrange == &monocle
|
||||
#endif
|
||||
#if LAYOUT_GRID
|
||||
|| m->lt[m->sellt]->arrange == &grid
|
||||
#endif
|
||||
#if LAYOUT_HGRID
|
||||
|| m->lt[m->sellt]->arrange == &horizgrid
|
||||
#endif
|
||||
#if LAYOUT_DGRID
|
||||
|| m->lt[m->sellt]->arrange == &dynamicgrid
|
||||
#endif
|
||||
#if LAYOUT_NGRID
|
||||
|| m->lt[m->sellt]->arrange == &nrowgrid
|
||||
#endif
|
||||
|| 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;
|
||||
|
||||
|
@ -2392,7 +2369,6 @@ resizebarwin(m);
|
|||
}
|
||||
}
|
||||
|
||||
#if LAYOUT_MONOCLE
|
||||
/* override layout icon with number of layouts */
|
||||
if (monoclecount) {
|
||||
if (m->lt[m->sellt]->arrange == monocle) {
|
||||
|
@ -2404,7 +2380,6 @@ resizebarwin(m);
|
|||
snprintf(m->ltsymbol, sizeof m->ltsymbol, monocleformat, s, a);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* draw the layout bar on the right if layoutposition is not 0 */
|
||||
if (!layoutposition && !selmon->hidelayout) {
|
||||
|
@ -2630,10 +2605,8 @@ focus(Client *c)
|
|||
XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
|
||||
}
|
||||
selmon->sel = c;
|
||||
#if LAYOUT_MONOCLE
|
||||
if (selmon->lt[selmon->sellt]->arrange == monocle)
|
||||
arrangemon(selmon);
|
||||
#endif
|
||||
drawbar();
|
||||
}
|
||||
|
||||
|
@ -2680,7 +2653,9 @@ focusmon(const Arg *arg)
|
|||
{
|
||||
Monitor *m;
|
||||
|
||||
#if USEMOUSE
|
||||
selmon->allowwarp = 1; /* allow warp */
|
||||
#endif
|
||||
|
||||
if (!mons->next)
|
||||
return;
|
||||
|
@ -2690,10 +2665,12 @@ focusmon(const Arg *arg)
|
|||
selmon = m;
|
||||
focus(NULL);
|
||||
|
||||
#if USEMOUSE
|
||||
if (warpcursor)
|
||||
warp(selmon->sel);
|
||||
|
||||
selmon->allowwarp = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2741,13 +2718,17 @@ focusstack(int inc, int hid)
|
|||
c = i;
|
||||
}
|
||||
|
||||
#if USEMOUSE
|
||||
selmon->allowwarp = 1;
|
||||
#endif
|
||||
|
||||
if (c) {
|
||||
focus(c);
|
||||
restack(selmon);
|
||||
|
||||
#if USEMOUSE
|
||||
selmon->allowwarp = 0;
|
||||
#endif
|
||||
|
||||
if (HIDDEN(c)) {
|
||||
showwin(c);
|
||||
|
@ -3656,12 +3637,15 @@ manage(Window w, XWindowAttributes *wa)
|
|||
if (term)
|
||||
swallow(term, c);
|
||||
arrange(c->mon);
|
||||
if (focusspawn && !warpcursor) {
|
||||
focus(c); /* Auto focus next spawned window */
|
||||
} else {
|
||||
focus(NULL); /* No need if warpcursor is enabled because warpcursor is going to warp and focus the window anyway */
|
||||
}
|
||||
|
||||
#if USEMOUSE
|
||||
if (focusspawn && !warpcursor)
|
||||
focus(c); /* auto focus next spawned window */
|
||||
#else
|
||||
if (focusspawn)
|
||||
focus(c); /* auto focus next spawned window */
|
||||
#endif
|
||||
else
|
||||
focus(NULL); /* no need if warpcursor is enabled because warpcursor is going to warp and focus the window anyway */
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -4819,10 +4803,12 @@ restack(Monitor *m)
|
|||
XSync(dpy, False);
|
||||
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
||||
|
||||
#if USEMOUSE
|
||||
if (warpcursor) {
|
||||
if (m == selmon && selmon->allowwarp && (m->tagset[m->seltags] & m->sel->tags) && selmon->lt[selmon->sellt] != &layouts[2])
|
||||
warp(m->sel);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -6506,6 +6492,7 @@ view(const Arg *arg)
|
|||
updatecurrentdesktop();
|
||||
}
|
||||
|
||||
#if USEMOUSE
|
||||
void
|
||||
warp(const Client *c)
|
||||
{
|
||||
|
@ -6527,6 +6514,7 @@ warp(const Client *c)
|
|||
|
||||
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w / 2, c->h / 2);
|
||||
}
|
||||
#endif
|
||||
|
||||
pid_t
|
||||
winpid(Window w)
|
||||
|
|
53
text.h
53
text.h
|
@ -26,46 +26,21 @@ static char *usedtags[] = { text_tag1_used, /* Tag 1 text
|
|||
|
||||
/* Text for layouts */
|
||||
static Layout layouts[] = {
|
||||
#if LAYOUT_TILE
|
||||
{ text_layout1, tile, },
|
||||
#endif
|
||||
/* floating layout (if no layout is available */
|
||||
{ text_layout2, NULL, },
|
||||
#if LAYOUT_MONOCLE
|
||||
{ text_layout3, monocle, },
|
||||
#endif
|
||||
#if LAYOUT_GRID
|
||||
{ text_layout4, grid },
|
||||
#endif
|
||||
#if LAYOUT_DECK
|
||||
{ text_layout5, deck },
|
||||
#endif
|
||||
#if LAYOUT_CM
|
||||
{ text_layout6, centeredmaster },
|
||||
#endif
|
||||
#if LAYOUT_CFM
|
||||
{ text_layout7, centeredfloatingmaster },
|
||||
#endif
|
||||
#if LAYOUT_SPIRAL
|
||||
{ text_layout8, spiral },
|
||||
#endif
|
||||
#if LAYOUT_DWINDLE
|
||||
{ text_layout9, dwindle },
|
||||
#endif
|
||||
#if LAYOUT_BSTACK
|
||||
{ text_layout10, bstack },
|
||||
#endif
|
||||
#if LAYOUT_BSTACKH
|
||||
{ text_layout11, bstackhoriz },
|
||||
#endif
|
||||
#if LAYOUT_HGRID
|
||||
{ text_layout12, horizgrid },
|
||||
#endif
|
||||
#if LAYOUT_DGRID
|
||||
{ text_layout13, dynamicgrid },
|
||||
#endif
|
||||
{ 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 */
|
||||
#if LAYOUT_CUSTOM
|
||||
{ text_layout14, custom },
|
||||
{ text_layout14, custom }, /* custom layout */
|
||||
#endif
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
|
14
toggle.h
14
toggle.h
|
@ -40,18 +40,4 @@ Not compatible with BSDs so for those, set this to 0. */
|
|||
/* Layouts
|
||||
* If you don't use a layout, you can remove it to keep the speedwm binary small.
|
||||
*/
|
||||
#define LAYOUT_TILE 1 /* Whether or not to include the tiling layout */
|
||||
#define LAYOUT_MONOCLE 1 /* Whether or not to include the monocle layout */
|
||||
#define LAYOUT_GRID 1 /* Whether or not to include the grid layout */
|
||||
#define LAYOUT_FIBO 1 /* Whether or not to include the fibonacci layout */
|
||||
#define LAYOUT_DWINDLE 1 /* Whether or not to include the dwindle layout */
|
||||
#define LAYOUT_DECK 1 /* Whether or not to include the deck layout */
|
||||
#define LAYOUT_SPIRAL 1 /* Whether or not to include the spiral layout */
|
||||
#define LAYOUT_BSTACK 1 /* Whether or not to include the bottom stack layout */
|
||||
#define LAYOUT_BSTACKH 1 /* Whether or not to include the horizontal bottom stack layout */
|
||||
#define LAYOUT_HGRID 1 /* Whether or not to include the horizontal grid layout */
|
||||
#define LAYOUT_DGRID 1 /* Whether or not to include the dynamic grid layout */
|
||||
#define LAYOUT_CM 1 /* Whether or not to include the centered master layout */
|
||||
#define LAYOUT_CFM 1 /* Whether or not to include the centered floating master layout */
|
||||
#define LAYOUT_COL 1 /* Whether or not to include the column layout */
|
||||
#define LAYOUT_CUSTOM 1 /* Whether or not to include the custom layout */
|
||||
|
|
|
@ -136,15 +136,11 @@ ResourcePref resources[] = {
|
|||
{ "systray.position", INTEGER, &systrayposition },
|
||||
{ "systray.padding", INTEGER, &systrayspacing },
|
||||
#endif
|
||||
#if LAYOUT_MONOCLE
|
||||
{ "layout.monocle.format", STRING, &monocleformat },
|
||||
{ "layout.monocle.clientcount", INTEGER, &monocleclientcount },
|
||||
{ "layout.monocle.count", INTEGER, &monoclecount },
|
||||
#endif
|
||||
#if LAYOUT_DECK
|
||||
{ "layout.deck.format", STRING, &deckformat },
|
||||
{ "layout.deck.count", INTEGER, &deckcount },
|
||||
#endif
|
||||
#if USEWINICON
|
||||
{ "icon.size", INTEGER, &iconsize },
|
||||
{ "icon.spacing", INTEGER, &iconspacing },
|
||||
|
@ -167,9 +163,6 @@ ResourcePref resources[] = {
|
|||
#if USEROUNDCORNERS
|
||||
{ "border.roundedcorners", INTEGER, &roundedcorners },
|
||||
{ "border.cornerradius", INTEGER, &cornerradius },
|
||||
#endif
|
||||
#if LAYOUT_DGRID
|
||||
{ "layout.dgrid.forcevsplit", INTEGER, &forcevsplit },
|
||||
#endif
|
||||
/* Traditional color system support (for example useful for Pywal) */
|
||||
{ "color0", STRING, &col_background },
|
||||
|
|
Loading…
Reference in a new issue