From f9c027c421a294941cae561e0eded96feca1ddc3 Mon Sep 17 00:00:00 2001 From: speedie Date: Sat, 3 Dec 2022 15:25:31 +0100 Subject: [PATCH] implement bar modules and barpadding support. still lots to do --- bar.h | 19 + bar/items.c | 5 + bar/items.h | 5 + bar/layoutindicator.c | 17 + bar/layoutindicator.h | 3 + bar/statusbar.c | 19 + bar/statusbar.h | 3 + bar/tags.c | 55 ++ bar/tags.h | 3 + bar/title.c | 31 + bar/title.h | 3 + host.mk | 2 +- keybinds.h | 11 +- signal.h | 4 + speedwm.c | 1799 +++++++---------------------------------- toggle.h | 8 +- 16 files changed, 465 insertions(+), 1522 deletions(-) create mode 100644 bar.h create mode 100644 bar/items.c create mode 100644 bar/items.h create mode 100644 bar/layoutindicator.c create mode 100644 bar/layoutindicator.h create mode 100644 bar/statusbar.c create mode 100644 bar/statusbar.h create mode 100644 bar/tags.c create mode 100644 bar/tags.h create mode 100644 bar/title.c create mode 100644 bar/title.h diff --git a/bar.h b/bar.h new file mode 100644 index 0000000..d1d4cb4 --- /dev/null +++ b/bar.h @@ -0,0 +1,19 @@ +/* Bar rules allow you to configure what is shown where on the bar, as well as + * introducing your own bar modules. + * + * monitor: + * -1 show on all monitors + * 0 show on monitor 0 + * 'A' show on active monitor (i.e. focused / selected) (or just -1 for active?) + * bar - bar index, 0 is default, 1 is extrabar + * alignment - how the module is aligned compared to other modules + * widthfunc, drawfunc, clickfunc - providing bar module width, draw and click functions + * name - does nothing, intended for visual clue and for logging / debugging + */ +static const BarRule barrules[] = { + /* monitor bar alignment widthfunc drawfunc clickfunc name */ + { -1, 0, BAR_ALIGN_RIGHT, width_tags, draw_tags, click_tags, "tags" }, + { -1, 0, BAR_ALIGN_LEFT, width_ltsymbol, draw_ltsymbol, click_ltsymbol, "layout" }, + { 'A', 0, BAR_ALIGN_LEFT, width_status, draw_status, click_status, "status" }, + { -1, 0, BAR_ALIGN_NONE, width_wintitle, draw_wintitle, click_wintitle, "wintitle" }, +}; diff --git a/bar/items.c b/bar/items.c new file mode 100644 index 0000000..55d2597 --- /dev/null +++ b/bar/items.c @@ -0,0 +1,5 @@ +/* Todo: fill this with shit */ +#include "tags.c" +#include "layoutindicator.c" +#include "statusbar.c" +#include "title.c" diff --git a/bar/items.h b/bar/items.h new file mode 100644 index 0000000..1eb2443 --- /dev/null +++ b/bar/items.h @@ -0,0 +1,5 @@ +/* Todo: fill this with shit */ +#include "tags.h" +#include "layoutindicator.h" +#include "statusbar.h" +#include "title.h" diff --git a/bar/layoutindicator.c b/bar/layoutindicator.c new file mode 100644 index 0000000..d3c8f72 --- /dev/null +++ b/bar/layoutindicator.c @@ -0,0 +1,17 @@ +int +width_ltsymbol(Bar *bar, BarWidthArg *a) +{ + return TEXTW(bar->mon->ltsymbol); +} + +int +draw_ltsymbol(Bar *bar, BarDrawArg *a) +{ + return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, bar->mon->ltsymbol, 0, False); +} + +int +click_ltsymbol(Bar *bar, Arg *arg, BarClickArg *a) +{ + return ClkLtSymbol; +} diff --git a/bar/layoutindicator.h b/bar/layoutindicator.h new file mode 100644 index 0000000..d9c79bf --- /dev/null +++ b/bar/layoutindicator.h @@ -0,0 +1,3 @@ +static int width_ltsymbol(Bar *bar, BarWidthArg *a); +static int draw_ltsymbol(Bar *bar, BarDrawArg *a); +static int click_ltsymbol(Bar *bar, Arg *arg, BarClickArg *a); diff --git a/bar/statusbar.c b/bar/statusbar.c new file mode 100644 index 0000000..d95fa76 --- /dev/null +++ b/bar/statusbar.c @@ -0,0 +1,19 @@ +int +width_status(Bar *bar, BarWidthArg *a) +{ + return TEXTW(stext); +} + + +int +draw_status(Bar *bar, BarDrawArg *a) +{ + return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, stext, 0, True); +} + + +int +click_status(Bar *bar, Arg *arg, BarClickArg *a) +{ + return ClkStatusText; +} diff --git a/bar/statusbar.h b/bar/statusbar.h new file mode 100644 index 0000000..b02a4b8 --- /dev/null +++ b/bar/statusbar.h @@ -0,0 +1,3 @@ +static int width_status(Bar *bar, BarWidthArg *a); +static int draw_status(Bar *bar, BarDrawArg *a); +static int click_status(Bar *bar, Arg *arg, BarClickArg *a); diff --git a/bar/tags.c b/bar/tags.c new file mode 100644 index 0000000..f8cba77 --- /dev/null +++ b/bar/tags.c @@ -0,0 +1,55 @@ +int +width_tags(Bar *bar, BarWidthArg *a) +{ + int w, i; + + for (w = 0, i = 0; i < LENGTH(tags); i++) { + w += TEXTW(tags[i]); + } + return w; +} + +int +draw_tags(Bar *bar, BarDrawArg *a) +{ + int invert; + int w, x = a->x; + int boxs = drw->font->h / 9; + int boxw = drw->font->h / 6 + 2; + unsigned int i, occ = 0, urg = 0; + Client *c; + Monitor *m = bar->mon; + + for (c = m->clients; c; c = c->next) { + occ |= c->tags; + if (c->isurgent) + urg |= c->tags; + } + + for (i = 0; i < LENGTH(tags); i++) { + invert = urg & 1 << i; + w = TEXTW(tags[i]); + drw_setscheme(drw, (m->tagset[m->seltags] & 1 << i ? tagscheme[i] : scheme[SchemeBar])); + drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], invert, False); + if (occ & 1 << i) + drw_rect(drw, x + boxs, boxs, boxw, boxw, + m == selmon && selmon->sel && selmon->sel->tags & 1 << i, invert); + x += w; + } + + return x; +} + +int +click_tags(Bar *bar, Arg *arg, BarClickArg *a) +{ + int i = 0, x = lrpad / 2; + + do { + x += TEXTW(tags[i]); + } while (a->rel_x >= x && ++i < LENGTH(tags)); + if (i < LENGTH(tags)) { + arg->ui = 1 << i; + } + return ClkTagBar; +} diff --git a/bar/tags.h b/bar/tags.h new file mode 100644 index 0000000..7ac04d8 --- /dev/null +++ b/bar/tags.h @@ -0,0 +1,3 @@ +static int width_tags(Bar *bar, BarWidthArg *a); +static int draw_tags(Bar *bar, BarDrawArg *a); +static int click_tags(Bar *bar, Arg *arg, BarClickArg *a); diff --git a/bar/title.c b/bar/title.c new file mode 100644 index 0000000..e5ad91b --- /dev/null +++ b/bar/title.c @@ -0,0 +1,31 @@ +int +width_wintitle(Bar *bar, BarWidthArg *a) +{ + return a->max_width; +} + +int +draw_wintitle(Bar *bar, BarDrawArg *a) +{ + int boxs = drw->font->h / 9; + int boxw = drw->font->h / 6 + 2; + int x = a->x, w = a->w; + Monitor *m = bar->mon; + + if (m->sel) { + drw_setscheme(drw, scheme[m == selmon ? SchemeTitleSel : SchemeTitleNorm]); + drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0, False); + if (m->sel->isfloating) + drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); + } else { + drw_setscheme(drw, scheme[SchemeBar]); + drw_rect(drw, x, 0, w, bh, 1, 1); + } + return x + w; +} + +int +click_wintitle(Bar *bar, Arg *arg, BarClickArg *a) +{ + return ClkWinTitle; +} diff --git a/bar/title.h b/bar/title.h new file mode 100644 index 0000000..266404c --- /dev/null +++ b/bar/title.h @@ -0,0 +1,3 @@ +static int width_wintitle(Bar *bar, BarWidthArg *a); +static int draw_wintitle(Bar *bar, BarDrawArg *a); +static int click_wintitle(Bar *bar, Arg *arg, BarClickArg *a); diff --git a/host.mk b/host.mk index e7ffc8e..aa15f29 100644 --- a/host.mk +++ b/host.mk @@ -16,7 +16,7 @@ PAGEDIR = "/home/anon/Projects/speediegq/projects" FREETYPELIBS = -lfontconfig -lXft FREETYPEINC = /usr/include/freetype2 EXCFLAGS = -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-array-bounds -CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Ofast -march=native ${INCS} ${CPPFLAGS} ${EXCFLAGS} +CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Ofast -march=native ${INCS} ${CPPFLAGS} #${EXCFLAGS} LDFLAGS = ${LIBS} -g # OpenBSD support diff --git a/keybinds.h b/keybinds.h index 66f3408..4d5254c 100644 --- a/keybinds.h +++ b/keybinds.h @@ -35,7 +35,6 @@ /* Tag related keybinds */ #define TAGKEYS(CHAIN,KEY,TAG) { MODIFIER1, CHAIN, KEY, view, {.ui = 1 << TAG } }, \ - { MODIFIER1|SHIFT, CHAIN, KEY, previewtag, {.ui = TAG} }, \ { MODIFIER1|CONTROL, CHAIN, KEY, toggleview, {.ui = 1 << TAG } }, \ { MODIFIER1|SHIFT|CONTROL, CHAIN, KEY, tag, {.ui = 1 << TAG } }, @@ -194,6 +193,7 @@ static Key keys[] = { { MODIFIER1, XK_p, XK_r, resetbarpadding, {0} }, /* Chained toggle keybinds */ + /* { MODIFIER1, XK_t, XK_t, togglebartags, {0} }, { MODIFIER1, XK_t, XK_w, togglebartitle, {0} }, { MODIFIER1, XK_t, XK_u, togglebarunseltitle, {0} }, @@ -201,17 +201,20 @@ static Key keys[] = { { MODIFIER1, XK_t, XK_y, togglebaremptytags, {0} }, { MODIFIER1, XK_t, XK_l, togglebarlt, {0} }, { MODIFIER1, XK_t, XK_i, togglebaricon, {0} }, + */ { MODIFIER1, XK_t, XK_o, toggleopacity, {0} }, - { MODIFIER1, XK_t, XK_b, togglebarpos, {0} }, - { MODIFIER1, XK_t, XK_r, resetbar, {0} }, + //{ MODIFIER1, XK_t, XK_b, togglebarpos, {0} }, + //{ MODIFIER1, XK_t, XK_r, resetbar, {0} }, /* Chained powerline toggle keybinds */ + /* { MODIFIER1, XK_apostrophe, XK_w, toggletitlepowerline,{0} }, { MODIFIER1, XK_apostrophe, XK_t, toggletagpowerline, {0} }, { MODIFIER1, XK_apostrophe, XK_a, toggletitleplshape, {0} }, { MODIFIER1, XK_apostrophe, XK_d, toggletagplshape, {0} }, { MODIFIER1, XK_apostrophe, XK_s, toggleplshape, {0} }, { MODIFIER1, XK_apostrophe, XK_r, resetpowerline, {0} }, + */ /* Chained music keybinds */ { MODIFIER1, XK_q, XK_n, spawn, cmd( "cmus-remote --next" ) }, @@ -224,7 +227,7 @@ static Key keys[] = { /* Misc */ { MODIFIER1, XK_q, XK_o, killunsel, {0} }, - { MODIFIER1, XK_l, XK_p, togglelayoutpos, {0} }, + //{ MODIFIER1, XK_l, XK_p, togglelayoutpos, {0} }, { MODIFIER1|SHIFT, XK_e, XK_p, spawn, cmd( "speedwm-swal --previous" ) }, { MODIFIER1|SHIFT, XK_e, XK_r, spawn, cmd( "speedwm-swal --randomize" ) }, { MODIFIER1|SHIFT, XK_e, XK_a, spawn, cmd( "speedwm-virtualkeyboard" ) }, diff --git a/signal.h b/signal.h index 76d0b8c..3de5d9a 100644 --- a/signal.h +++ b/signal.h @@ -25,7 +25,9 @@ static Signal signals[] = { { 18, setmfact, {.f = +0.05} }, { 19, setmfact, {.f = -0.05} }, { 20, togglesticky, {0} }, + /* { 21, togglebar, {0} }, + */ { 22, togglefullscr, {0} }, { 23, togglefloating, {0} }, { 24, zoom, {0} }, @@ -76,6 +78,7 @@ static Signal signals[] = { #endif { 66, viewtoleft_vacant, {0} }, { 67, viewtoright_vacant, {0} }, + /* { 68, togglebartags, {0} }, { 69, togglebaremptytags, {0} }, { 70, toggletagpowerline, {0} }, @@ -95,6 +98,7 @@ static Signal signals[] = { { 84, togglebarpos, {0} }, { 85, togglelayoutpos, {0} }, { 86, resetbar, {0} }, + */ { 87, setbarheight, {.i = +1 } }, { 88, setbarheight, {.i = -1 } }, { 89, resetbarheight, {0} }, diff --git a/speedwm.c b/speedwm.c index 205808a..09533aa 100644 --- a/speedwm.c +++ b/speedwm.c @@ -7,9 +7,6 @@ #include #include #include -#if USEWINICON -#include -#endif #include #include #include "toggle.h" @@ -50,6 +47,7 @@ #include "main.h" /* macros */ +#define BARRULES 20 #define BUTTONMASK (ButtonPressMask|ButtonReleaseMask) #define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) #define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->mw) - MAX((x),(m)->mx)) \ @@ -70,21 +68,6 @@ #define RIGHTOF(a,b) (a.y_org > b.y_org) || \ ((a.y_org == b.y_org) && (a.x_org > b.x_org)) -#if USESYSTRAY -#define SYSTEM_TRAY_REQUEST_DOCK 0 -/* XEMBED messages */ -#define XEMBED_EMBEDDED_NOTIFY 0 -#define XEMBED_WINDOW_ACTIVATE 1 -#define XEMBED_FOCUS_IN 4 -#define XEMBED_MODALITY_ON 10 -#define XEMBED_MAPPED (1 << 0) -#define XEMBED_WINDOW_ACTIVATE 1 -#define XEMBED_WINDOW_DEACTIVATE 2 -#define VERSION_MAJOR 0 -#define VERSION_MINOR 0 -#define XEMBED_EMBEDDED_VERSION (VERSION_MAJOR << 16) | VERSION_MINOR -#endif - #define OPAQUE 0xffU #define TRANSPARENT 0 @@ -95,9 +78,6 @@ #define MWM_DECOR_BORDER (1 << 1) #define MWM_DECOR_TITLE (1 << 3) -/* for compatibility with lines that use blw */ -#define blw TEXTW(m->ltsymbol) - /* enums */ enum { CurNormal, CurResize, CurMove, CurResizeHorzArrow, CurResizeVertArrow, CurLast }; /* cursor, CurLast must be last */ @@ -119,22 +99,13 @@ enum { SchemeBorderNorm, }; enum { NetSupported, NetWMName, -#if USEWINICON - NetWMIcon, -#endif NetWMState, NetWMCheck, -#if USESYSTRAY - NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation, NetSystemTrayOrientationHorz, -#endif NetWMFullscreen, NetActiveWindow, NetWMWindowType, NetWMWindowTypeDesktop, NetWMWindowTypeDialog, NetClientList, NetDesktopNames, NetDesktopViewport, NetNumberOfDesktops, NetCurrentDesktop, #if USEFADE NetWMWindowsOpacity, #endif NetClientListStacking, NetClientInfo, NetLast }; /* EWMH atoms */ -#if USESYSTRAY -enum { Manager, Xembed, XembedInfo, XLast }; /* Xembed atoms */ -#endif enum { WMClass, WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, @@ -154,18 +125,67 @@ struct ClientState { }; #endif +enum { + BAR_ALIGN_LEFT, + BAR_ALIGN_CENTER, + BAR_ALIGN_RIGHT, + BAR_ALIGN_LEFT_LEFT, + BAR_ALIGN_LEFT_RIGHT, + BAR_ALIGN_LEFT_CENTER, + BAR_ALIGN_NONE, + BAR_ALIGN_RIGHT_LEFT, + BAR_ALIGN_RIGHT_RIGHT, + BAR_ALIGN_RIGHT_CENTER, + BAR_ALIGN_LAST +}; /* bar alignment */ + typedef union { -#if USEIPC long i; unsigned long ui; -#else - long i; - unsigned long ui; -#endif float f; const void *v; } Arg; +typedef struct Monitor Monitor; +typedef struct Bar Bar; +struct Bar { + Window win; + Monitor *mon; + Bar *next; + int idx; + int barposition; + int bx, by, bw, bh; /* bar geometry */ + int w[BARRULES]; // module width + int x[BARRULES]; // module position +}; + +typedef struct { + int max_width; +} BarWidthArg; + +typedef struct { + int x; + int w; +} BarDrawArg; + +typedef struct { + int rel_x; + int rel_y; + int rel_w; + int rel_h; +} BarClickArg; + +typedef struct { + int monitor; + int bar; + int alignment; // see bar alignment enum + int (*widthfunc)(Bar *bar, BarWidthArg *a); + int (*drawfunc)(Bar *bar, BarDrawArg *a); + int (*clickfunc)(Bar *bar, Arg *arg, BarClickArg *a); + char *name; // for debugging + int x, w; // position, width for internal use +} BarRule; + typedef struct { unsigned int click; unsigned int mask; @@ -174,7 +194,6 @@ typedef struct { const Arg arg; } Button; -typedef struct Monitor Monitor; typedef struct Client Client; struct Client { char name[256]; /* window manager name */ @@ -201,9 +220,6 @@ struct Client { needresize; /* window rules */ pid_t pid; char scratchkey; /* scratchpad key */ -#if USEWINICON - unsigned int icw, ich; Picture icon; /* icon height/width */ -#endif int issteam; /* steam specific fix */ int beingmoved; Client *next; @@ -259,12 +275,14 @@ struct Monitor { int stackcount; int mastercount; /* number of clients in the master stack */ int num; - int by, bh; /* bar geometry */ + int bh; /* bar geometry */ int tx, tw; /* bar tray geometry */ int btw; int bt; int mx, my, mw, mh; /* screen size */ int wx, wy, ww, wh; /* window area */ + int barpaddingv_orig; + int barpaddingh_orig; int gapsizeih; /* horizontal gap between windows */ int gapsizeiv; /* vertical gap between windows */ int gapsizeoh; /* horizontal outer gaps */ @@ -281,9 +299,6 @@ struct Monitor { unsigned int tagset[2]; #if USEIPC TagState tagstate; -#endif -#if USETAGPREVIEW - int previewshow; #endif int showbar; @@ -308,14 +323,9 @@ struct Monitor { int titleplshape; /* position */ - int barposition; int layoutposition; /* icon */ -#if USEWINICON - int iconsize; - int iconspacing; -#endif /* coloring */ int colorselectedtitle; @@ -342,13 +352,9 @@ struct Monitor { Client **clientsnext; /* array of all clients in the tag */ #endif Monitor *next; - Window barwin; + Bar *bar; Window tabwin; Window traywin; -#if USETAGPREVIEW - Window tagwin; - Pixmap *tagmap; -#endif const Layout *lt[2]; #if USEIPC const Layout *lastlt; @@ -373,14 +379,6 @@ typedef struct { const char scratchkey; } Rule; -#if USESYSTRAY -typedef struct Systray Systray; -struct Systray { - Window win; - Client *icons; -}; -#endif - typedef struct { const char *cmd; int id; @@ -407,7 +405,6 @@ static void getfacts(Monitor *m, int msize, int ssize, float *mf, float *sf, int 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); -static void previewtag(const Arg *arg); static void setcurrentdesktop(void); static void setdesktopnames(void); static void setnumdesktops(void); @@ -446,11 +443,11 @@ static Monitor *dirtomon(int dir); static void dragmfact(const Arg *arg); #endif static void drawbaritems(Monitor *m); +static void drawbarwin(Bar *bar); static void drawbar(void); #if USEROUNDCORNERS static void drawroundedcorners(Client *c); #endif -static int drawstatusbar(Monitor *m, int bh, char* text); static int statuslength(char *stext); static void enternotify(XEvent *e); static void expose(XEvent *e); @@ -462,28 +459,13 @@ static void focusstack(int inc, int vis); static void focusstackvis(const Arg *arg); static void focusstackhid(const Arg *arg); static Atom getatomprop(Client *c, Atom prop); -#if USEWINICON -static Picture geticonprop(Window w, unsigned int *icw, unsigned int *ich); -#endif static int getrootptr(int *x, int *y); static long getstate(Window w); static unsigned int getsystraywidth(); -static Monitor *systraytomon(Monitor *m); -static void resizebarwin(Monitor *m); +//static void resizebarwin(Monitor *m); /* systray */ -#if USESYSTRAY -static void removesystrayicon(Client *i); -static void resizerequest(XEvent *e); -static void updatesystray(void); -static void updatesystrayicongeom(Client *i, int w, int h); -static void updatesystrayiconstate(Client *i, XPropertyEvent *ev); -static Client *wintosystrayicon(Window w); -static int sendevent(Window w, Atom proto, int m, long d0, long d1, long d2, long d3, long d4); -static void togglesystray(); -#else static int sendevent(Client *c, Atom proto); -#endif static int gettextprop(Window w, Atom atom, char *text, unsigned int size); static void grabbuttons(Client *c, int focused); @@ -501,7 +483,6 @@ static void killunsel(const Arg *arg); static void layoutmenu(const Arg *arg); #endif static void manage(Window w, XWindowAttributes *wa); -static void managealtbar(Window win, XWindowAttributes *wa); static void managetray(Window win, XWindowAttributes *wa); static void mappingnotify(XEvent *e); static void maprequest(XEvent *e); @@ -588,11 +569,6 @@ static void hideall(const Arg *arg); static void showwin(Client *c); static void showhide(Client *c); -/* tag previews */ -#if USETAGPREVIEW -static void showtagpreview(unsigned int i); -static void takepreview(void); -#endif static void sigchld(int unused); #ifdef XINERAMA static void sortscreens(XineramaScreenInfo *screens, int n); @@ -604,7 +580,6 @@ static void swapclient(const Arg *arg); static void swapfocus(const Arg *arg); static void togglemark(const Arg *arg); static void spawnbar(); -static void unmanagealtbar(Window w); static void unmanagetray(Window w); static void tagmon(const Arg *arg); @@ -693,22 +668,10 @@ 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); @@ -756,6 +719,8 @@ static int xerrorstart(Display *dpy, XErrorEvent *ee); static void xinitvisual(); static void zoom(const Arg *arg); +#include "bar/items.h" + /* switcher funcs */ #if USESWITCHER void drawswitcher(int nwins, int first, Monitor *m); @@ -777,9 +742,6 @@ static Client *termforwin(const Client *c); static pid_t winpid(Window w); /* variables */ -#if USESYSTRAY -static Systray *systray = NULL; -#endif static const char notitle[] = ""; /* Title when none can be grabbed. */ #if USEMOUSE static const char *layoutcmd = "speedwm-utils layout"; @@ -821,16 +783,9 @@ static void (*handler[LASTEvent]) (XEvent *) = { [MapRequest] = maprequest, [MotionNotify] = motionnotify, [PropertyNotify] = propertynotify, - #if USESYSTRAY - [ResizeRequest] = resizerequest, - #endif [UnmapNotify] = unmapnotify }; -#if USESYSTRAY -static Atom wmatom[WMLast], netatom[NetLast], xatom[XLast], motifatom; -#else static Atom wmatom[WMLast], netatom[NetLast], motifatom; -#endif #if USEIPC static int epoll_fd; static int dpy_fd; @@ -961,14 +916,13 @@ static const char *clickstatus[] = { "/bin/sh", "-c", NULL, NULL }; /* for runni #include "options.h" /* Include options */ /* Options */ -#if USESYSTRAY static int systraypinningfailfirst = 1; -#endif /* Rest of the headers */ #include "autostart.h" /* Add autostart support */ #include "colors.h" /* Include colors */ #include "rules.h" /* Include rules */ +#include "bar.h" /* Include bar */ #if USEXRESOURCES #include "xresources.h" /* Include .Xresources/Pywal support */ #endif @@ -997,6 +951,8 @@ static int systraypinningfailfirst = 1; #include "toggle/ipc-yajl.c" #endif +#include "bar/items.c" + unsigned int tagw[LENGTH(tags)]; struct Pertag { @@ -1181,10 +1137,6 @@ arrange(Monitor *m) restack(m); } else for (m = mons; m; m = m->next) arrangemon(m); - -#if USETAGPREVIEW - takepreview(); -#endif } void @@ -1370,129 +1322,61 @@ unswallow(Client *c) void buttonpress(XEvent *e) { - unsigned int i, x, click, occ; - int plt = 0; - - if (!selmon->hidetagpowerline) - plt = plw; - + int click, i, r, mi; Arg arg = {0}; Client *c; Monitor *m; + Bar *bar; XButtonPressedEvent *ev = &e->xbutton; - *lastbutton = '0' + ev->button; + const BarRule *br; + BarClickArg carg = { 0, 0, 0, 0 }; click = ClkRootWin; /* focus monitor if necessary */ - if ((m = wintomon(ev->window)) && m != selmon) { + if ((m = wintomon(ev->window)) && m != selmon + ) { unfocus(selmon->sel, 1); selmon = m; focus(NULL); } - if (ev->window == selmon->barwin) { - - /* set ints to 0 */ - i = x = occ = 0; - /* powerline */ - if (!selmon->hidetagpowerline) - x = plt; - - /* Bitmask of occupied tags */ - for (c = m->clients; c; c = c->next) - occ |= c->tags; - - if (selmon->layoutposition && !selmon->hidelayout) { - x += TEXTW(m->ltsymbol); - } if (ev->x < x && selmon->layoutposition && !selmon->isreset && !selmon->hidelayout) { - click = ClkLtSymbol; /* left layout */ - } else { - do { - if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i) && selmon->hideemptytags) - continue; - if (!selmon->hidetags && selmon->hideemptytags) - x += TEXTW(occ & 1 << i ? usedtags[i] : tags[i]) + plt; - } while (ev->x >= x && ++i < LENGTH(tags)); - if (i < LENGTH(tags) && !selmon->hidetags) { - click = ClkTagBar; - if (ev->button == Button4 || ev->button == Button5 ) { - arg.ui = selmon->tagset[selmon->seltags]; - if (!(arg.ui & ((1 << (LENGTH(tags) - 1)) + 1)) ) { - arg.ui = (ev->button == Button4) ? (arg.ui >> 1) : (arg.ui << 1); - } else if ( arg.ui & 1 ) { - arg.ui = (ev->button == Button4) ? arg.ui : (arg.ui << 1); - } else if ( arg.ui & (1 << (LENGTH(tags) - 1)) ) { - arg.ui = (ev->button == Button4) ? (arg.ui >> 1) : arg.ui; + for (mi = 0, m = mons; m && m != selmon; m = m->next, mi++); // get the monitor index + for (bar = selmon->bar; bar; bar = bar->next) { + if (ev->window == bar->win) { + for (r = 0; r < LENGTH(barrules); r++) { + br = &barrules[r]; + if (br->bar != bar->idx || (br->monitor == 'A' && m != selmon) || br->clickfunc == NULL) + continue; + if (br->monitor != 'A' && br->monitor != -1 && br->monitor != mi) + continue; + if (bar->x[r] <= ev->x && ev->x <= bar->x[r] + bar->w[r]) { + carg.rel_x = ev->x - bar->x[r]; + carg.rel_y = ev->y; + carg.rel_w = bar->w[r]; + carg.rel_h = bar->bh; + click = br->clickfunc(bar, &arg, &carg); + if (click < 0) + return; + break; } - } else - arg.ui = 1 << i; - - #if USETAGPREVIEW - if (selmon->previewshow) { - selmon->previewshow = 0; - XUnmapWindow(dpy, selmon->tagwin); } - #endif - - } else if (ev->x < x + TEXTW(selmon->ltsymbol) && !selmon->layoutposition && !selmon->isreset) /* right layout */ - click = ClkLtSymbol; /* right layout */ - else if (ev->x > selmon->ww - statusw + lrpad - 2 - getsystraywidth() && !selmon->hidestatus) { - x = selmon->ww - statusw + lrpad - 2 * sp - getsystraywidth() - 2; - click = ClkStatusText; - char *text = rawstext; - int i = -1; - char ch; - clickstatusn = 0; - while (text[++i]) { - if ((unsigned char)text[i] < ' ') { - ch = text[i]; - text[i] = '\0'; - x += statuslength(text); - text[i] = ch; - text += i+1; - i = -1; - if (x >= ev->x) - break; - if (ch <= LENGTH(clickstatuss)) - clickstatusn = ch; - } - } - } else if (!selmon->hideunselectedtitle) { - if (!selmon->layoutposition && !selmon->hidelayout) { - x += TEXTW(m->ltsymbol); /* Left layout does not need this */ - } - - /* Don't click if title is hidden - * This is not required, but you won't be able to see what you're clicking so we might as well disable it */ - c = m->clients; - - if (c && !selmon->hidetitle) { - do { - if (!c || !ISVISIBLE(c)) - continue; - else - x += (1.0 / (double)m->bt) * m->btw; - } while (c && ev->x > x && (c = c->next)); - - //if (selmon->hidetagpowerline && selmon->hidetitlepowerline) - click = ClkWinTitle; - - arg.v = c; - - } + break; } - } - } else if ((c = wintoclient(ev->window))) { + } + + if (click == ClkRootWin && (c = wintoclient(ev->window))) { focus(c); restack(selmon); XAllowEvents(dpy, ReplayPointer, CurrentTime); click = ClkClientWin; - } + } - for (i = 0; i < LENGTH(buttons); i++) + for (i = 0; i < LENGTH(buttons); i++) { if (click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button - && CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state)) - buttons[i].func((click == ClkTagBar || click == ClkWinTitle) && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg); + && CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state)) { + buttons[i].func(click == ClkTagBar && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg); + } + } } #endif @@ -1528,14 +1412,6 @@ cleanup(void) while (mons) cleanupmon(mons); -#if USESYSTRAY - if (!selmon->hidesystray) { - XUnmapWindow(dpy, systray->win); - XDestroyWindow(dpy, systray->win); - free(systray); - } -#endif - for (i = 0; i < CurLast; i++) drw_cur_free(drw, cursor[i]); for (i = 0; i < LENGTH(colors) + 1; i++) @@ -1564,9 +1440,7 @@ void cleanupmon(Monitor *mon) { Monitor *m; -#if USETAGPREVIEW - size_t i; -#endif + Bar *bar; if (mon == mons) mons = mons->next; @@ -1574,22 +1448,7 @@ cleanupmon(Monitor *mon) for (m = mons; m && m->next != mon; m = m->next); m->next = mon->next; } -#if USETAGPREVIEW - for (i = 0; i < LENGTH(tags); i++) { - if (mon->tagmap[i]) - XFreePixmap(dpy, mon->tagmap[i]); - free(mon->tagmap); - - if (!altbar) { - XUnmapWindow(dpy, mon->tagwin); - XDestroyWindow(dpy, mon->tagwin); - } -#endif - free(mon); -#if USETAGPREVIEW - } -#endif } void @@ -1598,57 +1457,6 @@ clientmessage(XEvent *e) XClientMessageEvent *cme = &e->xclient; Client *c = wintoclient(cme->window); -#if USESYSTRAY - XWindowAttributes wa; - XSetWindowAttributes swa; - - if (!selmon->hidesystray && cme->window == systray->win && cme->message_type == netatom[NetSystemTrayOP]) { - /* add systray icons */ - if (cme->data.l[1] == SYSTEM_TRAY_REQUEST_DOCK) { - if (!(c = (Client *)calloc(1, sizeof(Client)))) - die("fatal: could not malloc() %u bytes\n", sizeof(Client)); - if (!(c->win = cme->data.l[2])) { - free(c); - return; - } - c->mon = selmon; - c->next = systray->icons; - systray->icons = c; - if (!XGetWindowAttributes(dpy, c->win, &wa)) { - /* use sane defaults */ - wa.width = bh; - wa.height = bh; - wa.border_width = 0; - } - c->x = c->oldx = c->y = c->oldy = 0; - c->w = c->oldw = wa.width; - c->h = c->oldh = wa.height; - c->oldbw = wa.border_width; - c->bw = 0; - c->isfloating = True; - /* reuse tags field as mapped status */ - c->tags = 1; - updatesizehints(c); - updatesystrayicongeom(c, wa.width, wa.height); - XAddToSaveSet(dpy, c->win); - XSelectInput(dpy, c->win, StructureNotifyMask | PropertyChangeMask | ResizeRedirectMask); - XReparentWindow(dpy, c->win, systray->win, 0, 0); - /* use parents background color */ - swa.background_pixel = scheme[SchemeBar][ColBg].pixel; - XChangeWindowAttributes(dpy, c->win, CWBackPixel, &swa); - sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_EMBEDDED_NOTIFY, 0 , systray->win, XEMBED_EMBEDDED_VERSION); - sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_FOCUS_IN, 0 , systray->win, XEMBED_EMBEDDED_VERSION); - sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_WINDOW_ACTIVATE, 0 , systray->win, XEMBED_EMBEDDED_VERSION); - sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_MODALITY_ON, 0 , systray->win, XEMBED_EMBEDDED_VERSION); - XSync(dpy, False); - resizebarwin(selmon); - updatesystray(); - setclientstate(c, NormalState); - } - return; - } -#endif - unsigned int i; if (!c) @@ -1701,6 +1509,7 @@ configurenotify(XEvent *e) Client *c; XConfigureEvent *ev = &e->xconfigure; int dirty; + Bar *bar; if (ev->window == root) { dirty = (tw != ev->width || sh != ev->height); @@ -1713,11 +1522,9 @@ configurenotify(XEvent *e) for (c = m->clients; c; c = c->next) if (c->isfullscreen) resizeclient(c, m->mx, m->my, m->mw, m->mh); - #if USESYSTRAY - resizebarwin(m); - #else - XMoveResizeWindow(dpy, m->barwin, m->wx + sp, m->by + vp, m->ww - 2 * sp, bh); - #endif + + for (bar = m->bar; bar; bar = bar->next) + XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh); } focus(NULL); arrange(NULL); @@ -1847,8 +1654,11 @@ copyvalidchars(char *text, char *rawtext) Monitor * createmon(void) { - Monitor *m; - unsigned int i; + Monitor *m, *mon; + int i, n, mi, max_bars = 2, isbarposition = barposition; + + const BarRule *br; + Bar *bar; m = ecalloc(1, sizeof(Monitor)); m->tagset[0] = m->tagset[1] = startontag ? 1 : 0; @@ -1877,13 +1687,8 @@ createmon(void) m->tagplshape = tagplshape; m->titleplshape = titleplshape; - /* pos */ - m->barposition = barposition; - m->layoutposition = layoutposition; - - /* icon stuff */ - m->iconspacing = iconspacing; - m->iconsize = iconsize; + /* monitor index */ + for (mi = 0, mon = mons; mon; mon = mon->next, mi++); /* coloring */ m->colorselectedtitle = colorselectedtitle; @@ -1899,6 +1704,10 @@ createmon(void) m->gapsizeoh = gapsizeoh; m->gapsizeov = gapsizeov; + /* original padding */ + m->barpaddingv_orig = barpaddingv; + m->barpaddingh_orig = barpaddingh; + /* layout */ m->lt[0] = &layouts[0]; m->lt[1] = &layouts[1 % LENGTH(layouts)]; @@ -1930,12 +1739,24 @@ createmon(void) 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 - m->tagmap = ecalloc(LENGTH(tags), sizeof(Pixmap)); -#endif + /* Derive the number of bars for this monitor based on bar rules */ + for (n = -1, i = 0; i < LENGTH(barrules); i++) { + br = &barrules[i]; + if (br->monitor == 'A' || br->monitor == -1 || br->monitor == mi) + n = MAX(br->bar, n); + } + + for (i = 0; i <= n && i < max_bars; i++) { + bar = ecalloc(1, sizeof(Bar)); + bar->mon = m; + bar->idx = i; + bar->next = m->bar; + bar->barposition = isbarposition; + m->bar = bar; + isbarposition = !isbarposition; + } return m; } @@ -1967,21 +1788,8 @@ destroynotify(XEvent *e) if ((c = wintoclient(ev->window))) unmanage(c, 1); - #if USESYSTRAY - else if ((c = wintosystrayicon(ev->window))) { - removesystrayicon(c); - resizebarwin(selmon); - updatesystray(); - } - #endif - else if ((c = swallowingclient(ev->window))) unmanage(c->swallowing, 1); - - if (altbar && (m = wintomon(ev->window)) && m->barwin == ev->window) - unmanagealtbar(ev->window); - else if (altbar && m->traywin == ev->window) - unmanagetray(ev->window); } /* run ltmenu */ @@ -2208,128 +2016,6 @@ statuslength(char* stext) return w; } -/* draw statusbar text */ -int -drawstatusbar(Monitor *m, int bh, char* stext) { - int ret, i, j, w, x, len; - short isCode = 0; - char *text; - char *p; - - len = strlen(stext) + 1; - if (!(text = (char*) malloc(sizeof(char)*len))) - die("malloc"); - p = text; - - copyvalidchars(text, stext); - - i = -1, j = 0; - while (stext[++i]) - if ((unsigned char)stext[i] >= ' ') - text[j++] = stext[i]; - text[j] = '\0'; - - - /* compute width of the status text */ - w = 0; - i = -1; - while (text[++i]) { - if (text[i] == '^') { - if (!isCode) { - isCode = 1; - text[i] = '\0'; - w += TEXTWM(text) - lrpad; - text[i] = '^'; - if (text[++i] == 'f') - w += atoi(text + ++i); - } else { - isCode = 0; - text = text + i + 1; - i = -1; - } - } - } - if (!isCode) - w += TEXTWM(text) - lrpad; - else - isCode = 0; - text = p; - - w += 2; /* 1px padding on both sides */ - - ret = x = m->ww - w - 2 * sp - ((!selmon->hidesystray && m == systraytomon(m)) ? getsystraywidth() : 0); - - drw_setscheme(drw, scheme[LENGTH(colors)]); - drw->scheme[ColFg] = scheme[SchemeStatus][ColFg]; - drw->scheme[ColBg] = scheme[SchemeStatus][ColBg]; - drw_rect(drw, x, 0, w, bh, 1, 1); - x++; - - /* process status text */ - i = -1; - while (text[++i]) { - if (text[i] == '^' && !isCode) { - isCode = 1; - - text[i] = '\0'; - w = TEXTWM(text) - lrpad; - drw_text(drw, x, 0, w, bh, 0, text, 0, True); - - x += w; - - /* process code */ - while (text[++i] != '^') { - if (text[i] == 'c') { - readAndSetColor(ColFg, (char*)text+i+1); - i += 7; - } else if (text[i] == 'b') { - readAndSetColor(ColBg, (char*)text+i+1); - i += 7; - } else if (text[i] == 'C') { - int c = atoi(text + ++i); - drw_clr_create(drw, &drw->scheme[ColFg], colstatus[c], alphas[SchemeStatus][ColBg]); - } else if (text[i] == 'B') { - int c = atoi(text + ++i); - drw_clr_create(drw, &drw->scheme[ColBg], colstatus[c], alphas[SchemeStatus][ColBg]); - } else if (text[i] == 'd') { - drw->scheme[ColFg] = scheme[SchemeStatus][ColFg]; - drw->scheme[ColBg] = scheme[SchemeStatus][ColBg]; - } else if (text[i] == 'r') { - int rx = atoi(text + ++i); - while (text[++i] != ','); - int ry = atoi(text + ++i); - while (text[++i] != ','); - int rw = atoi(text + ++i); - while (text[++i] != ','); - int rh = atoi(text + ++i); - - drw_rect(drw, rx + x, ry, rw, rh, 1, 0); - } else if (text[i] == 'f') { - x += atoi(text + ++i); - } - } - - text = text + i + 1; - i=-1; - isCode = 0; - } - } - - drw_setscheme(drw, scheme[SchemeStatus]); - - if (!isCode) { - w = TEXTWM(text) - lrpad; - drw_text(drw, x, 0, w, bh, 0, text, 0, True); - w = 0; - } - - drw_setscheme(drw, scheme[SchemeStatus]); - - free(p); - - return ret; -} - /* drag mfact with mouse */ #if USEMOUSE void @@ -2493,308 +2179,9 @@ dragmfact(const Arg *arg) void drawbaritems(Monitor *m) { - int x = 0, w = 0, tw = 0, scm = 0; - int stw = 0; /* systray width */ - int plt = 0; /* powerline title */ - unsigned int i, occ = 0, urg = 0, n = 0; - - /* powerline */ - Clr *prevscheme, *nxtscheme = scheme[SchemeBar]; /* powerline schemes */ - - if (!selmon->hidetagpowerline || !selmon->hidetitlepowerline) { - plw = drw->font->h / 2 + 1; - plt = plw; - } else - plw = 0; - - /* indicators */ - int boxs = drw->font->h / 9; - int boxw = drw->font->h / 6 + 2; - - const char *tagtext; - Client *c; - - if (!m->showbar) - return; - - if (altbar) - return; - -#if USESYSTRAY -if(!selmon->hidesystray && m == systraytomon(m) && !systrayposition) - stw = getsystraywidth(); -#endif - - /* draw status first so it can be overdrawn by tags later */ - if (m == selmon || 1) { /* status is only drawn on selected monitor */ - char *text, *s, ch; - if (!selmon->hidestatus) { - tw = statusw = m->ww - drawstatusbar(m, bh, stext) - getsystraywidth(); - } -#if USESYSTRAY -resizebarwin(m); -#endif - - /* for clickstatus */ - for (text = s = stext; *s; s++) { - if ((unsigned char)(*s) < ' ') { - ch = *s; - *s = '\0'; - tw = TEXTWM(text) - lrpad; - x += tw; - *s = ch; - text = s + 1; - } - } - - } - - /* urgent tags */ - for (c = m->clients; c; c = c->next) { - if (ISVISIBLE(c)) - n++; - occ |= c->tags; - if (c->isurgent && !selmon->hidetags) - urg |= c->tags; - } - - /* draw the layout bar on the left if selmon->layoutposition = 1 and we're not hiding the layout */ - if (selmon->layoutposition && !selmon->hidelayout) { - w = TEXTW(m->ltsymbol); - - /* color with the bar color if !selmon->colorlayout */ - if (selmon->colorlayout) - drw_setscheme(drw, scheme[SchemeLayout]); - else - drw_setscheme(drw, scheme[SchemeStatus]); - - x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0, False); - } - - /* draw tags */ - if (!selmon->hidetags) { - for (i = 0; i < LENGTH(tags); i++) { - if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i) && selmon->hideemptytags) - continue; - if (!selmon->hidetags) { - tagtext = occ & 1 << i ? usedtags[i] : tags[i]; - w = TEXTW(tagtext); - - /* draw powerlined tags */ - if (!selmon->hidetagpowerline) { - prevscheme = scheme[SchemeBar]; /* previous scheme = scheme */ - if (urg & 1 << i && allowurgent) - drw_settrans(drw, prevscheme, (nxtscheme = scheme[m->tagset[m->seltags] & 1 << i ? SchemeTagsSel : SchemeTagsUrg])); /* set transition colorscheme */ - else - drw_settrans(drw, prevscheme, (nxtscheme = scheme[m->tagset[m->seltags] & 1 << i ? SchemeTagsSel : SchemeTagsNorm])); /* set transition colorscheme */ - - if (!selmon->tagplshape) - drw_arrow(drw, x, 0, plt, bh, 1, 0); /* draw arrow */ - else - drw_arrow(drw, x, 0, plt, bh, 1, 1); /* draw slash */ - - x += plt; - drw_setscheme(drw, nxtscheme); /* set scheme to next scheme */ - } else { - if (urg & 1 << i && allowurgent) - drw_setscheme(drw, (m->tagset[m->seltags] & 1 << i ? tagscheme[i] : scheme[SchemeTagsUrg])); /* set scheme */ - else - drw_setscheme(drw, (m->tagset[m->seltags] & 1 << i ? tagscheme[i] : scheme[SchemeTagsNorm])); /* set scheme */ - } - - /* draw tag text */ - drw_text(drw, x, 0, w, bh, lrpad / 2, tagtext, urg & 1 << i, False); - - /* underline */ - if (underlineall || m->tagset[m->seltags] & 1 << i) - if (underline) - drw_rect(drw, x + underlinepad, bh - underlinestroke - underlinevoffset, w - (underlinepad * 2), underlinestroke, 1, 0); - - x += w; - - } - - /* draw end of powerline tags */ - if (!selmon->hidetagpowerline) { - prevscheme = nxtscheme; /* previous scheme = next colorscheme */ - nxtscheme = scheme[SchemeBar]; /* next colorscheme = bar color */ - drw_settrans(drw, prevscheme, nxtscheme); /* set transition colorscheme */ - - if (!selmon->tagplshape) - drw_arrow(drw, x, 0, plt, bh, 1, 0); /* draw arrow */ - else - drw_arrow(drw, x, 0, plt, bh, 1, 1); /* draw arrow */ - - x += plt; /* powerline width */ - } - } - } - - /* draw the layout bar on the right if selmon->layoutposition is not 0 */ - if (!selmon->layoutposition && !selmon->hidelayout) { - w = TEXTW(m->ltsymbol); - if (selmon->colorlayout) - drw_setscheme(drw, scheme[SchemeLayout]); - else - drw_setscheme(drw, scheme[SchemeStatus]); - - x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0, False); - } - -#if USESYSTRAY - if ((w = m->ww - tw - stw - x) > bh) { -#else - if ((w = m->ww - tw - x) > bh) { -#endif - if (n > 0 && !selmon->hidetitle) { - - int remainder; - int tabw; - int padding; - - /* 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) { - remainder = w % n; /* remainder of the title area */ - tabw = (1.0 / (double)n) * w + 1; /* width of each tab (client in the title area) */ - } else { - remainder = w; - tabw = w; - } - - /* pl title */ - if (!selmon->hidetitlepowerline && selmon->colorselectedtitle) - tabw -= 2 * plt; - else if (selmon->hidetagpowerline) { - plt = 0; - plw = 0; - } - - for (c = m->clients; c; c = c->next) { - /* if it's not a window on the current tag, continue */ - if (!ISVISIBLE(c)) - continue; - - /* hide unselected title */ - if (m->sel != c && selmon->hideunselectedtitle) { - continue; - } - - /* selected clients */ - if (m->sel == c && selmon->colorselectedtitle) { - if (!selmon->hideunselectedtitle) - scm = SchemeTitleSel; - - /* hidden clients */ - } else if (HIDDEN(c) && selmon->colorhiddentitle) { - if (!selmon->hideunselectedtitle) - scm = SchemeTitleHidden; - - /* unselected clients */ - } else { - if (!selmon->hideunselectedtitle) - scm = SchemeTitleNorm; - } - - /* apply colors */ - if (!selmon->hideunselectedtitle) { - if (selmon->colorselectedtitle) { - drw_setscheme(drw, scheme[scm]); - } else { - drw_setscheme(drw, scheme[SchemeTitleNorm]); - } - } else { - if (selmon->colorselectedtitle) { - drw_setscheme(drw, scheme[SchemeTitleSel]); - } else { - drw_setscheme(drw, scheme[SchemeTitleNorm]); - } - } - - /* we don't need this if we're only printing focused */ - if (!selmon->hideunselectedtitle) { - if (remainder >= 0) { - if (remainder == 0) { - tabw--; - } - - remainder--; - } - } - - int pltitle = 0; - - /* !centered title */ - padding = lrpad/2; - - if (!selmon->hidetitlepowerline && selmon->colorselectedtitle) - pltitle = plt; - - /* centered title */ - if (TEXTWM(c->name) < tabw && titleposition) - padding = (tabw - TEXTWM(c->name) + lrpad) / 2 - pltitle; - - /* draw title and icon */ - #if USEWINICON - if (selmon->hideicon) { - #endif - drw_text(drw, x + pltitle, 0, tabw, bh, padding, c->name, 0, False); - #if USEWINICON - } else { - drw_text(drw, x + pltitle, 0, tabw, bh, padding + (c->icon ? c->icw + selmon->iconspacing : 0), c->name, 0, False); /* draw, with icon spacing and width added */ - if (c->icon && !selmon->hidetitlepowerline && selmon->colorselectedtitle) - drw_pic(drw, x + pltitle + padding, (bh - c->ich) / 2, c->icw, c->ich, c->icon); /* draw icon */ - else if (c->icon) - drw_pic(drw, x + padding, (bh - c->ich) / 2, c->icw, c->ich, c->icon); /* draw icon */ - } - #endif - - /* draw sticky window indicator */ - if (c->issticky && !selmon->hidesticky) { - drw_polygon(drw, x + boxs, c->isfloating ? boxs * 2 + boxw : boxs, stickyiconbb.x, stickyiconbb.y, boxw, boxw * stickyiconbb.y / stickyiconbb.x, stickyicon, LENGTH(stickyicon), Nonconvex, c->tags & c->mon->tagset[c->mon->seltags]); - } - - /* draw floating window indicator */ - if (c->isfloating && !selmon->hidefloating) { - drw_rect(drw, x + boxs, boxs, boxw, boxw, c->isfixed, 0); - } - - if (!selmon->hidetitlepowerline && selmon->colorselectedtitle) { - drw_settrans(drw, c == m->sel ? scheme[SchemeTitleSel] : scheme[scm], scheme[SchemeBar]); - - /* Slash shaped */ - if (selmon->titleplshape) { - drw_arrow(drw, x, 0, plt, bh, 0, 1); - drw_arrow(drw, x + tabw + plt, 0, plt, bh, 1, 1); - } else { - /* Arrow shaped */ - drw_arrow(drw, x, 0, plt, bh, 0, 0); - drw_arrow(drw, x + tabw + plt, 0, plt, bh, 1, 0); - } - } - - /* x += title width */ - x += tabw; - - /* extra width for title */ - if (!selmon->hidetitlepowerline && selmon->colorselectedtitle) - x += 2 * plt; - } - } else { - /* set scheme to the bar scheme so we can draw other stuff later */ - drw_setscheme(drw, scheme[SchemeBar]); - drw_rect(drw, x, 0, w, bh, 1, 1); - } - } - - m->bt = n; - m->btw = w; - - /* map part of the bar */ - #if USESYSTRAY - drw_map(drw, m->barwin, 0, 0, m->ww - stw, bh); - #else - drw_map(drw, m->barwin, 0, 0, m->ww, bh); - #endif + Bar *bar; + for (bar = m->bar; bar; bar = bar->next) + drawbarwin(bar); } /* draw the full bar @@ -2810,6 +2197,104 @@ drawbar(void) drawbaritems(m); } +void +drawbarwin(Bar *bar) +{ + if (!bar->win) + return; + Monitor *mon; + int r, w, mi; + int rx, lx, rw, lw; // bar size, split between left and right if a center module is added + const BarRule *br; + BarWidthArg warg = { 0 }; + BarDrawArg darg = { 0, 0 }; + + for (mi = 0, mon = mons; mon && mon != bar->mon; mon = mon->next, mi++); // get the monitor index + rw = lw = bar->bw; + rx = lx = 0; + + drw_setscheme(drw, scheme[SchemeBar]); + drw_rect(drw, lx, 0, lw, bh, 1, 1); + for (r = 0; r < LENGTH(barrules); r++) { + br = &barrules[r]; + if (br->bar != bar->idx || br->drawfunc == NULL || (br->monitor == 'A' && bar->mon != selmon)) + continue; + if (br->monitor != 'A' && br->monitor != -1 && br->monitor != mi) + continue; + drw_setscheme(drw, scheme[SchemeBar]); + warg.max_width = (br->alignment < BAR_ALIGN_RIGHT_LEFT ? lw : rw); + w = br->widthfunc(bar, &warg); + w = MIN(warg.max_width, w); + + if (lw <= 0) { // if left is exhausted then switch to right side, and vice versa + lw = rw; + lx = rx; + } else if (rw <= 0) { + rw = lw; + rx = lx; + } + + switch(br->alignment) { + default: + case BAR_ALIGN_NONE: + case BAR_ALIGN_LEFT_LEFT: + case BAR_ALIGN_LEFT: + bar->x[r] = lx; + if (lx == rx) { + rx += w; + rw -= w; + } + lx += w; + lw -= w; + break; + case BAR_ALIGN_LEFT_RIGHT: + case BAR_ALIGN_RIGHT: + bar->x[r] = lx + lw - w; + if (lx == rx) + rw -= w; + lw -= w; + break; + case BAR_ALIGN_LEFT_CENTER: + case BAR_ALIGN_CENTER: + bar->x[r] = lx + lw / 2 - w / 2; + if (lx == rx) { + rw = rx + rw - bar->x[r] - w; + rx = bar->x[r] + w; + } + lw = bar->x[r] - lx; + break; + case BAR_ALIGN_RIGHT_LEFT: + bar->x[r] = rx; + if (lx == rx) { + lx += w; + lw -= w; + } + rx += w; + rw -= w; + break; + case BAR_ALIGN_RIGHT_RIGHT: + bar->x[r] = rx + rw - w; + if (lx == rx) + lw -= w; + rw -= w; + break; + case BAR_ALIGN_RIGHT_CENTER: + bar->x[r] = rx + rw / 2 - w / 2; + if (lx == rx) { + lw = lx + lw - bar->x[r] + w; + lx = bar->x[r] + w; + } + rw = bar->x[r] - rx; + break; + } + bar->w[r] = w; + darg.x = bar->x[r]; + darg.w = bar->w[r]; + br->drawfunc(bar, &darg); + } + drw_map(drw, bar->win, 0, 0, bar->bw, bar->bh); +} + void enternotify(XEvent *e) { @@ -2842,10 +2327,6 @@ expose(XEvent *e) if (ev->count == 0 && (m = wintomon(ev->window))) { drawbaritems(m); -#if USESYSTRAY - if (m == selmon) - updatesystray(); -#endif } } @@ -2950,13 +2431,6 @@ focusmon(const Arg *arg) unfocus(selmon->sel, 0); selmon = m; focus(NULL); - -#if USEMOUSE - if (warpcursor) - warp(selmon->sel); - - selmon->allowwarp = 0; -#endif } void @@ -3032,90 +2506,15 @@ getatomprop(Client *c, Atom prop) unsigned char *p = NULL; Atom da, atom = None; -#if USESYSTRAY - Atom req = XA_ATOM; - if (prop == xatom[XembedInfo]) - req = xatom[XembedInfo]; - if (XGetWindowProperty(dpy, c->win, prop, 0L, sizeof atom, False, req, -#else if (XGetWindowProperty(dpy, c->win, prop, 0L, sizeof atom, False, XA_ATOM, -#endif &da, &di, &dl, &dl, &p) == Success && p) { atom = *(Atom *)p; -#if USESYSTRAY - if (da == xatom[XembedInfo] && dl == 2) - atom = ((Atom *)p)[1]; -#endif - XFree(p); } return atom; } -#if USEWINICON -static uint32_t prealpha(uint32_t p) { - uint8_t a = p >> 24u; - uint32_t rb = (a * (p & 0xFF00FFu)) >> 8u; - uint32_t g = (a * (p & 0x00FF00u)) >> 8u; - return (rb & 0xFF00FFu) | (g & 0x00FF00u) | (a << 24u); -} - -Picture -geticonprop(Window win, unsigned int *picw, unsigned int *pich) -{ - int format; - unsigned long n, extra, *p = NULL; - Atom real; - - if (XGetWindowProperty(dpy, win, netatom[NetWMIcon], 0L, LONG_MAX, False, AnyPropertyType, - &real, &format, &n, &extra, (unsigned char **)&p) != Success) - return None; - if (n == 0 || format != 32) { XFree(p); return None; } - - unsigned long *bstp = NULL; - uint32_t w, h, sz; - { - unsigned long *i; const unsigned long *end = p + n; - uint32_t bstd = UINT32_MAX, d, m; - for (i = p; i < end - 1; i += sz) { - if ((w = *i++) >= 16384 || (h = *i++) >= 16384) { XFree(p); return None; } - if ((sz = w * h) > end - i) break; - if ((m = w > h ? w : h) >= selmon->iconsize && (d = m - selmon->iconsize) < bstd) { bstd = d; bstp = i; } - } - if (!bstp) { - for (i = p; i < end - 1; i += sz) { - if ((w = *i++) >= 16384 || (h = *i++) >= 16384) { XFree(p); return None; } - if ((sz = w * h) > end - i) break; - if ((d = selmon->iconsize - (w > h ? w : h)) < bstd) { bstd = d; bstp = i; } - } - } - if (!bstp) { XFree(p); return None; } - } - - if ((w = *(bstp - 2)) == 0 || (h = *(bstp - 1)) == 0) { XFree(p); return None; } - - uint32_t icw, ich; - if (w <= h) { - ich = selmon->iconsize; icw = w * selmon->iconsize / h; - if (icw == 0) icw = 1; - } - else { - icw = selmon->iconsize; ich = h * selmon->iconsize / w; - if (ich == 0) ich = 1; - } - *picw = icw; *pich = ich; - - uint32_t i, *bstp32 = (uint32_t *)bstp; - for (sz = w * h, i = 0; i < sz; ++i) bstp32[i] = prealpha(bstp[i]); - - Picture ret = drw_picture_create_resized(drw, (char *)bstp, w, h, icw, ich); - XFree(p); - - return ret; -} -#endif - int getrootptr(int *x, int *y) { @@ -3149,30 +2548,9 @@ unsigned int getsystraywidth() { /* doing it this way allows us to clean up the code for drawing the bar */ -#if USESYSTRAY - unsigned int w = 0; - Client *i; - if(!selmon->hidesystray) - for(i = systray->icons; i; w += i->w + systrayspacing, i = i->next) ; - return w ? w + systrayspacing : 1; -#else return 0; -#endif } -#if USESYSTRAY -void -togglesystray() -{ - if (!selmon->hidesystray) - XUnmapWindow(dpy, systray->win); - selmon->hidesystray = !selmon->hidesystray; - updatesystray(); - updatestatus(); -} - -#endif - int gettextprop(Window w, Atom atom, char *text, unsigned int size) { @@ -3598,7 +2976,6 @@ resetbarpaddingv(const Arg *arg) vp = (barposition == 1) ? barpaddingv : - barpaddingv; updatebarpos(selmon); - resizebarwin(selmon); arrange(selmon); } @@ -3611,7 +2988,6 @@ resetbarpaddingh(const Arg *arg) sp = barpaddingh; updatebarpos(selmon); - resizebarwin(selmon); arrange(selmon); } @@ -3640,7 +3016,6 @@ togglebarpaddingv(const Arg *arg) vp = selmon->cpadv; updatebarpos(selmon); - resizebarwin(selmon); arrange(selmon); } @@ -3659,7 +3034,6 @@ togglebarpaddingh(const Arg *arg) sp = selmon->cpadh; updatebarpos(selmon); - resizebarwin(selmon); arrange(selmon); } @@ -3685,7 +3059,6 @@ setbarpaddingv(const Arg *arg) } updatebarpos(selmon); - resizebarwin(selmon); arrange(selmon); } @@ -3704,7 +3077,6 @@ setbarpaddingh(const Arg *arg) } updatebarpos(selmon); - resizebarwin(selmon); arrange(selmon); } @@ -3720,7 +3092,6 @@ setbarheight(const Arg *arg) bh = altbar ? 0 : drw->font->h; updatebarpos(selmon); - resizebarwin(selmon); arrange(selmon); } @@ -3735,7 +3106,6 @@ setbpgaps(const Arg *arg) incrgaps(arg); updatebarpos(selmon); - resizebarwin(selmon); arrange(selmon); } @@ -3748,7 +3118,6 @@ resetbarheight(const Arg *arg) bh = altbar ? 0 : drw->font->h + barheight; updatebarpos(selmon); - resizebarwin(selmon); arrange(selmon); } @@ -3803,11 +3172,7 @@ killclient(const Arg *arg) { if (!selmon->sel || selmon->sel->ispermanent) return; -#if USESYSTRAY - if (!sendevent(selmon->sel->win, wmatom[WMDelete], NoEventMask, wmatom[WMDelete], CurrentTime, 0 , 0, 0)) { -#else if (!sendevent(selmon->sel, wmatom[WMDelete])) { -#endif XGrabServer(dpy); XSetErrorHandler(xerrordummy); XSetCloseDownMode(dpy, DestroyAll); @@ -3828,11 +3193,7 @@ killunsel(const Arg *arg) for (i = selmon->clients; i; i = i->next) { if (ISVISIBLE(i) && i != selmon->sel) { -#if USESYSTRAY - if (!sendevent(i->win, wmatom[WMDelete], NoEventMask, wmatom[WMDelete], CurrentTime, 0, 0, 0)) { -#else if (!sendevent(selmon->sel, wmatom[WMDelete])) { -#endif XGrabServer(dpy); XSetErrorHandler(xerrordummy); XSetCloseDownMode(dpy, DestroyAll); @@ -3871,9 +3232,6 @@ manage(Window w, XWindowAttributes *wa) c->oldbw = wa->border_width; c->cfact = 1.0; -#if USEWINICON - updateicon(c); -#endif updatetitle(c); if (XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) { c->mon = t->mon; @@ -3901,7 +3259,8 @@ manage(Window w, XWindowAttributes *wa) c->y = c->mon->wy + c->mon->wh - HEIGHT(c); c->x = MAX(c->x, c->mon->wx); c->x = MAX(c->x, c->mon->mx); - c->y = MAX(c->y, c->mon->wy); + c->y = MAX(c->y, ((c->mon->bar->by == c->mon->my) && (c->x + (c->w / 2) >= c->mon->wx) + && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my); c->bw = bordersize; wc.border_width = c->bw; @@ -4000,25 +3359,6 @@ manage(Window w, XWindowAttributes *wa) focus(NULL); /* no need if warpcursor is enabled because warpcursor is going to warp and focus the window anyway */ } -void -managealtbar(Window win, XWindowAttributes *wa) -{ - Monitor *m; - if (!(m = recttomon(wa->x, wa->y, wa->width, wa->height))) - return; - - m->barwin = win; - m->by = wa->y; - bh = m->bh = wa->height; - updatebarpos(m); - arrange(m); - XSelectInput(dpy, win, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); - XMoveResizeWindow(dpy, win, wa->x, wa->y, wa->width, wa->height); - XMapWindow(dpy, win); - XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, - (unsigned char *) &win, 1); -} - void managetray(Window win, XWindowAttributes *wa) { @@ -4054,22 +3394,12 @@ maprequest(XEvent *e) static XWindowAttributes wa; XMapRequestEvent *ev = &e->xmaprequest; -#if USESYSTRAY - Client *i; - if ((i = wintosystrayicon(ev->window))) { - sendevent(i->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_WINDOW_ACTIVATE, 0, systray->win, XEMBED_EMBEDDED_VERSION); - resizebarwin(selmon); - updatesystray(); - } -#endif if (!XGetWindowAttributes(dpy, ev->window, &wa) || wa.override_redirect) return; if (!wa.depth) return; - if (wmclasscontains(ev->window, altbarclass, "")) - managealtbar(ev->window, &wa); - else if (!wintoclient(ev->window)) + if (!wintoclient(ev->window)) manage(ev->window, &wa); } @@ -4090,45 +3420,6 @@ motionnotify(XEvent *e) plt = plw; /* NOTE: This is disabled because it is very, very buggy and destroys productivity. I do not recommend using it. */ -#ifdef USETAGPREVIEW_MOUSE - if (ev->window == selmon->barwin) { - i = x = 0; - - /* for leftlayout, we need to add the size of the layout indicator */ - if (selmon->layoutposition) { - lts = TEXTW(selmon->ltsymbol); - } - - for (c = selmon->clients; c; c = c->next) - occ |= c->tags == 255 ? 0 : c->tags; - do { - if (!(occ & 1 << i || selmon->seltags & 1 << i) && selmon->hideemptytags) - continue; - x += TEXTW(tags[i]) + lts + plt; - } while (ev->x >= x && ++i < LENGTH(tags)); - if (mousepreview && !selmon->hidetags) { - if (i < LENGTH(tags)) { - if (selmon->previewshow != (i + 1) - && !(selmon->seltags & 1 << i)) { - selmon->previewshow = i + 1; - showtagpreview(i); - } else if (selmon->seltags & 1 << i) { - selmon->previewshow = 0; - XUnmapWindow(dpy, selmon->tagwin); - } - } else if (selmon->previewshow) { - selmon->previewshow = 0; - XUnmapWindow(dpy, selmon->tagwin); - } - } else if (ev->window == selmon->tagwin) { - selmon->previewshow = 0; - XUnmapWindow(dpy, selmon->tagwin); - } else if (selmon->previewshow) { - selmon->previewshow = 0; - XUnmapWindow(dpy, selmon->tagwin); - } - } /* mousepreview && !selmon->hidetags */ -#endif if (ev->window != root) return; if ((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) { @@ -4469,14 +3760,6 @@ switcherstart(const Arg *arg) XUngrabKeyboard(dpy, CurrentTime); /* stop taking all input from keyboard */ focus(c); - if (warpcursor) { - selmon->allowwarp = 1; - 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); } } else { @@ -4955,19 +4238,6 @@ propertynotify(XEvent *e) Window trans; XPropertyEvent *ev = &e->xproperty; -#if USESYSTRAY - if ((c = wintosystrayicon(ev->window))) { - if (ev->atom == XA_WM_NORMAL_HINTS) { - updatesizehints(c); - updatesystrayicongeom(c, c->w, c->h); - } - else - updatesystrayiconstate(c, ev); - resizebarwin(selmon); - updatesystray(); - } -#endif - if ((ev->window == root) && (ev->atom == XA_WM_NAME)) { if (!getsignal()) updatestatus(); @@ -4988,7 +4258,8 @@ propertynotify(XEvent *e) break; case XA_WM_HINTS: updatewmhints(c); - drawbar(); + if (c->isurgent) + drawbar(); break; } if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) { @@ -4998,13 +4269,6 @@ propertynotify(XEvent *e) if (c == c->mon->sel && !selmon->hidetitle) drawbaritems(c->mon); } -#if USEWINICON - else if (ev->atom == netatom[NetWMIcon]) { - updateicon(c); - if (c == c->mon->sel) - drawbaritems(c->mon); - } -#endif if (ev->atom == netatom[NetWMWindowType]) updatewindowtype(c); if (ev->atom == motifatom) @@ -5205,49 +4469,6 @@ resetmastercount(const Arg *arg) arrange(selmon); } -void -resizebarwin(Monitor *m) { -#if USESYSTRAY - unsigned int w = m->ww; - if (!selmon->hidesystray && m == systraytomon(m) && !systrayposition) - w -= getsystraywidth(); -#endif - - /* this has to be done because of the togglebarpos func */ - if (selmon->barposition) - XMoveResizeWindow(dpy, m->barwin, m->wx + sp, m->by + vp, m->ww - 2 * sp, bh); - else - XMoveResizeWindow(dpy, m->barwin, m->wx + sp, m->by - vp, m->ww - 2 * sp, bh); -} - -#if USESYSTRAY -void -removesystrayicon(Client *i) -{ - Client **ii; - - if (selmon->hidesystray || !i) - return; - for (ii = &systray->icons; *ii && *ii != i; ii = &(*ii)->next); - if (ii) - *ii = i->next; - free(i); -} - -void -resizerequest(XEvent *e) -{ - XResizeRequestEvent *ev = &e->xresizerequest; - Client *i; - - if ((i = wintosystrayicon(ev->window))) { - updatesystrayicongeom(i, ev->width, ev->height); - resizebarwin(selmon); - updatesystray(); - } -} -#endif - void resize(Client *c, int x, int y, int w, int h, int interact) { @@ -5311,7 +4532,7 @@ restack(Monitor *m) XRaiseWindow(dpy, m->sel->win); if (m->lt[m->sellt]->arrange) { wc.stack_mode = Below; - wc.sibling = m->barwin; + wc.sibling = m->bar->win; for (c = m->stack; c; c = c->snext) if (!c->isfloating && ISVISIBLE(c)) { XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc); @@ -5320,13 +4541,6 @@ 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 @@ -5388,9 +4602,7 @@ scan(void) if (!XGetWindowAttributes(dpy, wins[i], &wa) || wa.override_redirect || XGetTransientForHint(dpy, wins[i], &d1)) continue; - if (altbar && wmclasscontains(wins[i], altbarclass, "")) - managealtbar(wins[i], &wa); - else if (wa.map_state == IsViewable || getstate(wins[i]) == IconicState) + if (wa.map_state == IsViewable || getstate(wins[i]) == IconicState) manage(wins[i], &wa); } for (i = 0; i < num; i++) { /* now the transients */ @@ -5593,60 +4805,26 @@ setdesktopnames(void) } int -#if USESYSTRAY -sendevent(Window w, Atom proto, int mask, long d0, long d1, long d2, long d3, long d4) -#else sendevent(Client *c, Atom proto) -#endif { int n; -#if USESYSTRAY - Atom *protocols, mt; -#else Atom *protocols; -#endif int exists = 0; XEvent ev; -#if USESYSTRAY - if (proto == wmatom[WMTakeFocus] || proto == wmatom[WMDelete]) { - mt = wmatom[WMProtocols]; -#endif - -#if USESYSTRAY - if (XGetWMProtocols(dpy, w, &protocols, &n)) { -#else if (XGetWMProtocols(dpy, c->win, &protocols, &n)) { -#endif while (!exists && n--) exists = protocols[n] == proto; XFree(protocols); } -#if USESYSTRAY - } else { - exists = True; - mt = proto; - } -#endif if (exists) { ev.type = ClientMessage; ev.xclient.format = 32; -#if USESYSTRAY - ev.xclient.window = w; - ev.xclient.message_type = mt; - ev.xclient.data.l[0] = d0; - ev.xclient.data.l[1] = d1; - ev.xclient.data.l[2] = d2; - ev.xclient.data.l[3] = d3; - ev.xclient.data.l[4] = d4; - XSendEvent(dpy, w, False, mask, &ev); -#else ev.xclient.window = c->win; ev.xclient.message_type = wmatom[WMProtocols]; ev.xclient.data.l[0] = proto; ev.xclient.data.l[1] = CurrentTime; XSendEvent(dpy, c->win, False, NoEventMask, &ev); -#endif } return exists; } @@ -5670,11 +4848,7 @@ setfocus(Client *c) XA_WINDOW, 32, PropModeReplace, (unsigned char *) &(c->win), 1); } -#if USESYSTRAY - sendevent(c->win, wmatom[WMTakeFocus], NoEventMask, wmatom[WMTakeFocus], CurrentTime, 0, 0, 0); -#else sendevent(c, wmatom[WMTakeFocus]); -#endif } void @@ -5852,16 +5026,7 @@ setup(void) wmatom[WMTakeFocus] = XInternAtom(dpy, "WM_TAKE_FOCUS", False); netatom[NetActiveWindow] = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False); netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); -#if USESYSTRAY - netatom[NetSystemTray] = XInternAtom(dpy, "_NET_SYSTEM_TRAY_S0", False); - netatom[NetSystemTrayOP] = XInternAtom(dpy, "_NET_SYSTEM_TRAY_OPCODE", False); - netatom[NetSystemTrayOrientation] = XInternAtom(dpy, "_NET_SYSTEM_TRAY_ORIENTATION", False); - netatom[NetSystemTrayOrientationHorz] = XInternAtom(dpy, "_NET_SYSTEM_TRAY_ORIENTATION_HORZ", False); -#endif netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); -#if USEWINICON - netatom[NetWMIcon] = XInternAtom(dpy, "_NET_WM_ICON", False); -#endif netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False); if (fullscreenhidebar) @@ -5882,11 +5047,6 @@ setup(void) netatom[NetCurrentDesktop] = XInternAtom(dpy, "_NET_CURRENT_DESKTOP", False); netatom[NetDesktopNames] = XInternAtom(dpy, "_NET_DESKTOP_NAMES", False); motifatom = XInternAtom(dpy, "_MOTIF_WM_HINTS", False); -#if USESYSTRAY - xatom[Manager] = XInternAtom(dpy, "MANAGER", False); - xatom[Xembed] = XInternAtom(dpy, "_XEMBED", False); - xatom[XembedInfo] = XInternAtom(dpy, "_XEMBED_INFO", False); -#endif /* init cursors */ cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr); cursor[CurResize] = drw_cur_create(drw, XC_sizing); @@ -5903,15 +5063,9 @@ setup(void) tagscheme = ecalloc(LENGTH(tagsel), sizeof(Clr *)); for (i = 0; i < LENGTH(tagsel); i++) tagscheme[i] = drw_scm_create(drw, tagsel[i], tagalpha, 2); -#if USESYSTRAY - updatesystray(); -#endif /* init bars */ updatebars(); updatestatus(); -#if USETAGPREVIEW - updatepreview(); -#endif /* supporting window for NetWMCheck */ if (fullscreenhidebar) { @@ -6003,26 +5157,6 @@ seturgent(Client *c, int urg) XFree(wmh); } -#if USETAGPREVIEW -void -showtagpreview(unsigned int i) -{ - if (!selmon->previewshow || !selmon->tagmap[i]) { - XUnmapWindow(dpy, selmon->tagwin); - return; - } - - if (tagpreview && barposition) { - XSetWindowBackgroundPixmap(dpy, selmon->tagwin, selmon->tagmap[i]); - XCopyArea(dpy, selmon->tagmap[i], selmon->tagwin, drw->gc, 0, 0, - selmon->mw / scalepreview, selmon->mh / scalepreview + 50, - 0, 0); - XSync(dpy, False); - XMapWindow(dpy, selmon->tagwin); - } -} -#endif - #if USEXRESOURCES void reloadcolors(const Arg *arg) @@ -6055,50 +5189,6 @@ sigchld(int unused) } } -#if USETAGPREVIEW -void -takepreview(void) -{ - unsigned int occ = 0, i; - Client *c; - Imlib_Image image; - - for (c = selmon->clients; c; c = c->next) - occ |= c->tags == 255 ? 0 : c->tags; - for (i = 0; i < LENGTH(tags); i++) { - /* searching for tags that are occupied && selected */ - if (!(occ & 1 << i) || !(selmon->tagset[selmon->seltags] & 1 << i)) - continue; - - if (selmon->tagmap[i]) { /* tagmap exist, clean it */ - XFreePixmap(dpy, selmon->tagmap[i]); - selmon->tagmap[i] = 0; - } - - if (!(image = imlib_create_image(tw, sh))) { - fprintf(stderr, "speedwm: imlib: failed to create image, skipping.\n"); - continue; - } - imlib_context_set_image(image); - imlib_context_set_display(dpy); - imlib_image_set_has_alpha(1); - imlib_context_set_blend(0); - imlib_context_set_visual(visual); - imlib_context_set_drawable(root); - - if (!barpreview) - imlib_copy_drawable_to_image(0, selmon->wx, selmon->wy, selmon->ww ,selmon->wh, 0, 0, 1); - else - imlib_copy_drawable_to_image(0, selmon->mx, selmon->my, selmon->mw ,selmon->mh, 0, 0, 1); - - selmon->tagmap[i] = XCreatePixmap(dpy, selmon->tagwin, selmon->mw / scalepreview, selmon->mh / scalepreview, depth); - imlib_context_set_drawable(selmon->tagmap[i]); - imlib_render_image_part_on_drawable_at_size(0, 0, selmon->mw, selmon->mh, 0, 0, selmon->mw / scalepreview, selmon->mh / scalepreview); - imlib_free_image(); - } -} -#endif - void sighup(int unused) { @@ -6241,7 +5331,6 @@ toggleltpos(const Arg *arg) selmon->layoutposition = !selmon->layoutposition; updatebarpos(selmon); - resizebarwin(selmon); arrange(selmon); } @@ -6257,30 +5346,16 @@ togglebar(const Arg *arg) if (altbar && !selmon->traywin) scantray(); + Bar *bar; + selmon->showbar = selmon->pertag->showbars[selmon->pertag->curtag] = !selmon->showbar; updatebarpos(selmon); -#if USESYSTRAY - resizebarwin(selmon); - if (!selmon->hidesystray) { - XWindowChanges wc; - if (!selmon->showbar) - wc.y = -bh; - else if (selmon->showbar) { - wc.y = 0; - if (!selmon->barposition) - wc.y = selmon->mh - bh; - } - XConfigureWindow(dpy, systray->win, CWY, &wc); - } -#else - XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, selmon->bh); - XMoveResizeWindow(dpy, selmon->traywin, selmon->wx, selmon->by, selmon->ww, selmon->bh); -#endif - if (altbar) - XMoveResizeWindow(dpy, selmon->traywin, selmon->tx, selmon->by, selmon->tw, selmon->bh); + for (bar = selmon->bar; bar; bar = bar->next) + XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh); arrange(selmon); } +/* void togglebarpos(const Arg *arg) { @@ -6453,23 +5528,9 @@ resetbar(const Arg *arg) selmon->hideunselectedtitle = hideunselectedtitle; selmon->hideemptytags = hideemptytags; - selmon->barposition = barposition; - selmon->layoutposition = layoutposition; - - /* reset barpadding */ resetbarpadding(arg); updatebarpos(selmon); - #if USESYSTRAY - resizebarwin(selmon); - if (!selmon->hidesystray) { - XWindowChanges wc; - wc.y = 0; - if (!selmon->barposition) - wc.y = selmon->mh - bh; - XConfigureWindow(dpy, systray->win, CWY, &wc); - } - #else if (selmon->barposition) { XMoveResizeWindow(dpy, selmon->barwin, selmon->wx + sp, selmon->by + vp, selmon->ww - 2 * sp, selmon->bh); XMoveResizeWindow(dpy, selmon->traywin, selmon->wx + sp, selmon->by + vp, selmon->ww - 2 * sp, selmon->bh); @@ -6477,7 +5538,6 @@ resetbar(const Arg *arg) XMoveResizeWindow(dpy, selmon->barwin, selmon->wx + sp, selmon->by - vp, selmon->ww - 2 * sp, selmon->bh); XMoveResizeWindow(dpy, selmon->traywin, selmon->wx + sp, selmon->by - vp, selmon->ww - 2 * sp, selmon->bh); } - #endif arrange(selmon); } @@ -6487,6 +5547,7 @@ togglelayoutpos(const Arg *arg) selmon->layoutposition = !selmon->layoutposition; arrange(selmon); } +*/ void togglefloating(const Arg *arg) @@ -6530,18 +5591,6 @@ togglefullscr(const Arg *arg) setfullscreen(selmon->sel, !selmon->sel->isfullscreen); } -#if USEWINICON -void -freeicon(Client *c) -{ - if (c->icon) { - XRenderFreePicture(dpy, c->icon); - c->icon = None; - } - updatecurrentdesktop(); -} -#endif - void unfocus(Client *c, int setfocus) { @@ -6585,9 +5634,6 @@ unmanage(Client *c, int destroyed) detach(c); detachstack(c); -#if USEWINICON - freeicon(c); -#endif if (!destroyed) { wc.border_width = c->oldbw; XGrabServer(dpy); /* avoid race conditions */ @@ -6615,21 +5661,6 @@ unmanage(Client *c, int destroyed) } } -void -unmanagealtbar(Window w) -{ - Monitor *m = wintomon(w); - - if (!m) - return; - - m->barwin = 0; - m->by = 0; - m->bh = 0; - updatebarpos(m); - arrange(m); -} - void unmanagetray(Window w) { @@ -6659,19 +5690,6 @@ unmapnotify(XEvent *e) else unmanage(c, 0); } - -#if USESYSTRAY - else if ((c = wintosystrayicon(ev->window))) { - /* KLUDGE! sometimes icons occasionally unmap their windows, but do - * _not_ destroy them. We map those windows back */ - XMapRaised(dpy, c->win); - updatesystray(); - } -#endif - else if (altbar && (m = wintomon(ev->window)) && m->barwin == ev->window) - unmanagealtbar(ev->window); - else if (altbar && m->traywin == ev->window) - unmanagetray(ev->window); } void @@ -6680,9 +5698,8 @@ updatebars(void) if (altbar) return; -#if USESYSTRAY unsigned int w; -#endif + Bar *bar; Monitor *m; XSetWindowAttributes wa = { .override_redirect = True, @@ -6693,34 +5710,16 @@ updatebars(void) }; XClassHint ch = {"speedwm", "speedwm"}; for (m = mons; m; m = m->next) { - #if USETAGPREVIEW - if (!m->tagwin) { - m->tagwin = XCreateWindow(dpy, root, m->wx + sp, m->by + bh + vp + gapsizeov / 2, m->mw / scalepreview, - m->mh / scalepreview, 0, DefaultDepth(dpy, screen), CopyFromParent, - DefaultVisual(dpy, screen), CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa); - XDefineCursor(dpy, m->tagwin, cursor[CurNormal]->cursor); - XUnmapWindow(dpy, m->tagwin); + for (bar = m->bar; bar; bar = bar->next) { + if (!bar->win) { + bar->win = XCreateWindow(dpy, root, bar->bx, bar->by, bar->bw, bar->bh, 0, depth, + InputOutput, visual, + CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa); + XDefineCursor(dpy, bar->win, cursor[CurNormal]->cursor); + XMapRaised(dpy, bar->win); + XSetClassHint(dpy, bar->win, &ch); + } } - #endif - if (m->barwin) - continue; -#if USESYSTRAY - w = m->ww; - if (!selmon->hidesystray && m == systraytomon(m)) - w -= getsystraywidth(); -#endif - m->barwin = XCreateWindow(dpy, root, m->wx + sp, m->by + vp, m->ww - 2 * sp, bh, 0, depth, - InputOutput, visual, - CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa); - XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor); - -#if USESYSTRAY - if (!selmon->hidesystray && m == systraytomon(m)) - XMapRaised(dpy, systray->win); -#endif - - XMapRaised(dpy, m->barwin); - XSetClassHint(dpy, m->barwin, &ch); } } @@ -6729,12 +5728,30 @@ updatebarpos(Monitor *m) { m->wy = m->my; m->wh = m->mh; - if (m->showbar) { - m->wh = m->wh - vp - bh; - m->by = m->barposition ? m->wy : m->wy + m->wh + vp; - m->wy = m->barposition ? m->wy + bh + vp : m->wy; - } else - m->by = -bh - vp; + int num_bars; + Bar *bar; + int y_pad = barpaddingv; + int x_pad = barpaddingh; + + for (bar = m->bar; bar; bar = bar->next) { + bar->bx = m->mx + x_pad; + bar->bw = m->ww - 2 * x_pad; + bar->bh = bh; + } + + if (!m->showbar) { + for (bar = m->bar; bar; bar = bar->next) + bar->by = -bh - y_pad; + return; + } + + for (num_bars = 0, bar = m->bar; bar; bar = bar->next, num_bars++) + if (bar->barposition) + m->wy = m->my + bh + y_pad; + m->wh = m->wh - y_pad * num_bars - bh * num_bars; + + for (bar = m->bar; bar; bar = bar->next) + bar->by = (bar->barposition ? m->wy - bh : m->wy + m->wh); } void @@ -6989,16 +6006,8 @@ updatestatus(void) } } - if (statusallmons) { - for(m = mons; m; m = m->next) - drawbaritems(m); - } else { - drawbaritems(selmon); - } - -#if USESYSTRAY - updatesystray(); -#endif + for (m = mons; m; m = m->next) + drawbaritems(m); } void @@ -7070,40 +6079,6 @@ updatetitle(Client *c) #endif } -#if USEWINICON -void -updateicon(Client *c) -{ - freeicon(c); - c->icon = geticonprop(c->win, &c->icw, &c->ich); -} -#endif - -#if USETAGPREVIEW -void -updatepreview(void) -{ - Monitor *m; - - XSetWindowAttributes wa = { - .background_pixel = 0, - .border_pixel = 0, - .colormap = cmap, - .override_redirect = True, - .event_mask = ButtonPressMask|ExposureMask - }; - - for (m = mons; m; m = m->next) { - m->tagwin = XCreateWindow(dpy, root, m->wx + sp + tagpreviewpaddingh, m->by + bh + vp + tagpreviewpaddingv + gapsizeov / 2, m->mw / scalepreview, m->mh / scalepreview, 0, - depth, CopyFromParent, visual, - CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa); - XDefineCursor(dpy, m->tagwin, cursor[CurNormal]->cursor); - XMapRaised(dpy, m->tagwin); - XUnmapWindow(dpy, m->tagwin); - } -} -#endif - void updatewindowtype(Client *c) { @@ -7147,9 +6122,6 @@ view(const Arg *arg) if(arg->ui && (arg->ui & TAGMASK) == selmon->tagset[selmon->seltags]) return; -#if USETAGPREVIEW - takepreview(); -#endif for (m = mons; m; m = m->next) m->seltags ^= 1; if (arg->ui & TAGMASK) { @@ -7186,41 +6158,11 @@ view(const Arg *arg) togglebar(NULL); } -#if USETAGPREVIEW - XUnmapWindow(dpy, selmon->tagwin); -#endif focus(NULL); arrange(NULL); updatecurrentdesktop(); -#if USETAGPREVIEW - takepreview(); -#endif } -#if USEMOUSE -void -warp(const Client *c) -{ - int x, y; - - if (!c) { - XWarpPointer(dpy, None, root, 0, 0, 0, 0, selmon->wx + selmon->ww / 2, selmon->wy + selmon->wh / 2); - return; - } - - if (!getrootptr(&x, &y) || - (x > c->x - c->bw && - y > c->y - c->bw && - x < c->x + c->w + c->bw*2 && - y < c->y + c->h + c->bw*2) || - (y > c->mon->by && y < c->mon->by + bh) || - (c->mon->barposition && !y)) - return; - - XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w / 2, c->h / 2); -} -#endif - pid_t winpid(Window w) { @@ -7352,164 +6294,6 @@ swallowingclient(Window w) return NULL; } -#if USESYSTRAY -void -updatesystrayicongeom(Client *i, int w, int h) -{ - if (i) { - i->h = bh; - if (w == h) - i->w = bh; - else if (h == bh) - i->w = w; - else - i->w = (int) ((float)bh * ((float)w / (float)h)); - applysizehints(i, &(i->x), &(i->y), &(i->w), &(i->h), False); - /* force icons into the systray dimensions if they don't want to */ - if (i->h > bh) { - if (i->w == i->h) - i->w = bh; - else - i->w = (int) ((float)bh * ((float)i->w / (float)i->h)); - i->h = bh; - } - } -} - -void -updatesystrayiconstate(Client *i, XPropertyEvent *ev) -{ - long flags; - int code = 0; - - if (selmon->hidesystray || !i || ev->atom != xatom[XembedInfo] || - !(flags = getatomprop(i, xatom[XembedInfo]))) - return; - - if (flags & XEMBED_MAPPED && !i->tags) { - i->tags = 1; - code = XEMBED_WINDOW_ACTIVATE; - XMapRaised(dpy, i->win); - setclientstate(i, NormalState); - } - else if (!(flags & XEMBED_MAPPED) && i->tags) { - i->tags = 0; - code = XEMBED_WINDOW_DEACTIVATE; - XUnmapWindow(dpy, i->win); - setclientstate(i, WithdrawnState); - } - else - return; - sendevent(i->win, xatom[Xembed], StructureNotifyMask, CurrentTime, code, 0, - systray->win, XEMBED_EMBEDDED_VERSION); -} - -void -updatesystray(void) -{ - XSetWindowAttributes wa; - XWindowChanges wc; - Client *i; - Monitor *m = systraytomon(NULL); - unsigned int x = m->mx + m->mw - sp; - unsigned int y = m->by; - - if (!selmon->barposition) - y -= vp; - else - y += vp; - - unsigned int sw = TEXTWM(stext) - lrpad + systrayspacing; - unsigned int w = 1; - - if (selmon->hidesystray) - return; - if (systrayposition) - x -= sw + lrpad / 2; - if (!systray) { - /* init systray */ - if (!(systray = (Systray *)calloc(1, sizeof(Systray)))) - die("fatal: could not malloc() %u bytes\n", sizeof(Systray)); - systray->win = XCreateSimpleWindow(dpy, root, x, y, w, bh, 0, 0, scheme[SchemeSystray][ColBg].pixel); - wa.event_mask = ButtonPressMask | ExposureMask; - wa.override_redirect = True; - wa.background_pixel = scheme[SchemeSystray][ColBg].pixel; - XSelectInput(dpy, systray->win, SubstructureNotifyMask); - XChangeProperty(dpy, systray->win, netatom[NetSystemTrayOrientation], XA_CARDINAL, 32, - PropModeReplace, (unsigned char *)&netatom[NetSystemTrayOrientationHorz], 1); - XChangeWindowAttributes(dpy, systray->win, CWEventMask|CWOverrideRedirect|CWBackPixel, &wa); - XMapRaised(dpy, systray->win); - XSetSelectionOwner(dpy, netatom[NetSystemTray], systray->win, CurrentTime); - if (XGetSelectionOwner(dpy, netatom[NetSystemTray]) == systray->win) { - sendevent(root, xatom[Manager], StructureNotifyMask, CurrentTime, netatom[NetSystemTray], systray->win, 0, 0); - XSync(dpy, False); - } - else { - fprintf(stderr, "speedwm: failed to get systray.\n"); - free(systray); - systray = NULL; - return; - } - } - for (w = 0, i = systray->icons; i; i = i->next) { - /* make sure the background color stays the same */ - wa.background_pixel = scheme[SchemeSystray][ColBg].pixel; - XChangeWindowAttributes(dpy, i->win, CWBackPixel, &wa); - XMapRaised(dpy, i->win); - w += systrayspacing; - i->x = w; - XMoveResizeWindow(dpy, i->win, i->x, 0, i->w, i->h); - w += i->w; - if (i->mon != m) - i->mon = m; - } - w = w ? w + systrayspacing : 1; - x -= w; - XMoveResizeWindow(dpy, systray->win, x, m->by, w, bh); - wc.x = x; wc.y = y; wc.width = w; wc.height = bh; - wc.stack_mode = Above; wc.sibling = m->barwin; - XConfigureWindow(dpy, systray->win, CWX|CWY|CWWidth|CWHeight|CWSibling|CWStackMode, &wc); - XMapWindow(dpy, systray->win); - XMapSubwindows(dpy, systray->win); - /* redraw background */ - XSetForeground(dpy, drw->gc, scheme[SchemeSystray][ColBg].pixel); - /* XFillRectangle(dpy, systray->win, drw->gc, 0, 0, w, bh); vanilla */ - XFillRectangle(dpy, systray->win, XCreateGC(dpy, root, 0 , NULL), 0, 0, w, bh); - XSync(dpy, False); -} - -Client * -wintosystrayicon(Window w) { - Client *i = NULL; - - if (selmon->hidesystray || !w) - return i; - for (i = systray->icons; i && i->win != w; i = i->next) ; - return i; -} -#endif - -Monitor * -systraytomon(Monitor *m) { -#if USESYSTRAY - Monitor *t; - int i, n; - if(!systraypinning) { - if(!m) - return selmon; - return m == selmon ? m : NULL; - } - for(n = 1, t = mons; t && t->next; n++, t = t->next) ; - for(i = 1, t = mons; t && t->next && i < systraypinning; i++, t = t->next) ; - if(systraypinningfailfirst && n < systraypinning) - return mons; - return t; -#else - return 0; -#endif - /* doing this allows us to only have one instance of drawbar stuff */ -} - Client * wintoclient(Window w) { @@ -7529,12 +6313,14 @@ wintomon(Window w) int x, y; Client *c; Monitor *m; + Bar *bar; if (w == root && getrootptr(&x, &y)) return recttomon(x, y, 1, 1); for (m = mons; m; m = m->next) - if (w == m->barwin || w == m->traywin) - return m; + for (bar = m->bar; bar; bar = bar->next) + if (w == bar->win) + return m; if ((c = wintoclient(w))) return c->mon; return selmon; @@ -7706,19 +6492,6 @@ load_xresources(void) } #endif -/* Thanks to https://codeberg.org/explosion-mental/demwm for this! */ -void -previewtag(const Arg *arg) -{ -#if USETAGPREVIEW - if (selmon->previewshow != (arg->ui + 1)) - selmon->previewshow = arg->ui + 1; - else - selmon->previewshow = 0; - showtagpreview(arg->ui); -#endif -} - void setclienttagprop(Client *c) { diff --git a/toggle.h b/toggle.h index 9ddd153..66f4ebb 100644 --- a/toggle.h +++ b/toggle.h @@ -5,7 +5,7 @@ */ /* IPC */ -#define USEIPC 1 /* Whether or not to include IPC. +#define USEIPC 0 /* Whether or not to include IPC. NOTE: If you set this to 1, set USEIPC to true in toggle.mk and comment the YAJLLIBS and YAJLINC lines in config.mk. Not compatible with BSDs so for those, set this to 0. */ @@ -19,7 +19,7 @@ Not compatible with BSDs so for those, set this to 0. */ /* Miscellanious */ #define USESWITCHER 1 /* Whether or not to include the switcher */ -#define USESYSTRAY 1 /* Whether or not to include the systray */ +#define USESYSTRAY 0 /* Whether or not to include the systray */ #define USEROUNDCORNERS 1 /* Whether or not to include rounded corners */ #define USEMEDIA 1 /* Whether or not to include media keys */ #define USEMOUSE 1 /* Whether or not to include mouse binds */ @@ -31,5 +31,5 @@ Not compatible with BSDs so for those, set this to 0. */ * If you wish to disable them though, set them to 0. */ #define USEIMLIB2 1 /* Whether or not to include imlib2. Required by USEWINICON and USETAGPREVIEW. */ -#define USEWINICON 1 /* Whether or not to include window icons. Requires imlib to be enabled in toggle.mk and it must be installed. */ -#define USETAGPREVIEW 1 /* Whether or not to include tag previews. Requires imlib to be enabled in toggle.mk and it must be installed. */ +#define USEWINICON 0 /* Whether or not to include window icons. Requires imlib to be enabled in toggle.mk and it must be installed. */ +#define USETAGPREVIEW 0 /* Whether or not to include tag previews. Requires imlib to be enabled in toggle.mk and it must be installed. */