Browse Source

Dwm Flexipatch finalized

main
Yigit Colakoglu 4 years ago
parent
commit
00f9b6b4d3
234 changed files with 48 additions and 15040 deletions
  1. +1
    -5
      suckless/dwm/Makefile
  2. +0
    -0
      suckless/dwm/colors.h
  3. +0
    -33
      suckless/dwm/config.bak
  4. +0
    -241
      suckless/dwm/drw.c
  5. +0
    -36
      suckless/dwm/drw.h
  6. +5
    -1991
      suckless/dwm/dwm.c
  7. +0
    -24
      suckless/dwm/patch/aspectresize.c
  8. +0
    -1
      suckless/dwm/patch/aspectresize.h
  9. +0
    -42
      suckless/dwm/patch/attachx.c
  10. +0
    -1
      suckless/dwm/patch/attachx.h
  11. +1
    -1
      suckless/dwm/patch/autostart.c
  12. +1
    -1
      suckless/dwm/patch/autostart.h
  13. +0
    -42
      suckless/dwm/patch/bar_alpha.c
  14. +0
    -3
      suckless/dwm/patch/bar_alpha.h
  15. +0
    -6
      suckless/dwm/patch/bar_alternativetags.c
  16. +0
    -1
      suckless/dwm/patch/bar_alternativetags.h
  17. +0
    -82
      suckless/dwm/patch/bar_anybar.c
  18. +0
    -4
      suckless/dwm/patch/bar_anybar.h
  19. +0
    -79
      suckless/dwm/patch/bar_awesomebar.c
  20. +0
    -3
      suckless/dwm/patch/bar_awesomebar.h
  21. +1
    -1
      suckless/dwm/patch/bar_dwmblocks.c
  22. +1
    -1
      suckless/dwm/patch/bar_dwmblocks.h
  23. +0
    -52
      suckless/dwm/patch/bar_ewmhtags.c
  24. +0
    -6
      suckless/dwm/patch/bar_ewmhtags.h
  25. +0
    -70
      suckless/dwm/patch/bar_fancybar.c
  26. +0
    -3
      suckless/dwm/patch/bar_fancybar.h
  27. +0
    -436
      suckless/dwm/patch/bar_flexwintitle.c
  28. +0
    -10
      suckless/dwm/patch/bar_flexwintitle.h
  29. +0
    -37
      suckless/dwm/patch/bar_holdbar.c
  30. +0
    -2
      suckless/dwm/patch/bar_holdbar.h
  31. +1
    -8
      suckless/dwm/patch/bar_indicators.c
  32. +1
    -1
      suckless/dwm/patch/bar_indicators.h
  33. +1
    -1
      suckless/dwm/patch/bar_ltsymbol.c
  34. +0
    -121
      suckless/dwm/patch/bar_powerline_status.c
  35. +0
    -11
      suckless/dwm/patch/bar_powerline_status.h
  36. +0
    -106
      suckless/dwm/patch/bar_powerline_tags.c
  37. +0
    -3
      suckless/dwm/patch/bar_powerline_tags.h
  38. +0
    -14
      suckless/dwm/patch/bar_status.c
  39. +1
    -7
      suckless/dwm/patch/bar_status.h
  40. +1
    -102
      suckless/dwm/patch/bar_status2d.c
  41. +1
    -10
      suckless/dwm/patch/bar_status2d.h
  42. +0
    -17
      suckless/dwm/patch/bar_statusbutton.c
  43. +0
    -3
      suckless/dwm/patch/bar_statusbutton.h
  44. +0
    -29
      suckless/dwm/patch/bar_statuscmd.c
  45. +1
    -4
      suckless/dwm/patch/bar_statuscmd.h
  46. +0
    -23
      suckless/dwm/patch/bar_statuscolors.c
  47. +1
    -17
      suckless/dwm/patch/bar_systray.c
  48. +0
    -220
      suckless/dwm/patch/bar_tabgroups.c
  49. +0
    -7
      suckless/dwm/patch/bar_tabgroups.h
  50. +0
    -149
      suckless/dwm/patch/bar_taggrid.c
  51. +0
    -4
      suckless/dwm/patch/bar_taggrid.h
  52. +1
    -13
      suckless/dwm/patch/bar_tagicons.c
  53. +1
    -1
      suckless/dwm/patch/bar_tagicons.h
  54. +0
    -29
      suckless/dwm/patch/bar_tags.c
  55. +1
    -1
      suckless/dwm/patch/bar_tags.h
  56. +0
    -68
      suckless/dwm/patch/bar_vtcolors.c
  57. +0
    -2
      suckless/dwm/patch/bar_vtcolors.h
  58. +0
    -51
      suckless/dwm/patch/bar_wintitle.c
  59. +0
    -3
      suckless/dwm/patch/bar_wintitle.h
  60. +0
    -45
      suckless/dwm/patch/bar_wintitle_floating.c
  61. +0
    -8
      suckless/dwm/patch/bar_wintitle_floating.h
  62. +0
    -45
      suckless/dwm/patch/bar_wintitle_hidden.c
  63. +0
    -8
      suckless/dwm/patch/bar_wintitle_hidden.h
  64. +0
    -93
      suckless/dwm/patch/bar_wintitleactions.c
  65. +0
    -5
      suckless/dwm/patch/bar_wintitleactions.h
  66. +0
    -23
      suckless/dwm/patch/cfacts.c
  67. +0
    -1
      suckless/dwm/patch/cfacts.h
  68. +0
    -5
      suckless/dwm/patch/cmdcustomize.c
  69. +0
    -1
      suckless/dwm/patch/cmdcustomize.h
  70. +1
    -11
      suckless/dwm/patch/combo.c
  71. +1
    -3
      suckless/dwm/patch/combo.h
  72. +0
    -28
      suckless/dwm/patch/cool_autostart.c
  73. +0
    -1
      suckless/dwm/patch/cool_autostart.h
  74. +1
    -1
      suckless/dwm/patch/cyclelayouts.h
  75. +0
    -38
      suckless/dwm/patch/decorationhints.c
  76. +0
    -8
      suckless/dwm/patch/decorationhints.h
  77. +0
    -82
      suckless/dwm/patch/dragcfact.c
  78. +0
    -1
      suckless/dwm/patch/dragcfact.h
  79. +0
    -231
      suckless/dwm/patch/dragmfact.c
  80. +0
    -1
      suckless/dwm/patch/dragmfact.h
  81. +0
    -129
      suckless/dwm/patch/dwmc
  82. +0
    -100
      suckless/dwm/patch/dwmc.c
  83. +0
    -13
      suckless/dwm/patch/dwmc.h
  84. +0
    -195
      suckless/dwm/patch/exresize.c
  85. +0
    -8
      suckless/dwm/patch/exresize.h
  86. +0
    -18
      suckless/dwm/patch/fakefullscreenclient.c
  87. +0
    -1
      suckless/dwm/patch/fakefullscreenclient.h
  88. +0
    -11
      suckless/dwm/patch/floatpos.c
  89. +1
    -1
      suckless/dwm/patch/floatpos.h
  90. +0
    -73
      suckless/dwm/patch/focusadjacenttag.c
  91. +0
    -6
      suckless/dwm/patch/focusadjacenttag.h
  92. +0
    -65
      suckless/dwm/patch/focusdir.c
  93. +0
    -1
      suckless/dwm/patch/focusdir.h
  94. +0
    -13
      suckless/dwm/patch/focusmaster.c
  95. +0
    -1
      suckless/dwm/patch/focusmaster.h
  96. +0
    -15
      suckless/dwm/patch/focusurgent.c
  97. +0
    -1
      suckless/dwm/patch/focusurgent.h
  98. +0
    -40
      suckless/dwm/patch/fsignal.c
  99. +0
    -7
      suckless/dwm/patch/fsignal.h
  100. +1
    -3
      suckless/dwm/patch/fullscreen.c

+ 1
- 5
suckless/dwm/Makefile View File

@ -23,14 +23,11 @@ options:
.c.o:
${CC} -c ${CFLAGS} $<
${OBJ}: config.h config.mk patches.h
${OBJ}: config.h config.mk
config.h:
cp config.def.h $@
patches.h:
cp patches.def.h $@
dwm: ${OBJ}
${CC} -o $@ ${OBJ} ${LDFLAGS}
@ -57,7 +54,6 @@ install: all
ifdef YAJLLIBS
cp -f dwm-msg ${DESTDIR}${PREFIX}/bin
endif
#cp -f patch/dwmc ${DESTDIR}${PREFIX}/bin
chmod 755 ${DESTDIR}${PREFIX}/bin/dwm
ifdef YAJLLIBS
chmod 755 ${DESTDIR}${PREFIX}/bin/dwm-msg


suckless/dwm/theme.h → suckless/dwm/colors.h View File


+ 0
- 33
suckless/dwm/config.bak View File

@ -1,33 +0,0 @@
/* See LICENSE file for copyright and license details. */
#include <X11/XF86keysym.h>
/* appearance */
static const int rmaster = 0; /* 1 = master at right*/
static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
static const unsigned int systrayspacing = 2; /* systray spacing */
static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/
static const int showsystray = 1; /* 0 means no systray */
static const int tag_padding = 0;
static const int vertpad = 0; /* vertical padding of bar */
static const int sidepad = 0; /* horizontal padding of bar */
/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"};
//static const char *alttags[] = { "󰄯", "󰄯", "󰄯", "󰄯"};
/* layout(s) */
static const float mfact = 0.5; /* factor of master area size [0.05..0.95] */
static const int nmaster = 1; /* number of clients in master area */
static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */
static const Layout layouts[] = {
/* symbol arrange function */
{ "鉶", tile }, /* first entry is default */
/* { "", dwindle }, */
{ "ﱖ", grid },
{ "", centeredmaster },
{ "", centeredfloatingmaster },
{ "[M]", monocle },
{ "[D]", deck },
{ NULL, NULL },
};

+ 0
- 241
suckless/dwm/drw.c View File

@ -5,11 +5,9 @@
#include <X11/Xlib.h>
#include <X11/Xft/Xft.h>
#include "patches.h"
#include "drw.h"
#include "util.h"
#if !BAR_PANGO_PATCH
#define UTF_INVALID 0xFFFD
#define UTF_SIZ 4
@ -17,13 +15,8 @@ static const unsigned char utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0}
static const unsigned char utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8};
static const long utfmin[UTF_SIZ + 1] = { 0, 0, 0x80, 0x800, 0x10000};
static const long utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF};
#endif // BAR_PANGO_PATCH
#if BAR_POWERLINE_TAGS_PATCH || BAR_POWERLINE_STATUS_PATCH
Clr transcheme[3];
#endif // BAR_POWERLINE_TAGS_PATCH | BAR_POWERLINE_STATUS_PATCH
#if !BAR_PANGO_PATCH
static long
utf8decodebyte(const char c, size_t *i)
{
@ -67,14 +60,9 @@ utf8decode(const char *c, long *u, size_t clen)
return len;
}
#endif // BAR_PANGO_PATCH
Drw *
#if BAR_ALPHA_PATCH
drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap)
#else
drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h)
#endif // BAR_ALPHA_PATCH
{
Drw *drw = ecalloc(1, sizeof(Drw));
@ -84,16 +72,8 @@ drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h
drw->w = w;
drw->h = h;
#if BAR_ALPHA_PATCH
drw->visual = visual;
drw->depth = depth;
drw->cmap = cmap;
drw->drawable = XCreatePixmap(dpy, root, w, h, depth);
drw->gc = XCreateGC(dpy, drw->drawable, 0, NULL);
#else
drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen));
drw->gc = XCreateGC(dpy, root, 0, NULL);
#endif // BAR_ALPHA_PATCH
XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);
return drw;
@ -109,11 +89,7 @@ drw_resize(Drw *drw, unsigned int w, unsigned int h)
drw->h = h;
if (drw->drawable)
XFreePixmap(drw->dpy, drw->drawable);
#if BAR_ALPHA_PATCH
drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, drw->depth);
#else
drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen));
#endif // BAR_ALPHA_PATCH
}
void
@ -125,41 +101,6 @@ drw_free(Drw *drw)
free(drw);
}
#if BAR_PANGO_PATCH
/* This function is an implementation detail. Library users should use
* drw_font_create instead.
*/
static Fnt *
xfont_create(Drw *drw, const char *fontname)
{
Fnt *font;
PangoFontMap *fontmap;
PangoContext *context;
PangoFontDescription *desc;
PangoFontMetrics *metrics;
if (!fontname) {
die("no font specified.");
}
font = ecalloc(1, sizeof(Fnt));
font->dpy = drw->dpy;
fontmap = pango_xft_get_font_map(drw->dpy, drw->screen);
context = pango_font_map_create_context(fontmap);
desc = pango_font_description_from_string(fontname);
font->layout = pango_layout_new(context);
pango_layout_set_font_description(font->layout, desc);
metrics = pango_context_get_metrics(context, desc, pango_language_from_string ("en-us"));
font->h = pango_font_metrics_get_height(metrics) / PANGO_SCALE;
pango_font_metrics_unref(metrics);
g_object_unref(context);
return font;
}
#else
/* This function is an implementation detail. Library users should use
* drw_fontset_create instead.
*/
@ -194,7 +135,6 @@ xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
die("no font specified.");
}
#if !BAR_COLOR_EMOJI_PATCH
/* Do not allow using color fonts. This is a workaround for a BadLength
* error from Xft with color glyphs. Modelled on the Xterm workaround. See
* https://bugzilla.redhat.com/show_bug.cgi?id=1498269
@ -207,7 +147,6 @@ xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
XftFontClose(drw->dpy, xfont);
return NULL;
}
#endif // BAR_COLOR_EMOJI_PATCH
font = ecalloc(1, sizeof(Fnt));
font->xfont = xfont;
@ -217,38 +156,18 @@ xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
return font;
}
#endif // BAR_PANGO_PATCH
static void
xfont_free(Fnt *font)
{
if (!font)
return;
#if BAR_PANGO_PATCH
if (font->layout)
g_object_unref(font->layout);
#else
if (font->pattern)
FcPatternDestroy(font->pattern);
XftFontClose(font->dpy, font->xfont);
#endif // BAR_PANGO_PATCH
free(font);
}
#if BAR_PANGO_PATCH
Fnt*
drw_font_create(Drw* drw, const char font[])
{
Fnt *fnt = NULL;
if (!drw || !font)
return NULL;
fnt = xfont_create(drw, font);
return (drw->fonts = fnt);
}
#else
Fnt*
drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount)
{
@ -266,15 +185,12 @@ drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount)
}
return (drw->fonts = ret);
}
#endif // BAR_PANGO_PATCH
void
drw_fontset_free(Fnt *font)
{
if (font) {
#if !BAR_PANGO_PATCH
drw_fontset_free(font->next);
#endif // BAR_PANGO_PATCH
xfont_free(font);
}
}
@ -284,29 +200,16 @@ drw_clr_create(
Drw *drw,
Clr *dest,
const char *clrname
#if BAR_ALPHA_PATCH
, unsigned int alpha
#endif // BAR_ALPHA_PATCH
) {
if (!drw || !dest || !clrname)
return;
#if BAR_ALPHA_PATCH
if (!XftColorAllocName(drw->dpy, drw->visual, drw->cmap,
clrname, dest))
die("error, cannot allocate color '%s'", clrname);
dest->pixel = (dest->pixel & 0x00ffffffU) | (alpha << 24);
#else
if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
DefaultColormap(drw->dpy, drw->screen),
clrname, dest))
die("error, cannot allocate color '%s'", clrname);
#if NO_TRANSPARENT_BORDERS_PATCH
dest->pixel |= 0xff << 24;
#endif // NO_TRANSPARENT_BORDERS_PATCH
#endif // BAR_ALPHA_PATCH
}
/* Wrapper to create color schemes. The caller has to call free(3) on the
@ -315,9 +218,6 @@ Clr *
drw_scm_create(
Drw *drw,
char *clrnames[],
#if BAR_ALPHA_PATCH
const unsigned int alphas[],
#endif // BAR_ALPHA_PATCH
size_t clrcount
) {
size_t i;
@ -328,22 +228,16 @@ drw_scm_create(
return NULL;
for (i = 0; i < clrcount; i++)
#if BAR_ALPHA_PATCH
drw_clr_create(drw, &ret[i], clrnames[i], alphas[i]);
#else
drw_clr_create(drw, &ret[i], clrnames[i]);
#endif // BAR_ALPHA_PATCH
return ret;
}
#if !BAR_PANGO_PATCH
void
drw_setfontset(Drw *drw, Fnt *set)
{
if (drw)
drw->fonts = set;
}
#endif // BAR_PANGO_PATCH
void
drw_setscheme(Drw *drw, Clr *scm)
@ -352,16 +246,6 @@ drw_setscheme(Drw *drw, Clr *scm)
drw->scheme = scm;
}
#if BAR_POWERLINE_TAGS_PATCH || BAR_POWERLINE_STATUS_PATCH
void
drw_settrans(Drw *drw, Clr *psc, Clr *nsc)
{
if (drw) {
transcheme[0] = psc[ColBg]; transcheme[1] = nsc[ColBg]; transcheme[2] = psc[ColBorder];
drw->scheme = transcheme;
}
}
#endif // BAR_POWERLINE_TAGS_PATCH | BAR_POWERLINE_STATUS_PATCH
void
drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert)
@ -375,72 +259,6 @@ drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int
XDrawRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w - 1, h - 1);
}
#if BAR_PANGO_PATCH
int
drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert, Bool markup)
{
char buf[1024];
int ty;
unsigned int ew;
XftDraw *d = NULL;
size_t i, len;
int render = x || y || w || h;
if (!drw || (render && !drw->scheme) || !text || !drw->fonts)
return 0;
if (!render) {
w = ~w;
} else {
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
#if BAR_ALPHA_PATCH
d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap);
#else
d = XftDrawCreate(drw->dpy, drw->drawable,
DefaultVisual(drw->dpy, drw->screen),
DefaultColormap(drw->dpy, drw->screen));
#endif // BAR_ALPHA_PATCH
x += lpad;
w -= lpad;
}
len = strlen(text);
if (len) {
drw_font_getexts(drw->fonts, text, len, &ew, NULL, markup);
/* shorten text if necessary */
for (len = MIN(len, sizeof(buf) - 1); len && ew > w; len--)
drw_font_getexts(drw->fonts, text, len, &ew, NULL, markup);
if (len) {
memcpy(buf, text, len);
buf[len] = '\0';
if (len < strlen(text))
for (i = len; i && i > len - 3; buf[--i] = '.')
; /* NOP */
if (render) {
ty = y + (h - drw->fonts->h) / 2;
if (markup)
pango_layout_set_markup(drw->fonts->layout, buf, len);
else
pango_layout_set_text(drw->fonts->layout, buf, len);
pango_xft_render_layout(d, &drw->scheme[invert ? ColBg : ColFg],
drw->fonts->layout, x * PANGO_SCALE, ty * PANGO_SCALE);
if (markup) /* clear markup attributes */
pango_layout_set_attributes(drw->fonts->layout, NULL);
}
x += ew;
w -= ew;
}
}
if (d)
XftDrawDestroy(d);
return x + (render ? w : 0);
}
#else
int
drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert, Bool ignored)
{
@ -467,13 +285,9 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
} else {
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
#if BAR_ALPHA_PATCH
d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap);
#else
d = XftDrawCreate(drw->dpy, drw->drawable,
DefaultVisual(drw->dpy, drw->screen),
DefaultColormap(drw->dpy, drw->screen));
#endif // BAR_ALPHA_PATCH
x += lpad;
w -= lpad;
}
@ -575,40 +389,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
return x + (render ? w : 0);
}
#endif // BAR_PANGO_PATCH
#if BAR_POWERLINE_TAGS_PATCH || BAR_POWERLINE_STATUS_PATCH
void
drw_arrow(Drw *drw, int x, int y, unsigned int w, unsigned int h, int direction, int slash)
{
if (!drw || !drw->scheme)
return;
/* direction=1 draws right arrow */
x = direction ? x : x + w;
w = direction ? w : -w;
/* slash=1 draws slash instead of arrow */
unsigned int hh = slash ? (direction ? 0 : h) : h/2;
XPoint points[] = {
{x , y },
{x + w, y + hh },
{x , y + h },
};
XPoint bg[] = {
{x , y },
{x + w, y },
{x + w, y + h},
{x , y + h},
};
XSetForeground(drw->dpy, drw->gc, drw->scheme[ColBg].pixel);
XFillPolygon(drw->dpy, drw->drawable, drw->gc, bg, 4, Convex, CoordModeOrigin);
XSetForeground(drw->dpy, drw->gc, drw->scheme[ColFg].pixel);
XFillPolygon(drw->dpy, drw->drawable, drw->gc, points, 3, Nonconvex, CoordModeOrigin);
}
#endif // BAR_POWERLINE_TAGS_PATCH | BAR_POWERLINE_STATUS_PATCH
void
drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h)
@ -628,27 +409,6 @@ drw_fontset_getwidth(Drw *drw, const char *text, Bool markup)
return drw_text(drw, 0, 0, 0, 0, 0, text, 0, markup);
}
#if BAR_PANGO_PATCH
void
drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h, Bool markup)
{
if (!font || !text)
return;
PangoRectangle r;
if (markup)
pango_layout_set_markup(font->layout, text, len);
else
pango_layout_set_text(font->layout, text, len);
pango_layout_get_extents(font->layout, 0, &r);
if (markup) /* clear markup attributes */
pango_layout_set_attributes(font->layout, NULL);
if (w)
*w = r.width / PANGO_SCALE;
if (h)
*h = font->h;
}
#else
void
drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h)
{
@ -663,7 +423,6 @@ drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w,
if (h)
*h = font->h;
}
#endif // BAR_PANGO_PATCH
Cur *
drw_cur_create(Drw *drw, int shape)


+ 0
- 36
suckless/dwm/drw.h View File

@ -1,9 +1,5 @@
/* See LICENSE file for copyright and license details. */
#if BAR_PANGO_PATCH
#include <pango/pango.h>
#include <pango/pangoxft.h>
#endif // BAR_PANGO_PATCH
typedef struct {
Cursor cursor;
@ -12,13 +8,9 @@ typedef struct {
typedef struct Fnt {
Display *dpy;
unsigned int h;
#if BAR_PANGO_PATCH
PangoLayout *layout;
#else
XftFont *xfont;
FcPattern *pattern;
struct Fnt *next;
#endif // BAR_PANGO_PATCH
} Fnt;
enum { ColFg, ColBg, ColBorder, ColFloat, ColCount }; /* Clr scheme index */
@ -29,11 +21,6 @@ typedef struct {
Display *dpy;
int screen;
Window root;
#if BAR_ALPHA_PATCH
Visual *visual;
unsigned int depth;
Colormap cmap;
#endif // BAR_ALPHA_PATCH
Drawable drawable;
GC gc;
Clr *scheme;
@ -41,22 +28,13 @@ typedef struct {
} Drw;
/* Drawable abstraction */
#if BAR_ALPHA_PATCH
Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap);
#else
Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h);
#endif // BAR_ALPHA_PATCH
void drw_resize(Drw *drw, unsigned int w, unsigned int h);
void drw_free(Drw *drw);
/* Fnt abstraction */
#if BAR_PANGO_PATCH
Fnt *drw_font_create(Drw* drw, const char font[]);
void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h, Bool markup);
#else
Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount);
void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
#endif // BAR_PANGO_PATCH
void drw_fontset_free(Fnt* set);
unsigned int drw_fontset_getwidth(Drw *drw, const char *text, Bool markup);
@ -65,16 +43,10 @@ void drw_clr_create(
Drw *drw,
Clr *dest,
const char *clrname
#if BAR_ALPHA_PATCH
, unsigned int alpha
#endif // BAR_ALPHA_PATCH
);
Clr *drw_scm_create(
Drw *drw,
char *clrnames[],
#if BAR_ALPHA_PATCH
const unsigned int alphas[],
#endif // BAR_ALPHA_PATCH
size_t clrcount
);
@ -83,20 +55,12 @@ Cur *drw_cur_create(Drw *drw, int shape);
void drw_cur_free(Drw *drw, Cur *cursor);
/* Drawing context manipulation */
#if !BAR_PANGO_PATCH
void drw_setfontset(Drw *drw, Fnt *set);
#endif // BAR_PANGO_PATCH
void drw_setscheme(Drw *drw, Clr *scm);
#if BAR_POWERLINE_TAGS_PATCH || BAR_POWERLINE_STATUS_PATCH
void drw_settrans(Drw *drw, Clr *psc, Clr *nsc);
#endif // BAR_POWERLINE_TAGS_PATCH | BAR_POWERLINE_STATUS_PATCH
/* Drawing functions */
void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert);
int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert, Bool markup);
#if BAR_POWERLINE_TAGS_PATCH || BAR_POWERLINE_STATUS_PATCH
void drw_arrow(Drw *drw, int x, int y, unsigned int w, unsigned int h, int direction, int slash);
#endif // BAR_POWERLINE_TAGS_PATCH | BAR_POWERLINE_STATUS_PATCH
/* Map functions */
void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);

+ 5
- 1991
suckless/dwm/dwm.c
File diff suppressed because it is too large
View File


+ 0
- 24
suckless/dwm/patch/aspectresize.c View File

@ -1,24 +0,0 @@
void
aspectresize(const Arg *arg)
{
/* only floating windows can be moved */
Client *c;
c = selmon->sel;
float ratio;
int w, h,nw, nh;
if (!c || !arg)
return;
if (selmon->lt[selmon->sellt]->arrange && !c->isfloating)
return;
ratio = (float)c->w / (float)c->h;
h = arg->i;
w = (int)(ratio * h);
nw = c->w + w;
nh = c->h + h;
XRaiseWindow(dpy, c->win);
resize(c, c->x, c->y, nw, nh, True);
}

+ 0
- 1
suckless/dwm/patch/aspectresize.h View File

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

+ 0
- 42
suckless/dwm/patch/attachx.c View File

@ -1,42 +0,0 @@
void
attachx(Client *c)
{
#if ATTACHABOVE_PATCH
Client *at;
if (!(c->mon->sel == NULL || c->mon->sel == c->mon->clients || c->mon->sel->isfloating)) {
for (at = c->mon->clients; at->next != c->mon->sel; at = at->next);
c->next = at->next;
at->next = c;
return;
}
#elif ATTACHASIDE_PATCH
Client *at;
unsigned int n;
for (at = c->mon->clients, n = 0; at; at = at->next)
if (!at->isfloating && ISVISIBLEONTAG(at, c->tags))
if (++n >= c->mon->nmaster)
break;
if (at && c->mon->nmaster) {
c->next = at->next;
at->next = c;
return;
}
#elif ATTACHBELOW_PATCH
if (!(c->mon->sel == NULL || c->mon->sel == c || c->mon->sel->isfloating)) {
c->next = c->mon->sel->next;
c->mon->sel->next = c;
return;
}
#elif ATTACHBOTTOM_PATCH
Client *at;
for (at = c->mon->clients; at && at->next; at = at->next);
if (at) {
at->next = c;
c->next = NULL;
return;
}
#endif
attach(c); // master (default)
}

+ 0
- 1
suckless/dwm/patch/attachx.h View File

@ -1 +0,0 @@
static void attachx(Client *c);

+ 1
- 1
suckless/dwm/patch/autostart.c View File

@ -80,4 +80,4 @@ runautostart(void)
free(pathpfx);
free(path);
}
}
}

+ 1
- 1
suckless/dwm/patch/autostart.h View File

@ -1 +1 @@
static void runautostart(void);
static void runautostart(void);

+ 0
- 42
suckless/dwm/patch/bar_alpha.c View File

@ -1,42 +0,0 @@
static int useargb = 0;
static Visual *visual;
static int depth;
static Colormap cmap;
void
xinitvisual()
{
XVisualInfo *infos;
XRenderPictFormat *fmt;
int nitems;
int i;
XVisualInfo tpl = {
.screen = screen,
.depth = 32,
.class = TrueColor
};
long masks = VisualScreenMask | VisualDepthMask | VisualClassMask;
infos = XGetVisualInfo(dpy, masks, &tpl, &nitems);
visual = NULL;
for (i = 0; i < nitems; i ++) {
fmt = XRenderFindVisualFormat(dpy, infos[i].visual);
if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) {
visual = infos[i].visual;
depth = infos[i].depth;
cmap = XCreateColormap(dpy, root, visual, AllocNone);
useargb = 1;
break;
}
}
XFree(infos);
if (!visual) {
visual = DefaultVisual(dpy, screen);
depth = DefaultDepth(dpy, screen);
cmap = DefaultColormap(dpy, screen);
}
}

+ 0
- 3
suckless/dwm/patch/bar_alpha.h View File

@ -1,3 +0,0 @@
#define OPAQUE 0xffU
static void xinitvisual();

+ 0
- 6
suckless/dwm/patch/bar_alternativetags.c View File

@ -1,6 +0,0 @@
void
togglealttag()
{
selmon->alttag = !selmon->alttag;
drawbar(selmon);
}

+ 0
- 1
suckless/dwm/patch/bar_alternativetags.h View File

@ -1 +0,0 @@
static void togglealttag();

+ 0
- 82
suckless/dwm/patch/bar_anybar.c View File

@ -1,82 +0,0 @@
void
managealtbar(Window win, XWindowAttributes *wa)
{
Monitor *m;
Bar *bar;
int i;
if (!(m = recttomon(wa->x, wa->y, wa->width, wa->height)))
return;
for (i = 0, bar = m->bar; bar && bar->win && bar->next; bar = bar->next, ++i); // find last bar
if (!bar) {
bar = m->bar = ecalloc(1, sizeof(Bar));
bar->topbar = topbar;
} else if (bar && bar->win) {
bar->next = ecalloc(1, sizeof(Bar));
bar->next->topbar = !bar->topbar;
bar = bar->next;
}
bar->external = 1;
bar->showbar = 1;
bar->mon = m;
bar->idx = i;
bar->borderpx = 0;
bar->win = win;
bar->bh = wa->height;
updatebarpos(m);
arrange(m);
XSelectInput(dpy, win, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
XMapWindow(dpy, win);
XMoveResizeWindow(dpy, bar->win, bar->bx, -bar->by, wa->width, bar->bh);
arrange(selmon);
XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
(unsigned char *) &win, 1);
}
void
spawnbar()
{
if (*altbarcmd)
system(altbarcmd);
}
void
unmanagealtbar(Window w)
{
Monitor *m = wintomon(w);
Bar *bar;
if (!m)
return;
for (bar = m->bar; bar && bar->win; bar = bar->next)
if (bar->win == w) {
bar->win = 0;
bar->by = 0;
bar->bh = 0;
break;
}
updatebarpos(m);
arrange(m);
}
int
wmclasscontains(Window win, const char *class, const char *name)
{
XClassHint ch = { NULL, NULL };
int res = 1;
if (XGetClassHint(dpy, win, &ch)) {
if (ch.res_name && strstr(ch.res_name, name) == NULL)
res = 0;
if (ch.res_class && strstr(ch.res_class, class) == NULL)
res = 0;
} else
res = 0;
if (ch.res_class)
XFree(ch.res_class);
if (ch.res_name)
XFree(ch.res_name);
return res;
}

+ 0
- 4
suckless/dwm/patch/bar_anybar.h View File

@ -1,4 +0,0 @@
static void managealtbar(Window win, XWindowAttributes *wa);
static void spawnbar();
static void unmanagealtbar(Window w);
static int wmclasscontains(Window win, const char *class, const char *name);

+ 0
- 79
suckless/dwm/patch/bar_awesomebar.c View File

@ -1,79 +0,0 @@
int
width_awesomebar(Bar *bar, BarArg *a)
{
return a->w;
}
int
draw_awesomebar(Bar *bar, BarArg *a)
{
int n = 0, scm, remainder = 0, tabw, pad;
unsigned int i;
#if BAR_TITLE_LEFT_PAD_PATCH && BAR_TITLE_RIGHT_PAD_PATCH
int x = a->x + lrpad / 2, w = a->w - lrpad;
#elif BAR_TITLE_LEFT_PAD_PATCH
int x = a->x + lrpad / 2, w = a->w - lrpad / 2;
#elif BAR_TITLE_RIGHT_PAD_PATCH
int x = a->x, w = a->w - lrpad / 2;
#else
int x = a->x, w = a->w;
#endif // BAR_TITLE_LEFT_PAD_PATCH | BAR_TITLE_RIGHT_PAD_PATCH
Client *c;
for (c = bar->mon->clients; c; c = c->next)
if (ISVISIBLE(c))
n++;
if (n > 0) {
remainder = w % n;
tabw = w / n;
for (i = 0, c = bar->mon->clients; c; c = c->next, i++) {
if (!ISVISIBLE(c))
continue;
if (bar->mon->sel == c)
scm = SchemeTitleSel;
else if (HIDDEN(c))
scm = SchemeHid;
else
scm = SchemeTitleNorm;
pad = lrpad / 2;
#if BAR_CENTEREDWINDOWNAME_PATCH
if (TEXTW(c->name) < tabw)
pad = (tabw - TEXTW(c->name) + lrpad) / 2;
#endif // BAR_CENTEREDWINDOWNAME_PATCH
drw_setscheme(drw, scheme[scm]);
drw_text(drw, x, a->y, tabw + (i < remainder ? 1 : 0), a->h, pad, c->name, 0, False);
drawstateindicator(c->mon, c, 1, x, a->y, tabw + (i < remainder ? 1 : 0), a->h, 0, 0, c->isfixed);
x += tabw + (i < remainder ? 1 : 0);
}
}
return n;
}
int
click_awesomebar(Bar *bar, Arg *arg, BarArg *a)
{
int x = 0, n = 0;
Client *c;
for (c = bar->mon->clients; c; c = c->next)
if (ISVISIBLE(c))
n++;
c = bar->mon->clients;
do {
if (!c || !ISVISIBLE(c))
continue;
else
x += (1.0 / (double)n) * a->w;
} while (c && a->x > x && (c = c->next));
if (c) {
arg->v = c;
return ClkWinTitle;
}
return -1;
}

+ 0
- 3
suckless/dwm/patch/bar_awesomebar.h View File

@ -1,3 +0,0 @@
static int width_awesomebar(Bar *bar, BarArg *a);
static int draw_awesomebar(Bar *bar, BarArg *a);
static int click_awesomebar(Bar *bar, Arg *arg, BarArg *a);

+ 1
- 1
suckless/dwm/patch/bar_dwmblocks.c View File

@ -28,4 +28,4 @@ sigdwmblocks(const Arg *arg)
sigqueue(dwmblockspid, SIGUSR1, sv);
}
}
}
}

+ 1
- 1
suckless/dwm/patch/bar_dwmblocks.h View File

@ -1,2 +1,2 @@
static int getdwmblockspid();
static void sigdwmblocks(const Arg *arg);
static void sigdwmblocks(const Arg *arg);

+ 0
- 52
suckless/dwm/patch/bar_ewmhtags.c View File

@ -1,52 +0,0 @@
void
setcurrentdesktop(void)
{
long data[] = { 0 };
XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1);
}
void
setdesktopnames(void)
{
int i;
XTextProperty text;
char *tags[NUMTAGS];
for (i = 0; i < NUMTAGS; i++)
tags[i] = tagicon(selmon, i);
Xutf8TextListToTextProperty(dpy, tags, NUMTAGS, XUTF8StringStyle, &text);
XSetTextProperty(dpy, root, &text, netatom[NetDesktopNames]);
}
void
setfloatinghint(Client *c)
{
Atom target = XInternAtom(dpy, "_IS_FLOATING", 0);
unsigned int floating[1] = {c->isfloating};
XChangeProperty(dpy, c->win, target, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)floating, 1);
}
void
setnumdesktops(void)
{
long data[] = { NUMTAGS };
XChangeProperty(dpy, root, netatom[NetNumberOfDesktops], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1);
}
void
setviewport(void)
{
long data[] = { 0, 0 };
XChangeProperty(dpy, root, netatom[NetDesktopViewport], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 2);
}
void
updatecurrentdesktop(void)
{
long rawdata[] = { selmon->tagset[selmon->seltags] };
int i = 0;
while (*rawdata >> (i + 1)) {
i++;
}
long data[] = { i };
XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1);
}

+ 0
- 6
suckless/dwm/patch/bar_ewmhtags.h View File

@ -1,6 +0,0 @@
static void setcurrentdesktop(void);
static void setdesktopnames(void);
static void setfloatinghint(Client *c);
static void setnumdesktops(void);
static void setviewport(void);
static void updatecurrentdesktop(void);

+ 0
- 70
suckless/dwm/patch/bar_fancybar.c View File

@ -1,70 +0,0 @@
int
width_fancybar(Bar *bar, BarArg *a)
{
return a->w;
}
int
draw_fancybar(Bar *bar, BarArg *a)
{
int ftw, mw, ew = 0, n = 0;
unsigned int i;
Client *c;
Monitor *m = bar->mon;
#if BAR_TITLE_LEFT_PAD_PATCH && BAR_TITLE_RIGHT_PAD_PATCH
int x = a->x + lrpad / 2, w = a->w - lrpad;
#elif BAR_TITLE_LEFT_PAD_PATCH
int x = a->x + lrpad / 2, w = a->w - lrpad / 2;
#elif BAR_TITLE_RIGHT_PAD_PATCH
int x = a->x, w = a->w - lrpad / 2;
#else
int x = a->x, w = a->w;
#endif // BAR_TITLE_LEFT_PAD_PATCH | BAR_TITLE_RIGHT_PAD_PATCH
for (c = m->clients; c; c = c->next) {
if (ISVISIBLE(c))
n++;
}
if (n > 0) {
ftw = TEXTW(m->sel->name);
mw = (ftw >= w || n == 1) ? 0 : (w - ftw) / (n - 1);
i = 0;
for (c = m->clients; c; c = c->next) {
if (!ISVISIBLE(c) || c == m->sel)
continue;
ftw = TEXTW(c->name);
if (ftw < mw)
ew += (mw - ftw);
else
i++;
}
if (i > 0)
mw += ew / i;
for (c = m->clients; c; c = c->next) {
if (!ISVISIBLE(c))
continue;
ftw = MIN(m->sel == c ? w : mw, TEXTW(c->name));
drw_setscheme(drw, scheme[m->sel == c ? SchemeTitleSel : SchemeTitleNorm]);
if (ftw > 0) /* trap special handling of 0 in drw_text */
drw_text(drw, x, a->y, ftw, a->h, lrpad / 2, c->name, 0, False);
drawstateindicator(c->mon, c, 1, x, a->y, ftw, a->h, 0, 0, c->isfixed);
x += ftw;
w -= ftw;
}
}
return n;
}
int
click_fancybar(Bar *bar, Arg *arg, BarArg *a)
{
return ClkWinTitle;
}

+ 0
- 3
suckless/dwm/patch/bar_fancybar.h View File

@ -1,3 +0,0 @@
static int width_fancybar(Bar *bar, BarArg *a);
static int draw_fancybar(Bar *bar, BarArg *a);
static int click_fancybar(Bar *bar, Arg *arg, BarArg *a);

+ 0
- 436
suckless/dwm/patch/bar_flexwintitle.c View File

@ -1,436 +0,0 @@
/* Flexwintitle properties, you can override these in your config.h if you want. */
#ifndef FLEXWINTITLE_BORDERS
#define FLEXWINTITLE_BORDERS 1 // 0 = off, 1 = on
#endif
#ifndef FLEXWINTITLE_SHOWFLOATING
#define FLEXWINTITLE_SHOWFLOATING 0 // whether to show titles for floating windows, hidden clients are always shown
#endif
#ifndef FLEXWINTITLE_MASTERWEIGHT
#define FLEXWINTITLE_MASTERWEIGHT 9 // master weight compared to stack, hidden and floating window titles
#endif
#ifndef FLEXWINTITLE_STACKWEIGHT
#define FLEXWINTITLE_STACKWEIGHT 3 // stack weight compared to master, hidden and floating window titles
#endif
#ifndef FLEXWINTITLE_HIDDENWEIGHT
#define FLEXWINTITLE_HIDDENWEIGHT 1 // hidden window title weight
#endif
#ifndef FLEXWINTITLE_FLOATWEIGHT
#define FLEXWINTITLE_FLOATWEIGHT 1 // floating window title weight, set to 0 to not show floating windows
#endif
#define SCHEMEFOR(c) getschemefor(m, c, groupactive == c)
enum { GRP_NOSELECTION, GRP_MASTER, GRP_STACK1, GRP_STACK2, GRP_FLOAT, GRP_HIDDEN };
int
width_flexwintitle(Bar *bar, BarArg *a)
{
return a->w;
}
int
draw_flexwintitle(Bar *bar, BarArg *a)
{
drw_rect(drw, a->x, a->y, a->w, a->h, 1, 1);
return flextitlecalculate(bar->mon, a->x, a->w, -1, flextitledraw, NULL, a);
}
int
click_flexwintitle(Bar *bar, Arg *arg, BarArg *a)
{
flextitlecalculate(bar->mon, 0, a->w, a->x, flextitleclick, arg, a);
return ClkWinTitle;
}
Client *
flextitledrawarea(Monitor *m, Client *c, int x, int r, int w, int max_clients, int scheme, int draw_tiled, int draw_hidden, int draw_floating,
int passx, void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg), Arg *arg, BarArg *barg)
{
int i;
for (i = 0; c && i < max_clients; c = c->next) {
if (
ISVISIBLE(c) &&
(
(draw_tiled && !c->isfloating && !HIDDEN(c)) ||
(draw_floating && c->isfloating && !HIDDEN(c)) ||
(draw_hidden && HIDDEN(c))
)
) {
tabfn(m, c, passx, x, w + (i < r ? 1 : 0), scheme, arg, barg);
x += w + (i < r ? 1 : 0);
i++;
}
}
return c;
}
int
getschemefor(Monitor *m, int group, int activegroup)
{
switch (group) {
case GRP_NOSELECTION:
case GRP_MASTER:
case GRP_STACK1:
case GRP_STACK2:
#if BSTACK_LAYOUT
if (m->lt[m->sellt]->arrange == &bstack)
return (activegroup ? SchemeFlexActLTR : SchemeFlexInaLTR);
#endif // BSTACK_LAYOUT
#if BSTACKHORIZ_LAYOUT
if (m->lt[m->sellt]->arrange == &bstackhoriz) {
if (group == GRP_MASTER)
return (activegroup ? SchemeFlexActLTR : SchemeFlexInaLTR);
else
return (activegroup ? SchemeFlexActTTB : SchemeFlexInaTTB);
}
#endif // BSTACKHORIZ_LAYOUT
#if CENTEREDMASTER_LAYOUT
if (m->lt[m->sellt]->arrange == &centeredmaster)
return (activegroup ? SchemeFlexActTTB : SchemeFlexInaTTB);
#endif // CENTEREDMASTER_LAYOUT
#if CENTEREDFLOATINGMASTER_LAYOUT
if (m->lt[m->sellt]->arrange == &centeredfloatingmaster)
return (activegroup ? SchemeFlexActLTR : SchemeFlexInaLTR);
#endif // CENTEREDFLOATINGMASTER_LAYOUT
#if COLUMNS_LAYOUT
if (m->lt[m->sellt]->arrange == &col) {
if (group == GRP_MASTER)
return (activegroup ? SchemeFlexActLTR : SchemeFlexInaLTR);
else
return (activegroup ? SchemeFlexActTTB : SchemeFlexInaTTB);
}
#endif // COLUMNS_LAYOUT
#if DECK_LAYOUT
if (m->lt[m->sellt]->arrange == &deck) {
if (group == GRP_MASTER)
return (activegroup ? SchemeFlexActTTB : SchemeFlexInaTTB);
else
return (activegroup ? SchemeFlexActMONO : SchemeFlexInaMONO);
}
#endif // DECK_LAYOUT
#if FIBONACCI_DWINDLE_LAYOUT
if (m->lt[m->sellt]->arrange == &dwindle)
return (activegroup ? SchemeFlexActDWDL : SchemeFlexInaDWDL);
#endif // FIBONACCI_DWINDLE_LAYOUT
#if FIBONACCI_SPIRAL_LAYOUT
if (m->lt[m->sellt]->arrange == &spiral)
return (activegroup ? SchemeFlexActSPRL : SchemeFlexInaSPRL);
#endif // FIBONACCI_SPIRAL_LAYOUT
#if FLEXTILE_DELUXE_LAYOUT
if (m->lt[m->sellt]->arrange == &flextile)
return (activegroup ? SchemeFlexActTTB + m->ltaxis[group] : SchemeFlexInaTTB + m->ltaxis[group]);
#endif // FLEXTILE_DELUXE_LAYOUT
#if GAPPLESSGRID_LAYOUT
if (m->lt[m->sellt]->arrange == &gaplessgrid)
return (activegroup ? SchemeFlexActGRID : SchemeFlexInaGRID);
#endif // GAPPLESSGRID_LAYOUT
#if GRIDMODE_LAYOUT
if (m->lt[m->sellt]->arrange == &grid)
return (activegroup ? SchemeFlexActGRDM : SchemeFlexInaGRDM);
#endif // GRIDMODE_LAYOUT
#if HORIZGRID_LAYOUT
if (m->lt[m->sellt]->arrange == &horizgrid)
return (activegroup ? SchemeFlexActHGRD : SchemeFlexInaHGRD);
#endif // HORIZGRID_LAYOUT
#if NROWGRID_LAYOUT
if (m->lt[m->sellt]->arrange == &nrowgrid)
return (activegroup ? SchemeFlexActGRD1 : SchemeFlexInaGRD1);
#endif // NROWGRID_LAYOUT
#if TILE_LAYOUT
if (m->lt[m->sellt]->arrange == &tile)
return (activegroup ? SchemeFlexActTTB : SchemeFlexInaTTB);
#endif // TILE_LAYOUT
#if MONOCLE_LAYOUT
if (m->lt[m->sellt]->arrange == &monocle)
return (activegroup ? SchemeFlexActMONO : SchemeFlexInaMONO);
#endif // MONOCLE_LAYOUT
return SchemeTitleNorm;
case GRP_HIDDEN:
return SchemeHid;
case GRP_FLOAT:
return (activegroup ? SchemeFlexActFloat : SchemeFlexInaFloat);
}
return SchemeTitleNorm;
}
int
getselschemefor(int scheme)
{
if (scheme == SchemeFlexActFloat || scheme == SchemeFlexInaFloat)
return SchemeFlexSelFloat;
if (scheme >= SchemeFlexInaTTB)
return scheme + SchemeFlexInaTTB - SchemeFlexActTTB;
if (scheme >= SchemeFlexActTTB)
return scheme + SchemeFlexSelTTB - SchemeFlexActTTB;
return SchemeTitleSel;
}
void
flextitledraw(Monitor *m, Client *c, int unused, int x, int w, int tabscheme, Arg *arg, BarArg *barg)
{
if (!c)
return;
int i, nclienttags = 0, nviewtags = 0, pad = lrpad / 2;
int clientscheme = (
c == selmon->sel
? getselschemefor(tabscheme)
: HIDDEN(c)
? SchemeHid
: c->isurgent
? SchemeUrg
: tabscheme
);
drw_setscheme(drw, scheme[clientscheme]);
XSetWindowBorder(dpy, c->win, scheme[clientscheme][ColBorder].pixel);
if (w <= TEXTW("A") - lrpad + pad) // reduce text padding if wintitle is too small
pad = (w - TEXTW("A") + lrpad < 0 ? 0 : (w - TEXTW("A") + lrpad) / 2);
#if BAR_CENTEREDWINDOWNAME_PATCH
else if (TEXTW(c->name) < w)
pad = (w - TEXTW(c->name) + lrpad) / 2;
#endif // BAR_CENTEREDWINDOWNAME_PATCH
drw_text(drw, x, barg->y, w, barg->h, pad, c->name, 0, False);
drawstateindicator(m, c, 1, x + 2, barg->y, w, barg->h, 0, 0, 0);
if (FLEXWINTITLE_BORDERS) {
XSetForeground(drw->dpy, drw->gc, scheme[SchemeSel][ColBorder].pixel);
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, barg->y, 1, barg->h);
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x + w - (x + w >= barg->w ? 1 : 0), barg->y, 1, barg->h);
}
/* Optional tags icons */
for (i = 0; i < NUMTAGS; i++) {
if ((m->tagset[m->seltags] >> i) & 1)
nviewtags++;
if ((c->tags >> i) & 1)
nclienttags++;
}
if (TAGSINDICATOR == 2 || nclienttags > 1 || nviewtags > 1)
drawindicator(m, c, 1, x, barg->y, w, barg->h, 0, 0, 0, INDICATOR_RIGHT_TAGS);
}
#ifndef HIDDEN
#define HIDDEN(C) 0
#endif
void
flextitleclick(Monitor *m, Client *c, int passx, int x, int w, int unused, Arg *arg, BarArg *barg)
{
if (passx >= x && passx <= x + w)
arg->v = c;
}
int
flextitlecalculate(
Monitor *m, int offx, int tabw, int passx,
void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg),
Arg *arg, BarArg *barg
) {
Client *c;
int n, center = 0, mirror = 0, fixed = 0; // layout configuration
int clientsnmaster = 0, clientsnstack = 0, clientsnfloating = 0, clientsnhidden = 0;
int i, w, r, num = 0, den, fulllayout = 0;
int clientsnstack2 = 0;
int groupactive = 0;
int selidx = 0;
int dualstack = 0;
int rw, rr;
int mas_x = offx, st1_x = offx, st2_x = offx, hid_x = offx, flt_x = offx;
int mas_w, st1_w, st2_w, hid_w;
for (i = 0, c = m->clients; c; c = c->next) {
if (!ISVISIBLE(c))
continue;
if (HIDDEN(c)) {
if (FLEXWINTITLE_HIDDENWEIGHT)
clientsnhidden++;
continue;
}
if (c->isfloating) {
if (FLEXWINTITLE_FLOATWEIGHT)
clientsnfloating++;
continue;
}
if (m->sel == c)
selidx = i;
if (i < m->nmaster)
clientsnmaster++;
#if FLEXTILE_DELUXE_LAYOUT
else if (m->nstack) {
if (clientsnstack < m->nstack)
clientsnstack++;
else
clientsnstack2++;
}
#endif // FLEXTILE_DELUXE_LAYOUT
else if ((i - m->nmaster) % 2)
clientsnstack2++;
else
clientsnstack++;
i++;
}
if (!m->sel)
groupactive = GRP_NOSELECTION;
else if (HIDDEN(m->sel))
groupactive = GRP_HIDDEN;
else if (m->sel->isfloating)
groupactive = GRP_FLOAT;
else if (selidx < clientsnmaster)
groupactive = GRP_MASTER;
else if (selidx < clientsnmaster + clientsnstack)
groupactive = GRP_STACK1;
else if (selidx < clientsnmaster + clientsnstack + clientsnstack2)
groupactive = GRP_STACK2;
n = clientsnmaster + clientsnstack + clientsnstack2 + clientsnfloating + clientsnhidden;
if (n == 0)
return 0;
#if FLEXTILE_DELUXE_LAYOUT
else if (m->lt[m->sellt]->arrange == &flextile) {
int layout = m->ltaxis[LAYOUT];
if (layout < 0) {
mirror = 1;
layout *= -1;
}
if (layout > FLOATING_MASTER) {
layout -= FLOATING_MASTER;
fixed = 1;
}
if (layout == SPLIT_HORIZONTAL_DUAL_STACK || layout == SPLIT_HORIZONTAL_DUAL_STACK_FIXED)
dualstack = 1;
else if (layout == SPLIT_CENTERED_VERTICAL && (fixed || n - m->nmaster > 1))
center = 1;
else if (layout == FLOATING_MASTER)
center = 1;
else if (layout == SPLIT_CENTERED_HORIZONTAL) {
if (fixed || n - m->nmaster > 1)
center = 1;
}
}
#endif // FLEXTILE_DELUXE_LAYOUT
#if CENTEREDMASTER_LAYOUT
else if (m->lt[m->sellt]->arrange == &centeredmaster && (fixed || n - m->nmaster > 1))
center = 1;
#endif // CENTEREDMASTER_LAYOUT
#if CENTEREDFLOATINGMASTER_LAYOUT
else if (m->lt[m->sellt]->arrange == &centeredfloatingmaster)
center = 1;
#endif // CENTEREDFLOATINGMASTER_LAYOUT
/* Certain layouts have no master / stack areas */
if (!m->lt[m->sellt]->arrange // floating layout
|| (!n || (!fixed && m->nmaster && n <= m->nmaster)) // no master
#if MONOCLE_LAYOUT
|| m->lt[m->sellt]->arrange == &monocle
#endif // MONOCLE_LAYOUT
#if GRIDMODE_LAYOUT
|| m->lt[m->sellt]->arrange == &grid
#endif // GRIDMODE_LAYOUT
#if HORIZGRID_LAYOUT
|| m->lt[m->sellt]->arrange == &horizgrid
#endif // HORIZGRID_LAYOUT
#if GAPPLESSGRID_LAYOUT
|| m->lt[m->sellt]->arrange == &gaplessgrid
#endif // GAPPLESSGRID_LAYOUT
#if NROWGRID_LAYOUT
|| m->lt[m->sellt]->arrange == &nrowgrid
#endif // NROWGRID_LAYOUT
#if FLEXTILE_DELUXE_LAYOUT
|| (m->lt[m->sellt]->arrange == &flextile && m->ltaxis[LAYOUT] == NO_SPLIT)
#endif // FLEXTILE_DELUXE_LAYOUT
)
fulllayout = 1;
num = tabw;
c = m->clients;
/* floating mode */
if ((fulllayout && FLEXWINTITLE_FLOATWEIGHT > 0) || clientsnmaster + clientsnstack == 0 || !m->lt[m->sellt]->arrange) {
den = clientsnmaster + clientsnstack + clientsnstack2 + clientsnfloating + clientsnhidden;
w = num / den;
r = num % den; // rest
c = flextitledrawarea(m, c, mas_x, r, w, den, !m->lt[m->sellt]->arrange ? SchemeFlexActFloat : SCHEMEFOR(GRP_MASTER), 1, FLEXWINTITLE_HIDDENWEIGHT, FLEXWINTITLE_FLOATWEIGHT, passx, tabfn, arg, barg); // floating
/* no master and stack mode, e.g. monocole, grid layouts, fibonacci */
} else if (fulllayout) {
den = clientsnmaster + clientsnstack + clientsnstack2 + clientsnhidden;
w = num / den;
r = num % den; // rest
c = flextitledrawarea(m, c, mas_x, r, w, den, SCHEMEFOR(GRP_MASTER), 1, FLEXWINTITLE_HIDDENWEIGHT, 0, passx, tabfn, arg, barg); // full
/* tiled mode */
} else {
den = clientsnmaster * FLEXWINTITLE_MASTERWEIGHT + (clientsnstack + clientsnstack2) * FLEXWINTITLE_STACKWEIGHT + clientsnfloating * FLEXWINTITLE_FLOATWEIGHT + clientsnhidden * FLEXWINTITLE_HIDDENWEIGHT;
w = num / den; // weight width per client
r = num % den; // weight rest width
rw = r / n; // rest incr per client
rr = r % n; // rest rest
#if FLEXTILE_DELUXE_LAYOUT
if ((!center && !dualstack) || (center && n <= m->nmaster + (m->nstack ? m->nstack : 1)))
#else
if ((!center && !dualstack) || (center && n <= m->nmaster + 1))
#endif // FLEXTILE_DELUXE_LAYOUT
{
clientsnstack += clientsnstack2;
clientsnstack2 = 0;
if (groupactive == GRP_STACK2)
groupactive = GRP_STACK1;
}
mas_w = clientsnmaster * rw + w * clientsnmaster * FLEXWINTITLE_MASTERWEIGHT + (rr > 0 ? MIN(rr, clientsnmaster) : 0);
rr -= clientsnmaster;
st1_w = clientsnstack * (rw + w * FLEXWINTITLE_STACKWEIGHT) + (rr > 0 ? MIN(rr, clientsnstack) : 0);
rr -= clientsnstack;
st2_w = clientsnstack2 * (rw + w * FLEXWINTITLE_STACKWEIGHT) + (rr > 0 ? MIN(rr, clientsnstack2) : 0);
rr -= clientsnstack2;
hid_w = clientsnhidden * (rw + w * FLEXWINTITLE_HIDDENWEIGHT) + (rr > 0 ? MIN(rr, clientsnhidden) : 0);
rr -= clientsnhidden;
rr = r % n;
if (mirror) {
if (center && clientsnstack2) {
mas_x = st1_x + st1_w;
st2_x = mas_x + mas_w;
hid_x = st2_x + st2_w;
} else {
if (clientsnstack2) {
st2_x = st1_x + st1_w;
mas_x = st2_x + st2_w;
} else
mas_x = st1_x + st1_w;
hid_x = mas_x + mas_w;
}
} else {
if (center && clientsnstack2) {
mas_x = st2_x + st2_w;
st1_x = mas_x + mas_w;
hid_x = st1_x + st1_w;
} else {
st1_x = mas_x + mas_w;
if (clientsnstack2) {
st2_x = st1_x + st1_w;
hid_x = st2_x + st2_w;
} else
hid_x = st1_x + st1_w;
}
}
flt_x = hid_x + hid_w;
c = flextitledrawarea(m, c, mas_x, rr, w * FLEXWINTITLE_MASTERWEIGHT + rw, clientsnmaster, SCHEMEFOR(GRP_MASTER), 1, 0, 0, passx, tabfn, arg, barg); // master
rr -= clientsnmaster;
c = flextitledrawarea(m, c, st1_x, rr, w * FLEXWINTITLE_STACKWEIGHT + rw, clientsnstack, SCHEMEFOR(GRP_STACK1), 1, 0, 0, passx, tabfn, arg, barg); // stack1
rr -= clientsnstack;
if (clientsnstack2) {
c = flextitledrawarea(m, c, st2_x, rr, w * FLEXWINTITLE_STACKWEIGHT + rw, clientsnstack2, SCHEMEFOR(GRP_STACK2), 1, 0, 0, passx, tabfn, arg, barg); // stack2
rr -= clientsnstack2;
}
c = flextitledrawarea(m, m->clients, hid_x, rr, w * FLEXWINTITLE_HIDDENWEIGHT + rw, clientsnhidden, SCHEMEFOR(GRP_HIDDEN), 0, 1, 0, passx, tabfn, arg, barg); // hidden
rr -= clientsnhidden;
c = flextitledrawarea(m, m->clients, flt_x, rr, w * FLEXWINTITLE_FLOATWEIGHT + rw, clientsnfloating, SCHEMEFOR(GRP_FLOAT), 0, 0, 1, passx, tabfn, arg, barg); // floating
}
return 1;
}

+ 0
- 10
suckless/dwm/patch/bar_flexwintitle.h View File

@ -1,10 +0,0 @@
static int width_flexwintitle(Bar *bar, BarArg *a);
static int draw_flexwintitle(Bar *bar, BarArg *a);
static int click_flexwintitle(Bar *bar, Arg *arg, BarArg *a);
static void flextitledraw(Monitor *m, Client *c, int unused, int x, int w, int groupactive, Arg *arg, BarArg *barg);
static void flextitleclick(Monitor *m, Client *c, int passx, int x, int w, int unused, Arg *arg, BarArg *barg);
static int flextitlecalculate(Monitor *m, int offx, int w, int passx, void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg), Arg *arg, BarArg *barg);
static int getschemefor(Monitor *m, int group, int activegroup);
static int getselschemefor(int scheme);
static Client *flextitledrawarea(Monitor *m, Client *c, int x, int r, int w, int max_clients, int tabscheme, int draw_tiled, int draw_hidden, int draw_floating, int passx, void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg), Arg *arg, BarArg *barg);

+ 0
- 37
suckless/dwm/patch/bar_holdbar.c View File

@ -1,37 +0,0 @@
void
holdbar(const Arg *arg)
{
if (selmon->showbar)
return;
Bar *bar;
selmon->showbar = 2;
updatebarpos(selmon);
for (bar = selmon->bar; bar; bar = bar->next)
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
}
void
keyrelease(XEvent *e)
{
Bar *bar;
if (XEventsQueued(dpy, QueuedAfterReading)) {
XEvent ne;
XPeekEvent(dpy, &ne);
if (ne.type == KeyPress && ne.xkey.time == e->xkey.time &&
ne.xkey.keycode == e->xkey.keycode) {
XNextEvent(dpy, &ne);
return;
}
}
if (e->xkey.keycode == XKeysymToKeycode(dpy, HOLDKEY) && selmon->showbar == 2) {
selmon->showbar = 0;
updatebarpos(selmon);
for (bar = selmon->bar; bar; bar = bar->next)
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
arrange(selmon);
}
#if COMBO_PATCH
combo = 0;
#endif // COMBO_PATCH
}

+ 0
- 2
suckless/dwm/patch/bar_holdbar.h View File

@ -1,2 +0,0 @@
static void keyrelease(XEvent *e);
static void holdbar(const Arg *arg);

+ 1
- 8
suckless/dwm/patch/bar_indicators.c View File

@ -96,15 +96,8 @@ drawindicator(Monitor *m, Client *c, unsigned int occ, int x, int y, int w, int
void
drawstateindicator(Monitor *m, Client *c, unsigned int occ, int x, int y, int w, int h, unsigned int tag, int filled, int invert)
{
#if FAKEFULLSCREEN_CLIENT_PATCH
if (c->fakefullscreen && c->isfloating)
drawindicator(m, c, occ, x, y, w, h, tag, filled, invert, floatfakefsindicatortype);
else if (c->fakefullscreen)
drawindicator(m, c, occ, x, y, w, h, tag, filled, invert, fakefsindicatortype);
else
#endif // FAKEFULLSCREEN_CLIENT_PATCH
if (c->isfloating)
drawindicator(m, c, occ, x, y, w, h, tag, filled, invert, floatindicatortype);
else
drawindicator(m, c, occ, x, y, w, h, tag, filled, invert, tiledindicatortype);
}
}

+ 1
- 1
suckless/dwm/patch/bar_indicators.h View File

@ -17,4 +17,4 @@ enum {
};
static void drawindicator(Monitor *m, Client *c, unsigned int occ, int x, int y, int w, int h, unsigned int tag, int filled, int invert, int type);
static void drawstateindicator(Monitor *m, Client *c, unsigned int occ, int x, int y, int w, int h, unsigned int tag, int filled, int invert);
static void drawstateindicator(Monitor *m, Client *c, unsigned int occ, int x, int y, int w, int h, unsigned int tag, int filled, int invert);

+ 1
- 1
suckless/dwm/patch/bar_ltsymbol.c View File

@ -14,4 +14,4 @@ int
click_ltsymbol(Bar *bar, Arg *arg, BarArg *a)
{
return ClkLtSymbol;
}
}

+ 0
- 121
suckless/dwm/patch/bar_powerline_status.c View File

@ -1,121 +0,0 @@
static Clr **statusscheme;
int
width_pwrl_status(Bar *bar, BarArg *a)
{
#if BAR_STATUSCMD_PATCH
return widthpowerlinestatus(rawstext);
#else
return widthpowerlinestatus(stext);
#endif // BAR_STATUSCMD_PATCH
}
#if BAR_EXTRASTATUS_PATCH
int
width_pwrl_status_es(Bar *bar, BarArg *a)
{
#if BAR_STATUSCMD_PATCH
return widthpowerlinestatus(rawestext);
#else
return widthpowerlinestatus(estext);
#endif // BAR_STATUSCMD_PATCH
}
#endif // BAR_EXTRASTATUS_PATCH
int
draw_pwrl_status(Bar *bar, BarArg *a)
{
#if BAR_STATUSCMD_PATCH
return drawpowerlinestatus(a->x + a->w, rawstext, a);
#else
return drawpowerlinestatus(a->x + a->w, stext, a);
#endif // BAR_STATUSCMD_PATCH
}
#if BAR_EXTRASTATUS_PATCH
int
draw_pwrl_status_es(Bar *bar, BarArg *a)
{
#if BAR_STATUSCMD_PATCH
return drawpowerlinestatus(a->x + a->w, rawestext, a);
#else
return drawpowerlinestatus(a->x + a->w, estext, a);
#endif // BAR_STATUSCMD_PATCH
}
#endif // BAR_EXTRASTATUS_PATCH
int
click_pwrl_status(Bar *bar, Arg *arg, BarArg *a)
{
return ClkStatusText;
}
int
widthpowerlinestatus(char *stext)
{
char status[512];
int w = 0, i, n = strlen(stext);
int plw = drw->fonts->h / 2 + 1;
char *bs, bp = '|';
strcpy(status, stext);
for (i = n, bs = &status[n-1]; i >= 0; i--, bs--) {
if (*bs == '<' || *bs == '/' || *bs == '\\' || *bs == '>' || *bs == '|') { /* block start */
if (bp != '|')
w += plw;
w += TEXTW(bs+2);
bp = *bs;
*bs = 0;
}
}
if (bp != '|')
w += plw * 2;
return w;
}
int
drawpowerlinestatus(int xpos, char *stext, BarArg *barg)
{
char status[512];
int i, n = strlen(stext), cn = 0;
int x = xpos, w = 0;
int plw = drw->fonts->h / 2 + 1;
char *bs, bp = '|';
Clr *prevscheme = statusscheme[0], *nxtscheme;
strcpy(status, stext);
for (i = n, bs = &status[n-1]; i >= 0; i--, bs--) {
if (*bs == '<' || *bs == '/' || *bs == '\\' || *bs == '>' || *bs == '|') { /* block start */
cn = ((int) *(bs+1)) - 1;
if (cn < LENGTH(statuscolors)) {
drw_settrans(drw, prevscheme, (nxtscheme = statusscheme[cn]));
} else {
drw_settrans(drw, prevscheme, (nxtscheme = statusscheme[0]));
}
if (bp != '|') {
drw_arrow(drw, x - plw, barg->y, plw, barg->h, bp == '\\' || bp == '>' ? 1 : 0, bp == '<' ? 0 : 1);
x -= plw;
}
drw_setscheme(drw, nxtscheme);
w = TEXTW(bs+2);
drw_text(drw, x - w, barg->y, w, barg->h, lrpad / 2, bs+2, 0, False);
x -= w;
bp = *bs;
*bs = 0;
prevscheme = nxtscheme;
}
}
if (bp != '|') {
drw_settrans(drw, prevscheme, scheme[SchemeNorm]);
drw_arrow(drw, x - plw, barg->y, plw, barg->h, bp == '\\' || bp == '>' ? 1 : 0, bp == '<' ? 0 : 1);
drw_rect(drw, x - 2 * plw, barg->y, plw, barg->h, 1, 1);
x -= plw * 2;
}
return xpos - x;
}

+ 0
- 11
suckless/dwm/patch/bar_powerline_status.h View File

@ -1,11 +0,0 @@
static int width_pwrl_status(Bar *bar, BarArg *a);
#if BAR_EXTRASTATUS_PATCH
static int width_pwrl_status_es(Bar *bar, BarArg *a);
#endif // BAR_EXTRASTATUS_PATCH
static int draw_pwrl_status(Bar *bar, BarArg *a);
#if BAR_EXTRASTATUS_PATCH
static int draw_pwrl_status_es(Bar *bar, BarArg *a);
#endif // BAR_EXTRASTATUS_PATCH
static int click_pwrl_status(Bar *bar, Arg *arg, BarArg *a);
static int drawpowerlinestatus(int x, char *stext, BarArg *a);
static int widthpowerlinestatus(char *stext);

+ 0
- 106
suckless/dwm/patch/bar_powerline_tags.c View File

@ -1,106 +0,0 @@
int
width_pwrl_tags(Bar *bar, BarArg *a)
{
int w, i;
int plw = drw->fonts->h / 2 + 1;
#if BAR_HIDEVACANTTAGS_PATCH
Client *c;
unsigned int occ = 0;
for (c = bar->mon->clients; c; c = c->next)
occ |= c->tags == 255 ? 0 : c->tags;
#endif // BAR_HIDEVACANTTAGS_PATCH
for (w = 0, i = 0; i < NUMTAGS; i++) {
#if BAR_HIDEVACANTTAGS_PATCH
if (!(occ & 1 << i || bar->mon->tagset[bar->mon->seltags] & 1 << i))
continue;
#endif // BAR_HIDEVACANTTAGS_PATCH
w += TEXTW(tagicon(bar->mon, i)) + plw;
}
return w + lrpad;
}
int
draw_pwrl_tags(Bar *bar, BarArg *a)
{
int x, w;
int invert;
int plw = drw->fonts->h / 2 + 1;
unsigned int i, occ = 0, urg = 0;
char *icon;
Client *c;
Clr *prevscheme, *nxtscheme;
for (c = bar->mon->clients; c; c = c->next) {
#if BAR_HIDEVACANTTAGS_PATCH
occ |= c->tags == 255 ? 0 : c->tags;
#else
occ |= c->tags;
#endif // BAR_HIDEVACANTTAGS_PATCH
if (c->isurgent)
urg |= c->tags;
}
x = a->x;
prevscheme = scheme[SchemeNorm];
for (i = 0; i < NUMTAGS; i++) {
#if BAR_HIDEVACANTTAGS_PATCH
/* do not draw vacant tags */
if (!(occ & 1 << i || bar->mon->tagset[bar->mon->seltags] & 1 << i))
continue;
#endif // BAR_HIDEVACANTTAGS_PATCH
icon = tagicon(bar->mon, i);
invert = 0;
w = TEXTW(icon);
if (urg & 1 << i ) {
drw_settrans(drw, prevscheme, (nxtscheme = scheme[bar->mon->tagset[bar->mon->seltags] & 1 << i ? SchemeSel : SchemeUrg]));
} else {
drw_settrans(drw, prevscheme, (nxtscheme = scheme[bar->mon->tagset[bar->mon->seltags] & 1 << i ? SchemeSel : SchemeNorm]));
}
#if BAR_POWERLINE_TAGS_SLASH_PATCH
drw_arrow(drw, x, a->y, plw, a->h, 1, 1);
#else
drw_arrow(drw, x, a->y, plw, a->h, 1, 0);
#endif // BAR_POWERLINE_TAGS_SLASH_PATCH
x += plw;
drw_setscheme(drw, nxtscheme);
drw_text(drw, x, a->y, w, a->h, lrpad / 2, icon, invert, False);
drawindicator(bar->mon, NULL, occ, x, a->y, w, a->h, i, -1, invert, tagindicatortype);
x += w;
prevscheme = nxtscheme;
}
nxtscheme = scheme[SchemeNorm];
drw_settrans(drw, prevscheme, nxtscheme);
#if BAR_POWERLINE_TAGS_SLASH_PATCH
drw_arrow(drw, x, a->y, plw, a->h, 1, 1);
#else
drw_arrow(drw, x, a->y, plw, a->h, 1, 0);
#endif // BAR_POWERLINE_TAGS_SLASH_PATCH
return 1;
}
int
click_pwrl_tags(Bar *bar, Arg *arg, BarArg *a)
{
int i = 0, x = lrpad / 2;
int plw = drw->fonts->h / 2 + 1;
#if BAR_HIDEVACANTTAGS_PATCH
Client *c;
unsigned int occ = 0;
for (c = bar->mon->clients; c; c = c->next)
occ |= c->tags == 255 ? 0 : c->tags;
#endif // BAR_HIDEVACANTTAGS_PATCH
do {
#if BAR_HIDEVACANTTAGS_PATCH
if (!(occ & 1 << i || bar->mon->tagset[bar->mon->seltags] & 1 << i))
continue;
#endif // BAR_HIDEVACANTTAGS_PATCH
x += TEXTW(tagicon(bar->mon, i)) + plw;
} while (a->x >= x && ++i < NUMTAGS);
if (i < NUMTAGS) {
arg->ui = 1 << i;
}
return ClkTagBar;
}

+ 0
- 3
suckless/dwm/patch/bar_powerline_tags.h View File

@ -1,3 +0,0 @@
static int width_pwrl_tags(Bar *bar, BarArg *a);
static int draw_pwrl_tags(Bar *bar, BarArg *a);
static int click_pwrl_tags(Bar *bar, Arg *arg, BarArg *a);

+ 0
- 14
suckless/dwm/patch/bar_status.c View File

@ -4,13 +4,6 @@ width_status(Bar *bar, BarArg *a)
return TEXTWM(stext);
}
#if BAR_EXTRASTATUS_PATCH
int
width_status_es(Bar *bar, BarArg *a)
{
return TEXTWM(estext) - lrpad;
}
#endif // BAR_EXTRASTATUS_PATCH
int
draw_status(Bar *bar, BarArg *a)
@ -18,13 +11,6 @@ draw_status(Bar *bar, BarArg *a)
return drw_text(drw, a->x, a->y, a->w, a->h, lrpad / 2, stext, 0, True);
}
#if BAR_EXTRASTATUS_PATCH
int
draw_status_es(Bar *bar, BarArg *a)
{
return drw_text(drw, a->x, a->y, a->w, a->h, 0, estext, 0, True);
}
#endif // BAR_EXTRASTATUS_PATCH
int
click_status(Bar *bar, Arg *arg, BarArg *a)


+ 1
- 7
suckless/dwm/patch/bar_status.h View File

@ -1,9 +1,3 @@
static int width_status(Bar *bar, BarArg *a);
#if BAR_EXTRASTATUS_PATCH
static int width_status_es(Bar *bar, BarArg *a);
#endif // BAR_EXTRASTATUS_PATCH
static int draw_status(Bar *bar, BarArg *a);
#if BAR_EXTRASTATUS_PATCH
static int draw_status_es(Bar *bar, BarArg *a);
#endif // BAR_EXTRASTATUS_PATCH
static int click_status(Bar *bar, Arg *arg, BarArg *a);
static int click_status(Bar *bar, Arg *arg, BarArg *a);

+ 1
- 102
suckless/dwm/patch/bar_status2d.c View File

@ -1,81 +1,20 @@
#if BAR_STATUS2D_XRDB_TERMCOLORS_PATCH
static char termcol0[] = "#000000"; /* black */
static char termcol1[] = "#ff0000"; /* red */
static char termcol2[] = "#33ff00"; /* green */
static char termcol3[] = "#ff0099"; /* yellow */
static char termcol4[] = "#0066ff"; /* blue */
static char termcol5[] = "#cc00ff"; /* magenta */
static char termcol6[] = "#00ffff"; /* cyan */
static char termcol7[] = "#d0d0d0"; /* white */
static char termcol8[] = "#808080"; /* black */
static char termcol9[] = "#ff0000"; /* red */
static char termcol10[] = "#33ff00"; /* green */
static char termcol11[] = "#ff0099"; /* yellow */
static char termcol12[] = "#0066ff"; /* blue */
static char termcol13[] = "#cc00ff"; /* magenta */
static char termcol14[] = "#00ffff"; /* cyan */
static char termcol15[] = "#ffffff"; /* white */
static char *termcolor[] = {
termcol0, termcol1, termcol2, termcol3, termcol4, termcol5, termcol6, termcol7,
termcol8, termcol9, termcol10, termcol11, termcol12, termcol13, termcol14, termcol15,
};
#endif // BAR_STATUS2D_XRDB_TERMCOLORS_PATCH
int
width_status2d(Bar *bar, BarArg *a)
{
int width;
#if BAR_EXTRASTATUS_PATCH || BAR_STATUSCMD_PATCH
width = status2dtextlength(rawstext);
#else
width = status2dtextlength(stext);
#endif // #if BAR_EXTRASTATUS_PATCH | BAR_STATUSCMD_PATCH
return width ? width + lrpad : 0;
}
#if BAR_EXTRASTATUS_PATCH
int
width_status2d_es(Bar *bar, BarArg *a)
{
int width;
#if BAR_STATUSCMD_PATCH
width = status2dtextlength(rawestext);
#else
width = status2dtextlength(estext);
#endif // BAR_STATUSCMD_PATCH
return width ? width + lrpad : 0;
}
#endif // BAR_EXTRASTATUS_PATCH
int
draw_status2d(Bar *bar, BarArg *a)
{
#if BAR_EXTRASTATUS_PATCH || BAR_STATUSCMD_PATCH
return drawstatusbar(a, rawstext);
#else
return drawstatusbar(a, stext);
#endif // #if BAR_EXTRASTATUS_PATCH | BAR_STATUSCMD_PATCH
}
#if BAR_EXTRASTATUS_PATCH
int
draw_status2d_es(Bar *bar, BarArg *a)
{
#if BAR_STATUSCMD_PATCH
return drawstatusbar(a, rawestext);
#else
return drawstatusbar(a, estext);
#endif // BAR_STATUSCMD_PATCH
}
#endif // BAR_EXTRASTATUS_PATCH
#if !BAR_STATUSCMD_PATCH
int
click_status2d(Bar *bar, Arg *arg, BarArg *a)
{
return ClkStatusText;
}
#endif // BAR_STATUSCMD_PATCH
int
drawstatusbar(BarArg *a, char* stext)
@ -91,11 +30,7 @@ drawstatusbar(BarArg *a, char* stext)
if (!(text = (char*) malloc(sizeof(char)*len)))
die("malloc");
p = text;
#if BAR_STATUSCMD_PATCH
copyvalidchars(text, stext);
#else
memcpy(text, stext, len);
#endif // BAR_STATUSCMD_PATCH
x += lrpad / 2;
drw_setscheme(drw, scheme[LENGTH(colors)]);
@ -124,13 +59,7 @@ drawstatusbar(BarArg *a, char* stext)
}
memcpy(buf, (char*)text+i+1, 7);
buf[7] = '\0';
#if BAR_ALPHA_PATCH && BAR_STATUS2D_NO_ALPHA_PATCH
drw_clr_create(drw, &drw->scheme[ColFg], buf, 0xff);
#elif BAR_ALPHA_PATCH
drw_clr_create(drw, &drw->scheme[ColFg], buf, alphas[SchemeNorm][ColFg]);
#else
drw_clr_create(drw, &drw->scheme[ColFg], buf);
#endif // BAR_ALPHA_PATCH
i += 7;
} else if (text[i] == 'b') {
char buf[8];
@ -140,34 +69,8 @@ drawstatusbar(BarArg *a, char* stext)
}
memcpy(buf, (char*)text+i+1, 7);
buf[7] = '\0';
#if BAR_ALPHA_PATCH && BAR_STATUS2D_NO_ALPHA_PATCH
drw_clr_create(drw, &drw->scheme[ColBg], buf, 0xff);
#elif BAR_ALPHA_PATCH
drw_clr_create(drw, &drw->scheme[ColBg], buf, alphas[SchemeNorm][ColBg]);
#else
drw_clr_create(drw, &drw->scheme[ColBg], buf);
#endif // BAR_ALPHA_PATCH
i += 7;
#if BAR_STATUS2D_XRDB_TERMCOLORS_PATCH
} else if (text[i] == 'C') {
int c = atoi(text + ++i) % 16;
#if BAR_ALPHA_PATCH && BAR_STATUS2D_NO_ALPHA_PATCH
drw_clr_create(drw, &drw->scheme[ColFg], termcolor[c], 0xff);
#elif BAR_ALPHA_PATCH
drw_clr_create(drw, &drw->scheme[ColFg], termcolor[c], alphas[SchemeNorm][ColBg]);
#else
drw_clr_create(drw, &drw->scheme[ColFg], termcolor[c]);
#endif // BAR_ALPHA_PATCH
} else if (text[i] == 'B') {
int c = atoi(text + ++i) % 16;
#if BAR_ALPHA_PATCH && BAR_STATUS2D_NO_ALPHA_PATCH
drw_clr_create(drw, &drw->scheme[ColBg], termcolor[c], 0xff);
#elif BAR_ALPHA_PATCH
drw_clr_create(drw, &drw->scheme[ColBg], termcolor[c], alphas[SchemeNorm][ColBg]);
#else
drw_clr_create(drw, &drw->scheme[ColBg], termcolor[c]);
#endif // BAR_ALPHA_PATCH
#endif // BAR_STATUS2D_XRDB_TERMCOLORS_PATCH
} else if (text[i] == 'd') {
drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];
@ -230,11 +133,7 @@ status2dtextlength(char* stext)
if (!(text = (char*) malloc(sizeof(char)*len)))
die("malloc");
p = text;
#if BAR_STATUSCMD_PATCH
copyvalidchars(text, stext);
#else
memcpy(text, stext, len);
#endif // BAR_STATUSCMD_PATCH
/* compute width of the status text */
w = 0;
@ -259,4 +158,4 @@ status2dtextlength(char* stext)
w += TEXTWM(text) - lrpad;
free(p);
return w;
}
}

+ 1
- 10
suckless/dwm/patch/bar_status2d.h View File

@ -1,13 +1,4 @@
static int width_status2d(Bar *bar, BarArg *a);
#if BAR_EXTRASTATUS_PATCH
static int width_status2d_es(Bar *bar, BarArg *a);
#endif // BAR_EXTRASTATUS_PATCH
static int draw_status2d(Bar *bar, BarArg *a);
#if BAR_EXTRASTATUS_PATCH
static int draw_status2d_es(Bar *bar, BarArg *a);
#endif // BAR_EXTRASTATUS_PATCH
#if !BAR_STATUSCMD_PATCH
static int click_status2d(Bar *bar, Arg *arg, BarArg *a);
#endif // BAR_STATUSCMD_PATCH
static int drawstatusbar(BarArg *a, char *text);
static int status2dtextlength(char *stext);
static int status2dtextlength(char *stext);

+ 0
- 17
suckless/dwm/patch/bar_statusbutton.c View File

@ -1,17 +0,0 @@
int
width_stbutton(Bar *bar, BarArg *a)
{
return TEXTW(buttonbar);
}
int
draw_stbutton(Bar *bar, BarArg *a)
{
return drw_text(drw, a->x, a->y, a->w, a->h, lrpad / 2, buttonbar, 0, False);
}
int
click_stbutton(Bar *bar, Arg *arg, BarArg *a)
{
return ClkButton;
}

+ 0
- 3
suckless/dwm/patch/bar_statusbutton.h View File

@ -1,3 +0,0 @@
static int width_stbutton(Bar *bar, BarArg *a);
static int draw_stbutton(Bar *bar, BarArg *a);
static int click_stbutton(Bar *bar, Arg *arg, BarArg *a);

+ 0
- 29
suckless/dwm/patch/bar_statuscmd.c View File

@ -1,8 +1,3 @@
#if !BAR_DWMBLOCKS_PATCH
static const char statusexport[] = "export BUTTON=-;";
static int statuscmdn;
static int lastbutton;
#endif // BAR_DWMBLOCKS_PATCH
int
click_statuscmd(Bar *bar, Arg *arg, BarArg *a)
@ -10,13 +5,6 @@ click_statuscmd(Bar *bar, Arg *arg, BarArg *a)
return click_statuscmd_text(arg, a->x, rawstext);
}
#if BAR_EXTRASTATUS_PATCH
int
click_statuscmd_es(Bar *bar, Arg *arg, BarArg *a)
{
return click_statuscmd_text(arg, a->x, rawestext);
}
#endif // BAR_EXTRASTATUS_PATCH
int
click_statuscmd_text(Arg *arg, int rel_x, char *text)
@ -24,39 +12,22 @@ click_statuscmd_text(Arg *arg, int rel_x, char *text)
int i = -1;
int x = 0;
char ch;
#if BAR_DWMBLOCKS_PATCH
dwmblockssig = -1;
#else
statuscmdn = 0;
#endif // BAR_DWMBLOCKS_PATCH
while (text[++i]) {
if ((unsigned char)text[i] < ' ') {
ch = text[i];
text[i] = '\0';
#if BAR_STATUS2D_PATCH && !BAR_BAR_STATUSCOLORS_PATCH
x += status2dtextlength(text);
#else
x += TEXTWM(text) - lrpad;
#endif // BAR_STATUS2D_PATCH
text[i] = ch;
text += i+1;
i = -1;
#if BAR_DWMBLOCKS_PATCH
if (x >= rel_x && dwmblockssig != -1)
break;
dwmblockssig = ch;
#else
if (x >= rel_x)
break;
if (ch <= LENGTH(statuscmds))
statuscmdn = ch - 1;
#endif // BAR_DWMBLOCKS_PATCH
}
}
#if BAR_DWMBLOCKS_PATCH
if (dwmblockssig == -1)
dwmblockssig = 0;
#endif // BAR_DWMBLOCKS_PATCH
return ClkStatusText;
}


+ 1
- 4
suckless/dwm/patch/bar_statuscmd.h View File

@ -1,6 +1,3 @@
static int click_statuscmd(Bar *bar, Arg *arg, BarArg *a);
#if BAR_EXTRASTATUS_PATCH
static int click_statuscmd_es(Bar *bar, Arg *arg, BarArg *a);
#endif // BAR_EXTRASTATUS_PATCH
static int click_statuscmd_text(Arg *arg, int rel_x, char *text);
static void copyvalidchars(char *text, char *rawtext);
static void copyvalidchars(char *text, char *rawtext);

+ 0
- 23
suckless/dwm/patch/bar_statuscolors.c View File

@ -1,23 +0,0 @@
int
textw_wosc(char *s)
{
char *ts = s;
char *tp = s;
int sw = 0;
char ctmp;
while (1) {
if ((unsigned int)*ts > LENGTH(colors)) {
ts++;
continue;
}
ctmp = *ts;
*ts = '\0';
sw += drw_fontset_getwidth(drw, tp, True);
*ts = ctmp;
if (ctmp == '\0')
break;
tp = ++ts;
}
return sw;
}

+ 1
- 17
suckless/dwm/patch/bar_systray.c View File

@ -33,25 +33,13 @@ draw_systray(Bar *bar, BarArg *a)
wa.event_mask = ButtonPressMask|ExposureMask;
wa.border_pixel = 0;
systray->h = MIN(a->h, drw->fonts->h);
#if BAR_ALPHA_PATCH
wa.background_pixel = 0;
wa.colormap = cmap;
systray->win = XCreateWindow(dpy, root, bar->bx + a->x + lrpad / 2, bar->by + a->y + (a->h - systray->h) / 2, MAX(a->w + 40, 1), systray->h, 0, depth,
InputOutput, visual,
CWOverrideRedirect|CWBorderPixel|CWBackPixel|CWColormap|CWEventMask, &wa); // CWBackPixmap
#else
wa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
systray->win = XCreateSimpleWindow(dpy, root, bar->bx + a->x + lrpad / 2, bar->by + a->y + (a->h - systray->h) / 2, MIN(a->w, 1), systray->h, 0, 0, scheme[SchemeNorm][ColBg].pixel);
XChangeWindowAttributes(dpy, systray->win, CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWEventMask, &wa);
#endif // BAR_ALPHA_PATCH
XSelectInput(dpy, systray->win, SubstructureNotifyMask);
XChangeProperty(dpy, systray->win, netatom[NetSystemTrayOrientation], XA_CARDINAL, 32,
PropModeReplace, (unsigned char *)&systrayorientation, 1);
#if BAR_ALPHA_PATCH
XChangeProperty(dpy, systray->win, netatom[NetSystemTrayVisual], XA_VISUALID, 32,
PropModeReplace, (unsigned char *)&visual->visualid, 1);
#endif // BAR_ALPHA_PATCH
XChangeProperty(dpy, systray->win, netatom[NetWMWindowType], XA_ATOM, 32,
PropModeReplace, (unsigned char *)&netatom[NetWMWindowTypeDock], 1);
XMapRaised(dpy, systray->win);
@ -75,11 +63,7 @@ draw_systray(Bar *bar, BarArg *a)
drw_setscheme(drw, scheme[SchemeNorm]);
for (w = 0, i = systray->icons; i; i = i->next) {
#if BAR_ALPHA_PATCH
wa.background_pixel = 0;
#else
wa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
#endif // BAR_ALPHA_PATCH
XChangeWindowAttributes(dpy, i->win, CWBackPixel, &wa);
XMapRaised(dpy, i->win);
i->x = w;
@ -194,4 +178,4 @@ wintosystrayicon(Window w)
return i;
for (i = systray->icons; i && i->win != w; i = i->next);
return i;
}
}

+ 0
- 220
suckless/dwm/patch/bar_tabgroups.c View File

@ -1,220 +0,0 @@
/* Bartabgroups properties, you can override these in your config.h if you want. */
#ifndef BARTAB_BORDERS
#define BARTAB_BORDERS 1 // 0 = off, 1 = on
#endif
#ifndef BARTAB_SHOWFLOATING
#define BARTAB_SHOWFLOATING 0 // whether to show titles for floating windows, hidden clients are always shown
#endif
#ifndef BARTAB_STACKWEIGHT
#define BARTAB_STACKWEIGHT 1 // stack weight compared to hidden and floating window titles
#endif
#ifndef BARTAB_HIDDENWEIGHT
#define BARTAB_HIDDENWEIGHT 1 // hidden window title weight
#endif
#ifndef BARTAB_FLOATWEIGHT
#define BARTAB_FLOATWEIGHT 1 // floating window title weight, set to 0 to not show floating windows
#endif
int
width_bartabgroups(Bar *bar, BarArg *a)
{
return a->w;
}
int
draw_bartabgroups(Bar *bar, BarArg *a)
{
drw_rect(drw, a->x, a->y, a->w, a->h, 1, 1);
return bartabcalculate(bar->mon, a->x, a->w, -1, bartabdraw, NULL, a);
}
int
click_bartabgroups(Bar *bar, Arg *arg, BarArg *a)
{
bartabcalculate(bar->mon, 0, a->w, a->x, bartabclick, arg, a);
return ClkWinTitle;
}
void
bartabdraw(Monitor *m, Client *c, int unused, int x, int w, int groupactive, Arg *arg, BarArg *barg)
{
if (!c)
return;
int i, nclienttags = 0, nviewtags = 0, pad = lrpad / 2;
drw_setscheme(drw, scheme[
m->sel == c
? SchemeSel
#ifdef HIDDEN
: HIDDEN(c)
? SchemeHid
#endif
: groupactive
? SchemeTitleSel
: SchemeTitleNorm
]);
if (w <= TEXTW("A") - lrpad + pad) // reduce text padding if wintitle is too small
pad = (w - TEXTW("A") + lrpad < 0 ? 0 : (w - TEXTW("A") + lrpad) / 2);
#if BAR_CENTEREDWINDOWNAME_PATCH
else if (TEXTW(c->name) < w)
pad = (w - TEXTW(c->name) + lrpad) / 2;
#endif // BAR_CENTEREDWINDOWNAME_PATCH
drw_text(drw, x, barg->y, w, barg->h, pad, c->name, 0, False);
drawstateindicator(m, c, 1, x, barg->y, w, barg->h, 0, 0, c->isfixed);
if (BARTAB_BORDERS) {
XSetForeground(drw->dpy, drw->gc, scheme[SchemeSel][ColBorder].pixel);
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, barg->y, 1, barg->h);
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x + w - (x + w >= barg->w ? 1 : 0), barg->y, 1, barg->h);
}
/* Optional tags icons */
for (i = 0; i < NUMTAGS; i++) {
if ((m->tagset[m->seltags] >> i) & 1)
nviewtags++;
if ((c->tags >> i) & 1)
nclienttags++;
}
if (TAGSINDICATOR == 2 || nclienttags > 1 || nviewtags > 1)
drawindicator(m, c, 1, x, barg->y, w, barg->h, 0, 0, 0, INDICATOR_RIGHT_TAGS);
}
#ifndef HIDDEN
#define HIDDEN(C) 0
#endif
void
bartabclick(Monitor *m, Client *c, int passx, int x, int w, int unused, Arg *arg, BarArg *barg)
{
if (passx >= x && passx <= x + w)
arg->v = c;
}
int
bartabcalculate(
Monitor *m, int offx, int tabw, int passx,
void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg),
Arg *arg, BarArg *barg
) {
Client *c;
int
i, clientsnmaster = 0, clientsnstack = 0, clientsnfloating = 0, clientsnhidden = 0,
masteractive = 0, fulllayout = 0,
x = offx, w, r, num = 0, den, tgactive;
for (i = 0; i < LENGTH(bartabmonfns); i++)
if (m ->lt[m->sellt]->arrange == bartabmonfns[i]) {
fulllayout = 1;
break;
}
for (i = 0, c = m->clients; c; c = c->next) {
if (!ISVISIBLE(c))
continue;
if (HIDDEN(c)) {
clientsnhidden++;
continue;
}
if (c->isfloating) {
clientsnfloating++;
continue;
}
if (m->sel == c)
masteractive = i < m->nmaster;
if (i < m->nmaster)
clientsnmaster++;
else
clientsnstack++;
i++;
}
if (clientsnmaster + clientsnstack + clientsnfloating + clientsnhidden == 0)
return 0;
tgactive = 1;
num = tabw;
/* floating mode */
if ((fulllayout && BARTAB_FLOATWEIGHT) || clientsnmaster + clientsnstack == 0 || !m->lt[m->sellt]->arrange) {
den = clientsnmaster + clientsnstack + clientsnfloating + clientsnhidden;
r = num % den;
w = num / den;
for (c = m->clients, i = 0; c; c = c->next) {
if (!ISVISIBLE(c))
continue;
tabfn(m, c, passx, x, w + (i < r ? 1 : 0), tgactive, arg, barg);
x += w + (i < r ? 1 : 0);
i++;
}
/* no master and stack mode, e.g. monocole, grid layouts, fibonacci */
} else if (fulllayout) {
den = clientsnmaster + clientsnstack + clientsnhidden;
r = num % den;
w = num / den;
for (c = m->clients, i = 0; c; c = c->next) {
if (!ISVISIBLE(c) || (c->isfloating && !HIDDEN(c)))
continue;
tabfn(m, c, passx, x, w + (i < r ? 1 : 0), tgactive, arg, barg);
x += w + (i < r ? 1 : 0);
i++;
}
/* tiled mode */
} else {
den = clientsnmaster;
c = m->clients;
i = 0;
if (den) {
if (clientsnstack + clientsnfloating * BARTAB_FLOATWEIGHT + clientsnhidden) {
tgactive = masteractive;
num = tabw * m->mfact;
}
r = num % den;
w = num / den;
for (; c && i < m->nmaster; c = c->next) { // tiled master
if (!ISVISIBLE(c) || c->isfloating || HIDDEN(c))
continue;
tabfn(m, c, passx, x, w + (i < r ? 1 : 0), tgactive, arg, barg);
x += w + (i < r ? 1 : 0);
i++;
}
tgactive = !tgactive;
num = tabw - num;
}
den = clientsnstack * BARTAB_STACKWEIGHT + clientsnfloating * BARTAB_FLOATWEIGHT + clientsnhidden * BARTAB_HIDDENWEIGHT;
if (!den)
return 1;
r = num % den;
w = num / den;
#if BARTAB_STACKWEIGHT
for (; c; c = c->next) { // tiled stack
if (!ISVISIBLE(c) || HIDDEN(c) || c->isfloating)
continue;
tabfn(m, c, passx, x, w * BARTAB_STACKWEIGHT + (i - m->nmaster < r ? 1 : 0), tgactive, arg, barg);
x += w * BARTAB_STACKWEIGHT + (i - m->nmaster < r ? 1 : 0);
i++;
}
#endif // BARTAB_STACKWEIGHT
#if BARTAB_HIDDENWEIGHT
for (c = m->clients; c; c = c->next) { // hidden windows
if (!ISVISIBLE(c) || !HIDDEN(c))
continue;
tabfn(m, c, passx, x, w * BARTAB_HIDDENWEIGHT + (i - m->nmaster < r ? 1 : 0), tgactive, arg, barg);
x += w * BARTAB_HIDDENWEIGHT + (i - m->nmaster < r ? 1 : 0);
i++;
}
#endif // BARTAB_HIDDENWEIGHT
#if BARTAB_FLOATWEIGHT
for (c = m->clients; c; c = c->next) { // floating windows
if (!ISVISIBLE(c) || HIDDEN(c) || !c->isfloating)
continue;
tabfn(m, c, passx, x, w * BARTAB_FLOATWEIGHT + (i - m->nmaster < r ? 1 : 0), tgactive, arg, barg);
x += w * BARTAB_FLOATWEIGHT + (i - m->nmaster < r ? 1 : 0);
i++;
}
#endif // BARTAB_FLOATWEIGHT
}
return 1;
}

+ 0
- 7
suckless/dwm/patch/bar_tabgroups.h View File

@ -1,7 +0,0 @@
static int width_bartabgroups(Bar *bar, BarArg *a);
static int draw_bartabgroups(Bar *bar, BarArg *a);
static int click_bartabgroups(Bar *bar, Arg *arg, BarArg *a);
static void bartabdraw(Monitor *m, Client *c, int unused, int x, int w, int groupactive, Arg *arg, BarArg *barg);
static void bartabclick(Monitor *m, Client *c, int passx, int x, int w, int unused, Arg *arg, BarArg *barg);
static int bartabcalculate(Monitor *m, int offx, int w, int passx, void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg), Arg *arg, BarArg *barg);

+ 0
- 149
suckless/dwm/patch/bar_taggrid.c View File

@ -1,149 +0,0 @@
int
width_taggrid(Bar *bar, BarArg *a)
{
return (a->h / 2) * (NUMTAGS / tagrows + ((NUMTAGS % tagrows > 0) ? 1 : 0)) + lrpad;
}
int
draw_taggrid(Bar *bar, BarArg *a)
{
unsigned int x, y, h, max_x = 0, columns, occ = 0;
int invert, i,j, k;
Client *c;
for (c = bar->mon->clients; c; c = c->next)
occ |= c->tags;
max_x = x = a->x + lrpad / 2;
h = a->h / tagrows - 1;
y = a->y;
columns = NUMTAGS / tagrows + ((NUMTAGS % tagrows > 0) ? 1 : 0);
/* Firstly we will fill the borders of squares */
XSetForeground(drw->dpy, drw->gc, scheme[SchemeTagsNorm][ColBg].pixel);
XFillRectangle(dpy, drw->drawable, drw->gc, x, y, h*columns + 1, a->h);
/* We will draw NUMTAGS squares in tagraws raws. */
for (j = 0, i = 0; j < tagrows; j++) {
x = a->x + lrpad / 2;
for (k = 0; k < columns; k++, i++) {
if (i < NUMTAGS) {
invert = bar->mon->tagset[bar->mon->seltags] & 1 << i ? 0 : 1;
/* Select active color for current square */
XSetForeground(drw->dpy, drw->gc, !invert ? scheme[SchemeTagsSel][ColBg].pixel :
scheme[SchemeTagsNorm][ColFg].pixel);
XFillRectangle(dpy, drw->drawable, drw->gc, x+1, y+1, h-1, h-1);
/* Mark square if tag has client */
if (occ & 1 << i) {
XSetForeground(drw->dpy, drw->gc, !invert ? scheme[SchemeTagsSel][ColFg].pixel :
scheme[SchemeTagsNorm][ColBg].pixel);
XFillRectangle(dpy, drw->drawable, drw->gc, x + 1, y + 1,
h / 2, h / 2);
}
} else {
XSetForeground(drw->dpy, drw->gc, scheme[SchemeTagsNorm][ColBg].pixel);
XFillRectangle(dpy, drw->drawable, drw->gc, x+1, y+1, h-1, h);
}
x += h;
if (x > max_x) {
max_x = x;
}
}
y += h;
}
return 1;
}
int
click_taggrid(Bar *bar, Arg *arg, BarArg *a)
{
unsigned int i, h, columns;
h = a->h / tagrows - 1;
columns = NUMTAGS / tagrows + ((NUMTAGS % tagrows > 0) ? 1 : 0);
i = (a->x - lrpad / 2) / h + columns * (a->y / h);
if (i >= NUMTAGS) {
i = NUMTAGS - 1;
}
arg->ui = 1 << i;
return ClkTagBar;
}
void
switchtag(const Arg *arg)
{
unsigned int columns;
unsigned int new_tagset = 0;
unsigned int pos, i;
int col, row;
Arg new_arg;
columns = NUMTAGS / tagrows + ((NUMTAGS % tagrows > 0) ? 1 : 0);
for (i = 0; i < NUMTAGS; ++i) {
if (!(selmon->tagset[selmon->seltags] & 1 << i)) {
continue;
}
pos = i;
row = pos / columns;
col = pos % columns;
if (arg->ui & SWITCHTAG_UP) { /* UP */
row --;
if (row < 0) {
row = tagrows - 1;
}
do {
pos = row * columns + col;
row --;
} while (pos >= NUMTAGS);
}
if (arg->ui & SWITCHTAG_DOWN) { /* DOWN */
row ++;
if (row >= tagrows) {
row = 0;
}
pos = row * columns + col;
if (pos >= NUMTAGS) {
row = 0;
}
pos = row * columns + col;
}
if (arg->ui & SWITCHTAG_LEFT) { /* LEFT */
col --;
if (col < 0) {
col = columns - 1;
}
do {
pos = row * columns + col;
col --;
} while (pos >= NUMTAGS);
}
if (arg->ui & SWITCHTAG_RIGHT) { /* RIGHT */
col ++;
if (col >= columns) {
col = 0;
}
pos = row * columns + col;
if (pos >= NUMTAGS) {
col = 0;
pos = row * columns + col;
}
}
new_tagset |= 1 << pos;
}
new_arg.ui = new_tagset;
if (arg->ui & SWITCHTAG_TOGGLETAG) {
toggletag(&new_arg);
}
if (arg->ui & SWITCHTAG_TAG) {
tag(&new_arg);
}
if (arg->ui & SWITCHTAG_VIEW) {
view (&new_arg);
}
if (arg->ui & SWITCHTAG_TOGGLEVIEW) {
toggleview (&new_arg);
}
}

+ 0
- 4
suckless/dwm/patch/bar_taggrid.h View File

@ -1,4 +0,0 @@
static int width_taggrid(Bar *bar, BarArg *a);
static int draw_taggrid(Bar *bar, BarArg *a);
static int click_taggrid(Bar *bar, Arg *arg, BarArg *a);
static void switchtag(const Arg *arg);

+ 1
- 13
suckless/dwm/patch/bar_tagicons.c View File

@ -1,20 +1,8 @@
char *
tagicon(Monitor *m, int tag)
{
#if BAR_ALTTAGSDECORATION_PATCH
Client *c;
#endif // BAR_ALTTAGSDECORATION_PATCH
int tagindex = tag + NUMTAGS * m->index;
if (tagindex >= LENGTH(tagicons[DEFAULT_TAGS]))
tagindex = tagindex % LENGTH(tagicons[DEFAULT_TAGS]);
#if BAR_ALTTAGSDECORATION_PATCH
for (c = m->clients; c && (!(c->tags & 1 << tag) || HIDDEN(c)); c = c->next);
if (c)
return tagicons[ALT_TAGS_DECORATION][tagindex];
#endif // BAR_ALTTAGSDECORATION_PATCH
#if BAR_ALTERNATIVE_TAGS_PATCH
if (m->alttag)
return tagicons[ALTERNATIVE_TAGS][tagindex];
#endif // BAR_ALTERNATIVE_TAGS_PATCH
return tagicons[DEFAULT_TAGS][tagindex];
}
}

+ 1
- 1
suckless/dwm/patch/bar_tagicons.h View File

@ -4,4 +4,4 @@ enum {
ALT_TAGS_DECORATION,
};
static char * tagicon(Monitor *m, int tag);
static char * tagicon(Monitor *m, int tag);

+ 0
- 29
suckless/dwm/patch/bar_tags.c View File

@ -2,18 +2,8 @@ int
width_tags(Bar *bar, BarArg *a)
{
int w, i;
#if BAR_HIDEVACANTTAGS_PATCH
Client *c;
unsigned int occ = 0;
for (c = bar->mon->clients; c; c = c->next)
occ |= c->tags == 255 ? 0 : c->tags;
#endif // BAR_HIDEVACANTTAGS_PATCH
for (w = 0, i = 0; i < NUMTAGS; i++) {
#if BAR_HIDEVACANTTAGS_PATCH
if (!(occ & 1 << i || bar->mon->tagset[bar->mon->seltags] & 1 << i))
continue;
#endif // BAR_HIDEVACANTTAGS_PATCH
w += TEXTW(tagicon(bar->mon, i));
}
return w;
@ -30,20 +20,11 @@ draw_tags(Bar *bar, BarArg *a)
Monitor *m = bar->mon;
for (c = m->clients; c; c = c->next) {
#if BAR_HIDEVACANTTAGS_PATCH
occ |= c->tags == 255 ? 0 : c->tags;
#else
occ |= c->tags;
#endif // BAR_HIDEVACANTTAGS_PATCH
if (c->isurgent)
urg |= c->tags;
}
for (i = 0; i < NUMTAGS; i++) {
#if BAR_HIDEVACANTTAGS_PATCH
/* do not draw vacant tags */
if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
continue;
#endif // BAR_HIDEVACANTTAGS_PATCH
icon = tagicon(bar->mon, i);
invert = 0;
@ -67,18 +48,8 @@ int
click_tags(Bar *bar, Arg *arg, BarArg *a)
{
int i = 0, x = lrpad / 2;
#if BAR_HIDEVACANTTAGS_PATCH
Client *c;
unsigned int occ = 0;
for (c = bar->mon->clients; c; c = c->next)
occ |= c->tags == 255 ? 0 : c->tags;
#endif // BAR_HIDEVACANTTAGS_PATCH
do {
#if BAR_HIDEVACANTTAGS_PATCH
if (!(occ & 1 << i || bar->mon->tagset[bar->mon->seltags] & 1 << i))
continue;
#endif // BAR_HIDEVACANTTAGS_PATCH
x += TEXTW(tagicon(bar->mon, i));
} while (a->x >= x && ++i < NUMTAGS);
if (i < NUMTAGS) {


+ 1
- 1
suckless/dwm/patch/bar_tags.h View File

@ -1,3 +1,3 @@
static int width_tags(Bar *bar, BarArg *a);
static int draw_tags(Bar *bar, BarArg *a);
static int click_tags(Bar *bar, Arg *arg, BarArg *a);
static int click_tags(Bar *bar, Arg *arg, BarArg *a);

+ 0
- 68
suckless/dwm/patch/bar_vtcolors.c View File

@ -1,68 +0,0 @@
void
get_vt_colors(void)
{
char *cfs[3] = {
"/sys/module/vt/parameters/default_red",
"/sys/module/vt/parameters/default_grn",
"/sys/module/vt/parameters/default_blu",
};
char vtcs[16][8];
char tk[] = ",";
char cl[64];
char *tp = NULL;
FILE *fp;
size_t r;
int i, c, n, len;
for (i = 0; i < 16; i++)
strcpy(vtcs[i], "#000000");
for (i = 0, r = 0; i < 3; i++) {
if ((fp = fopen(cfs[i], "r")) == NULL)
continue;
while ((cl[r] = fgetc(fp)) != EOF && cl[r] != '\n')
r++;
cl[r] = '\0';
for (c = 0, tp = cl, n = 0; c < 16; c++, tp++) {
if ((r = strcspn(tp, tk)) == -1)
break;
for (n = 0; r && *tp >= 48 && *tp < 58; r--, tp++)
n = n * 10 - 48 + *tp;
vtcs[c][i * 2 + 1] = n / 16 < 10 ? n / 16 + 48 : n / 16 + 87;
vtcs[c][i * 2 + 2] = n % 16 < 10 ? n % 16 + 48 : n % 16 + 87;
}
fclose(fp);
}
len = LENGTH(colors);
if (len > LENGTH(color_ptrs))
len = LENGTH(color_ptrs);
for (i = 0; i < len; i++) {
for (c = 0; c < ColCount; c++) {
n = color_ptrs[i][c];
if (n > -1 && strlen(colors[i][c]) >= strlen(vtcs[n]))
memcpy(colors[i][c], vtcs[n], 7);
}
}
}
int get_luminance(char *r)
{
char *c = r;
int n[3] = {0};
int i = 0;
while (*c) {
if (*c >= 48 && *c < 58)
n[i / 2] = n[i / 2] * 16 - 48 + *c;
else if (*c >= 65 && *c < 71)
n[i / 2] = n[i / 2] * 16 - 55 + *c;
else if (*c >= 97 && *c < 103)
n[i / 2] = n[i / 2] * 16 - 87 + *c;
else
i--;
i++;
c++;
}
return (0.299 * n[0] + 0.587 * n[1] + 0.114 * n[2]) / 2.55;
}

+ 0
- 2
suckless/dwm/patch/bar_vtcolors.h View File

@ -1,2 +0,0 @@
static void get_vt_colors(void);
static int get_luminance(char *rgb);

+ 0
- 51
suckless/dwm/patch/bar_wintitle.c View File

@ -1,51 +0,0 @@
int
width_wintitle(Bar *bar, BarArg *a)
{
return a->w;
}
int
draw_wintitle(Bar *bar, BarArg *a)
{
#if BAR_TITLE_LEFT_PAD_PATCH && BAR_TITLE_RIGHT_PAD_PATCH
int x = a->x + lrpad / 2, w = a->w - lrpad;
#elif BAR_TITLE_LEFT_PAD_PATCH
int x = a->x + lrpad / 2, w = a->w - lrpad / 2;
#elif BAR_TITLE_RIGHT_PAD_PATCH
int x = a->x, w = a->w - lrpad / 2;
#else
int x = a->x, w = a->w;
#endif // BAR_TITLE_LEFT_PAD_PATCH | BAR_TITLE_RIGHT_PAD_PATCH
Monitor *m = bar->mon;
int pad = lrpad / 2;
if (!m->sel) {
drw_setscheme(drw, scheme[SchemeTitleNorm]);
drw_rect(drw, x, a->y, w, a->h, 1, 1);
return 0;
}
drw_setscheme(drw, scheme[m == selmon ? SchemeTitleSel : SchemeTitleNorm]);
#if BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
XSetErrorHandler(xerrordummy);
#endif // BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
#if BAR_CENTEREDWINDOWNAME_PATCH
if (TEXTW(m->sel->name) < w)
pad = (w - TEXTW(m->sel->name) + lrpad) / 2;
#endif // BAR_CENTEREDWINDOWNAME_PATCH
drw_text(drw, x, a->y, w, a->h, pad, m->sel->name, 0, False);
#if BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
XSync(dpy, False);
XSetErrorHandler(xerror);
#endif // BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
drawstateindicator(m, m->sel, 1, x, a->y, w, a->h, 0, 0, m->sel->isfixed);
return 1;
}
int
click_wintitle(Bar *bar, Arg *arg, BarArg *a)
{
return ClkWinTitle;
}

+ 0
- 3
suckless/dwm/patch/bar_wintitle.h View File

@ -1,3 +0,0 @@
static int width_wintitle(Bar *bar, BarArg *a);
static int draw_wintitle(Bar *bar, BarArg *a);
static int click_wintitle(Bar *bar, Arg *arg, BarArg *a);

+ 0
- 45
suckless/dwm/patch/bar_wintitle_floating.c View File

@ -1,45 +0,0 @@
int
width_wintitle_floating(Bar *bar, BarArg *a)
{
return a->w;
}
int
draw_wintitle_floating(Bar *bar, BarArg *a)
{
drw_rect(drw, a->x, a->y, a->w, a->h, 1, 1);
return calc_wintitle_floating(bar->mon, a->x, a->w, -1, flextitledraw, NULL, a);
}
int
click_wintitle_floating(Bar *bar, Arg *arg, BarArg *a)
{
calc_wintitle_floating(bar->mon, 0, a->w, a->x, flextitleclick, arg, a);
return ClkWinTitle;
}
int
calc_wintitle_floating(
Monitor *m, int offx, int tabw, int passx,
void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg),
Arg *arg, BarArg *barg
) {
Client *c;
int clientsnfloating = 0, w, r;
int groupactive = GRP_FLOAT;
for (c = m->clients; c; c = c->next) {
if (!ISVISIBLE(c) || HIDDEN(c))
continue;
if (c->isfloating)
clientsnfloating++;
}
if (!clientsnfloating)
return 0;
w = tabw / clientsnfloating;
r = tabw % clientsnfloating;
c = flextitledrawarea(m, m->clients, offx, r, w, clientsnfloating, SCHEMEFOR(GRP_FLOAT), 0, 0, 1, passx, tabfn, arg, barg);
return 1;
}

+ 0
- 8
suckless/dwm/patch/bar_wintitle_floating.h View File

@ -1,8 +0,0 @@
static int width_wintitle_floating(Bar *bar, BarArg *a);
static int draw_wintitle_floating(Bar *bar, BarArg *a);
static int click_wintitle_floating(Bar *bar, Arg *arg, BarArg *a);
static int calc_wintitle_floating(
Monitor *m, int offx, int tabw, int passx,
void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg),
Arg *arg, BarArg *barg
);

+ 0
- 45
suckless/dwm/patch/bar_wintitle_hidden.c View File

@ -1,45 +0,0 @@
int
width_wintitle_hidden(Bar *bar, BarArg *a)
{
return a->w;
}
int
draw_wintitle_hidden(Bar *bar, BarArg *a)
{
drw_rect(drw, a->x, a->y, a->w, a->h, 1, 1);
return calc_wintitle_hidden(bar->mon, a->x, a->w, -1, flextitledraw, NULL, a);
}
int
click_wintitle_hidden(Bar *bar, Arg *arg, BarArg *a)
{
calc_wintitle_hidden(bar->mon, 0, a->w, a->x, flextitleclick, arg, a);
return ClkWinTitle;
}
int
calc_wintitle_hidden(
Monitor *m, int offx, int tabw, int passx,
void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg),
Arg *arg, BarArg *barg
) {
Client *c;
int clientsnhidden = 0, w, r;
int groupactive = GRP_HIDDEN;
for (c = m->clients; c; c = c->next) {
if (!ISVISIBLE(c))
continue;
if (HIDDEN(c))
clientsnhidden++;
}
if (!clientsnhidden)
return 0;
w = tabw / clientsnhidden;
r = tabw % clientsnhidden;
c = flextitledrawarea(m, m->clients, offx, r, w, clientsnhidden, SCHEMEFOR(GRP_HIDDEN), 0, 1, 0, passx, tabfn, arg, barg);
return 1;
}

+ 0
- 8
suckless/dwm/patch/bar_wintitle_hidden.h View File

@ -1,8 +0,0 @@
static int width_wintitle_hidden(Bar *bar, BarArg *a);
static int draw_wintitle_hidden(Bar *bar, BarArg *a);
static int click_wintitle_hidden(Bar *bar, Arg *arg, BarArg *a);
static int calc_wintitle_hidden(
Monitor *m, int offx, int tabw, int passx,
void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg),
Arg *arg, BarArg *barg
);

+ 0
- 93
suckless/dwm/patch/bar_wintitleactions.c View File

@ -1,93 +0,0 @@
void
hide(Client *c) {
Client *n;
if (!c || HIDDEN(c))
return;
Window w = c->win;
static XWindowAttributes ra, ca;
// more or less taken directly from blackbox's hide() function
XGrabServer(dpy);
XGetWindowAttributes(dpy, root, &ra);
XGetWindowAttributes(dpy, w, &ca);
// prevent UnmapNotify events
XSelectInput(dpy, root, ra.your_event_mask & ~SubstructureNotifyMask);
XSelectInput(dpy, w, ca.your_event_mask & ~StructureNotifyMask);
XUnmapWindow(dpy, w);
setclientstate(c, IconicState);
XSelectInput(dpy, root, ra.your_event_mask);
XSelectInput(dpy, w, ca.your_event_mask);
XUngrabServer(dpy);
if (c->isfloating || !c->mon->lt[c->mon->sellt]->arrange) {
for (n = c->snext; n && (!ISVISIBLE(n) || HIDDEN(n)); n = n->snext);
if (!n)
for (n = c->mon->stack; n && (!ISVISIBLE(n) || HIDDEN(n)); n = n->snext);
} else {
n = nexttiled(c);
if (!n)
n = prevtiled(c);
}
focus(n);
arrange(c->mon);
}
void
show(Client *c)
{
if (!c || !HIDDEN(c))
return;
XMapWindow(dpy, c->win);
setclientstate(c, NormalState);
arrange(c->mon);
}
void
togglewin(const Arg *arg)
{
Client *c = (Client*)arg->v;
if (!c)
return;
if (c == selmon->sel)
hide(c);
else {
if (HIDDEN(c))
show(c);
focus(c);
restack(c->mon);
}
}
Client *
prevtiled(Client *c)
{
Client *p, *i;
for (p = NULL, i = c->mon->clients; c && i != c; i = i->next)
if (ISVISIBLE(i) && !HIDDEN(i))
p = i;
return p;
}
void
showhideclient(const Arg *arg)
{
Client *c = (Client*)arg->v;
if (!c)
c = selmon->sel;
if (!c)
return;
#if WARP_PATCH
force_warp = 1;
#endif // WARP_PATCH
if (HIDDEN(c)) {
show(c);
focus(c);
restack(c->mon);
} else {
hide(c);
}
}

+ 0
- 5
suckless/dwm/patch/bar_wintitleactions.h View File

@ -1,5 +0,0 @@
static void hide(Client *c);
static void show(Client *c);
static void togglewin(const Arg *arg);
static Client * prevtiled(Client *c);
static void showhideclient(const Arg *arg);

+ 0
- 23
suckless/dwm/patch/cfacts.c View File

@ -1,23 +0,0 @@
void
setcfact(const Arg *arg)
{
float f;
Client *c;
c = selmon->sel;
if (!arg || !c || !selmon->lt[selmon->sellt]->arrange)
return;
if (!arg->f)
f = 1.0;
else if (arg->f > 4.0) // set fact absolutely
f = arg->f - 4.0;
else
f = arg->f + c->cfact;
if (f < 0.25)
f = 0.25;
else if (f > 4.0)
f = 4.0;
c->cfact = f;
arrange(selmon);
}

+ 0
- 1
suckless/dwm/patch/cfacts.h View File

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

+ 0
- 5
suckless/dwm/patch/cmdcustomize.c View File

@ -1,5 +0,0 @@
char*
help(void)
{
return "usage: dwm [-hv] [-fn font] [-nb color] [-nf color] [-sb color] [-sf color]\n[-df font] [-dnf color] [-dnb color] [-dsf color] [-dsb color]\n";
}

+ 0
- 1
suckless/dwm/patch/cmdcustomize.h View File

@ -1 +0,0 @@
static char* help();

+ 1
- 11
suckless/dwm/patch/combo.c View File

@ -1,21 +1,15 @@
static int combo = 0;
#if !BAR_HOLDBAR_PATCH
void
keyrelease(XEvent *e)
{
combo = 0;
}
#endif // !BAR_HOLDBAR_PATCH
void
combotag(const Arg *arg)
{
if (selmon->sel && arg->ui & TAGMASK) {
#if SWITCHTAG_PATCH
if (selmon->sel->switchtag)
selmon->sel->switchtag = 0;
#endif // SWITCHTAG_PATCH
if (combo) {
selmon->sel->tags |= arg->ui & TAGMASK;
} else {
@ -37,13 +31,9 @@ comboview(const Arg *arg)
selmon->seltags ^= 1; /*toggle tagset*/
combo = 1;
if (newtags) {
#if PERTAG_PATCH
pertagview(&((Arg) { .ui = newtags }));
#else
selmon->tagset[selmon->seltags] = newtags;
#endif // PERTAG_PATCH
}
}
focus(NULL);
arrange(selmon);
}
}

+ 1
- 3
suckless/dwm/patch/combo.h View File

@ -1,5 +1,3 @@
#if !BAR_HOLDBAR_PATCH
static void keyrelease(XEvent *e);
#endif // !BAR_HOLDBAR_PATCH
static void combotag(const Arg *arg);
static void comboview(const Arg *arg);
static void comboview(const Arg *arg);

+ 0
- 28
suckless/dwm/patch/cool_autostart.c View File

@ -1,28 +0,0 @@
/* dwm will keep pid's of processes from autostart array and kill them at quit */
static pid_t *autostart_pids;
static size_t autostart_len;
/* execute command from autostart array */
static void
autostart_exec()
{
const char *const *p;
size_t i = 0;
/* count entries */
for (p = autostart; *p; autostart_len++, p++)
while (*++p);
autostart_pids = malloc(autostart_len * sizeof(pid_t));
for (p = autostart; *p; i++, p++) {
if ((autostart_pids[i] = fork()) == 0) {
setsid();
execvp(*p, (char *const *)p);
fprintf(stderr, "dwm: execvp %s\n", *p);
perror(" failed");
_exit(EXIT_FAILURE);
}
/* skip arguments */
while (*++p);
}
}

+ 0
- 1
suckless/dwm/patch/cool_autostart.h View File

@ -1 +0,0 @@
static void autostart_exec(void);

+ 1
- 1
suckless/dwm/patch/cyclelayouts.h View File

@ -1 +1 @@
static void cyclelayout(const Arg *arg);
static void cyclelayout(const Arg *arg);

+ 0
- 38
suckless/dwm/patch/decorationhints.c View File

@ -1,38 +0,0 @@
static Atom motifatom;
void
updatemotifhints(Client *c)
{
Atom real;
int format;
unsigned char *p = NULL;
unsigned long n, extra;
unsigned long *motif;
int width, height;
if (!decorhints)
return;
if (XGetWindowProperty(dpy, c->win, motifatom, 0L, 5L, False, motifatom,
&real, &format, &n, &extra, &p) == Success && p != NULL) {
motif = (unsigned long*)p;
if (motif[MWM_HINTS_FLAGS_FIELD] & MWM_HINTS_DECORATIONS) {
width = WIDTH(c);
height = HEIGHT(c);
if (motif[MWM_HINTS_DECORATIONS_FIELD] & MWM_DECOR_ALL ||
motif[MWM_HINTS_DECORATIONS_FIELD] & MWM_DECOR_BORDER ||
motif[MWM_HINTS_DECORATIONS_FIELD] & MWM_DECOR_TITLE)
#if SETBORDERPX_PATCH
c->bw = c->oldbw = c->mon->borderpx;
#else
c->bw = c->oldbw = borderpx;
#endif // SETBORDERPX_PATCH
else
c->bw = c->oldbw = 0;
resize(c, c->x, c->y, width - (2*c->bw), height - (2*c->bw), 0);
}
XFree(p);
}
}

+ 0
- 8
suckless/dwm/patch/decorationhints.h View File

@ -1,8 +0,0 @@
#define MWM_HINTS_FLAGS_FIELD 0
#define MWM_HINTS_DECORATIONS_FIELD 2
#define MWM_HINTS_DECORATIONS (1 << 1)
#define MWM_DECOR_ALL (1 << 0)
#define MWM_DECOR_BORDER (1 << 1)
#define MWM_DECOR_TITLE (1 << 3)
static void updatemotifhints(Client *c);

+ 0
- 82
suckless/dwm/patch/dragcfact.c View File

@ -1,82 +0,0 @@
void
dragcfact(const Arg *arg)
{
int prev_x, prev_y, dist_x, dist_y;
float fact;
Client *c;
XEvent ev;
Time lasttime = 0;
if (!(c = selmon->sel))
return;
if (c->isfloating) {
resizemouse(arg);
return;
}
#if !FAKEFULLSCREEN_PATCH
#if FAKEFULLSCREEN_CLIENT_PATCH
if (c->isfullscreen && !c->fakefullscreen) /* no support resizing fullscreen windows by mouse */
return;
#else
if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */
return;
#endif // FAKEFULLSCREEN_CLIENT_PATCH
#endif // !FAKEFULLSCREEN_PATCH
restack(selmon);
if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
None, cursor[CurIronCross]->cursor, CurrentTime) != GrabSuccess)
return;
#if WARP_PATCH
ignore_warp = 1;
#endif // WARP_PATCH
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w/2, c->h/2);
prev_x = prev_y = -999999;
do {
XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
switch(ev.type) {
case ConfigureRequest:
case Expose:
case MapRequest:
handler[ev.type](&ev);
break;
case MotionNotify:
if ((ev.xmotion.time - lasttime) <= (1000 / 60))
continue;
lasttime = ev.xmotion.time;
if (prev_x == -999999) {
prev_x = ev.xmotion.x_root;
prev_y = ev.xmotion.y_root;
}
dist_x = ev.xmotion.x - prev_x;
dist_y = ev.xmotion.y - prev_y;
if (abs(dist_x) > abs(dist_y)) {
fact = (float) 4.0 * dist_x / c->mon->ww;
} else {
fact = (float) -4.0 * dist_y / c->mon->wh;
}
if (fact)
setcfact(&((Arg) { .f = fact }));
prev_x = ev.xmotion.x;
prev_y = ev.xmotion.y;
break;
}
} while (ev.type != ButtonRelease);
#if WARP_PATCH
ignore_warp = 0;
#endif // WARP_PATCH
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w/2, c->h/2);
XUngrabPointer(dpy, CurrentTime);
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
}

+ 0
- 1
suckless/dwm/patch/dragcfact.h View File

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

+ 0
- 231
suckless/dwm/patch/dragmfact.c View File

@ -1,231 +0,0 @@
void
dragmfact(const Arg *arg)
{
unsigned int n;
int py, px; // pointer coordinates
int ax, ay, aw, ah; // area position, width and height
int center = 0, horizontal = 0, mirror = 0, fixed = 0; // layout configuration
double fact;
Monitor *m;
XEvent ev;
Time lasttime = 0;
m = selmon;
#if VANITYGAPS_PATCH
int oh, ov, ih, iv;
getgaps(m, &oh, &ov, &ih, &iv, &n);
#else
Client *c;
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
#endif // VANITYGAPS_PATCH
ax = m->wx;
ay = m->wy;
ah = m->wh;
aw = m->ww;
if (!n)
return;
#if FLEXTILE_DELUXE_LAYOUT
else if (m->lt[m->sellt]->arrange == &flextile) {
int layout = m->ltaxis[LAYOUT];
if (layout < 0) {
mirror = 1;
layout *= -1;
}
if (layout > FLOATING_MASTER) {
layout -= FLOATING_MASTER;
fixed = 1;
}
if (layout == SPLIT_HORIZONTAL || layout == SPLIT_HORIZONTAL_DUAL_STACK)
horizontal = 1;
else if (layout == SPLIT_CENTERED_VERTICAL && (fixed || n - m->nmaster > 1))
center = 1;
else if (layout == FLOATING_MASTER) {
center = 1;
if (aw < ah)
horizontal = 1;
}
else if (layout == SPLIT_CENTERED_HORIZONTAL) {
if (fixed || n - m->nmaster > 1)
center = 1;
horizontal = 1;
}
}
#endif // FLEXTILE_DELUXE_LAYOUT
#if CENTEREDMASTER_LAYOUT
else if (m->lt[m->sellt]->arrange == &centeredmaster && (fixed || n - m->nmaster > 1))
center = 1;
#endif // CENTEREDMASTER_LAYOUT
#if CENTEREDFLOATINGMASTER_LAYOUT
else if (m->lt[m->sellt]->arrange == &centeredfloatingmaster)
center = 1;
#endif // CENTEREDFLOATINGMASTER_LAYOUT
#if BSTACK_LAYOUT
else if (m->lt[m->sellt]->arrange == &bstack)
horizontal = 1;
#endif // BSTACK_LAYOUT
#if BSTACKHORIZ_LAYOUT
else if (m->lt[m->sellt]->arrange == &bstackhoriz)
horizontal = 1;
#endif // BSTACKHORIZ_LAYOUT
/* do not allow mfact to be modified under certain conditions */
if (!m->lt[m->sellt]->arrange // floating layout
|| (!fixed && m->nmaster && n <= m->nmaster) // no master
#if MONOCLE_LAYOUT
|| m->lt[m->sellt]->arrange == &monocle
#endif // MONOCLE_LAYOUT
#if GRIDMODE_LAYOUT
|| m->lt[m->sellt]->arrange == &grid
#endif // GRIDMODE_LAYOUT
#if HORIZGRID_LAYOUT
|| m->lt[m->sellt]->arrange == &horizgrid
#endif // HORIZGRID_LAYOUT
#if GAPPLESSGRID_LAYOUT
|| m->lt[m->sellt]->arrange == &gaplessgrid
#endif // GAPPLESSGRID_LAYOUT
#if NROWGRID_LAYOUT
|| m->lt[m->sellt]->arrange == &nrowgrid
#endif // NROWGRID_LAYOUT
#if FLEXTILE_DELUXE_LAYOUT
|| (m->lt[m->sellt]->arrange == &flextile && m->ltaxis[LAYOUT] == NO_SPLIT)
#endif // FLEXTILE_DELUXE_LAYOUT
)
return;
#if VANITYGAPS_PATCH
ay += oh;
ax += ov;
aw -= 2*ov;
ah -= 2*oh;
#endif // VANITYGAPS_PATCH
if (center) {
if (horizontal) {
px = ax + aw / 2;
#if VANITYGAPS_PATCH
py = ay + ah / 2 + (ah - 2*ih) * (m->mfact / 2.0) + ih / 2;
#else
py = ay + ah / 2 + ah * m->mfact / 2.0;
#endif // VANITYGAPS_PATCH
} else { // vertical split
#if VANITYGAPS_PATCH
px = ax + aw / 2 + (aw - 2*iv) * m->mfact / 2.0 + iv / 2;
#else
px = ax + aw / 2 + aw * m->mfact / 2.0;
#endif // VANITYGAPS_PATCH
py = ay + ah / 2;
}
} else if (horizontal) {
px = ax + aw / 2;
if (mirror)
#if VANITYGAPS_PATCH
py = ay + (ah - ih) * (1.0 - m->mfact) + ih / 2;
#else
py = ay + (ah * (1.0 - m->mfact));
#endif // VANITYGAPS_PATCH
else
#if VANITYGAPS_PATCH
py = ay + ((ah - ih) * m->mfact) + ih / 2;
#else
py = ay + (ah * m->mfact);
#endif // VANITYGAPS_PATCH
} else { // vertical split
if (mirror)
#if VANITYGAPS_PATCH
px = ax + (aw - iv) * (1.0 - m->mfact) + iv / 2;
#else
px = ax + (aw * m->mfact);
#endif // VANITYGAPS_PATCH
else
#if VANITYGAPS_PATCH
px = ax + ((aw - iv) * m->mfact) + iv / 2;
#else
px = ax + (aw * m->mfact);
#endif // VANITYGAPS_PATCH
py = ay + ah / 2;
}
if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
None, cursor[horizontal ? CurResizeVertArrow : CurResizeHorzArrow]->cursor, CurrentTime) != GrabSuccess)
return;
#if WARP_PATCH
ignore_warp = 1;
#endif // WARP_PATCH
XWarpPointer(dpy, None, root, 0, 0, 0, 0, px, py);
do {
XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
switch(ev.type) {
case ConfigureRequest:
case Expose:
case MapRequest:
handler[ev.type](&ev);
break;
case MotionNotify:
if ((ev.xmotion.time - lasttime) <= (1000 / 40))
continue;
if (lasttime != 0) {
px = ev.xmotion.x;
py = ev.xmotion.y;
}
lasttime = ev.xmotion.time;
#if VANITYGAPS_PATCH
if (center)
if (horizontal)
if (py - ay > ah / 2)
fact = (double) 1.0 - (ay + ah - py - ih / 2) * 2 / (double) (ah - 2*ih);
else
fact = (double) 1.0 - (py - ay - ih / 2) * 2 / (double) (ah - 2*ih);
else
if (px - ax > aw / 2)
fact = (double) 1.0 - (ax + aw - px - iv / 2) * 2 / (double) (aw - 2*iv);
else
fact = (double) 1.0 - (px - ax - iv / 2) * 2 / (double) (aw - 2*iv);
else
if (horizontal)
fact = (double) (py - ay - ih / 2) / (double) (ah - ih);
else
fact = (double) (px - ax - iv / 2) / (double) (aw - iv);
#else
if (center)
if (horizontal)
if (py - ay > ah / 2)
fact = (double) 1.0 - (ay + ah - py) * 2 / (double) ah;
else
fact = (double) 1.0 - (py - ay) * 2 / (double) ah;
else
if (px - ax > aw / 2)
fact = (double) 1.0 - (ax + aw - px) * 2 / (double) aw;
else
fact = (double) 1.0 - (px - ax) * 2 / (double) aw;
else
if (horizontal)
fact = (double) (py - ay) / (double) ah;
else
fact = (double) (px - ax) / (double) aw;
#endif // VANITYGAPS_PATCH
if (!center && mirror)
fact = 1.0 - fact;
setmfact(&((Arg) { .f = 1.0 + fact }));
px = ev.xmotion.x;
py = ev.xmotion.y;
break;
}
} while (ev.type != ButtonRelease);
#if WARP_PATCH
ignore_warp = 0;
#endif // WARP_PATCH
XUngrabPointer(dpy, CurrentTime);
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
}

+ 0
- 1
suckless/dwm/patch/dragmfact.h View File

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

+ 0
- 129
suckless/dwm/patch/dwmc View File

@ -1,129 +0,0 @@
#!/usr/bin/env bash
signal() {
xsetroot -name "fsignal:$*"
}
case $# in
1)
case $1 in
focusurgent) ;&
mirrorlayout) ;&
mpdcontrol) ;&
pushdown) ;&
pushup) ;&
self_restart) ;&
setlayout) ;&
setcfact) ;&
switchcol) ;&
view) ;&
viewall) ;&
viewtoleft) ;&
viewtoright) ;&
tagtoleft) ;&
tagtoright) ;&
tagandviewtoleft) ;&
tagandviewtoright) ;&
transfer) ;&
transferall) ;&
togglealttag) ;&
togglebar) ;&
togglefloating) ;&
togglefullscreen) ;&
fullscreen) ;&
togglefakefullscreen) ;&
togglesticky) ;&
togglehorizontalmax) ;&
toggleverticalmax) ;&
togglemax) ;&
togglegaps) ;&
defaultgaps) ;&
unfloatvisible) ;&
winview) ;&
xrdb) ;&
zoom) ;&
killclient) ;&
quit)
signal $1
;;
*)
echo "Unknown command ($1) or missing one argument."
exit 1
;;
esac
;;
2)
case $1 in
cyclelayout) ;&
explace) ;&
moveplace) ;&
mpdchange) ;&
setkeymode) ;&
switchtag) ;&
togglescratch) ;&
view)
signal $1 ui $2
;;
viewex) ;&
toggleviewex) ;&
tagallmon) ;&
tagswapmon) ;&
tagex) ;&
toggletagex) ;&
setborderpx) ;&
setgaps) ;&
setlayoutex) ;&
setlayoutaxisex) ;&
swapfocus) ;&
focusstack) ;&
pushstack) ;&
inplacerotate) ;&
rotatestack) ;&
rotatelayoutaxis) ;&
incnmaster) ;&
incnstack) ;&
incrgaps) ;&
incrigaps) ;&
incrogaps) ;&
incrihgaps) ;&
incrivgaps) ;&
incrohgaps) ;&
incrovgaps) ;&
movestack) ;&
shiftview) ;&
shiftviewclients) ;&
focusmon) ;&
tagmon)
signal $1 i $2
;;
setcfact) ;&
setmfact)
signal $1 f $2
;;
*)
echo "Unknown command ($1) or too many arguments"
exit 1
;;
esac
;;
5)
case $1 in
setgaps)
# Expects "setgaps oh ov ih iv" where -1 means to keep existing values
[ $2 = -1 ] && oh=128 || oh=$2
[ $3 = -1 ] && ov=128 || ov=$3
[ $4 = -1 ] && ih=128 || ih=$4
[ $5 = -1 ] && iv=128 || iv=$5
signal $1 i $(((oh << 24) + (ov << 16) + (ih << 8) + iv))
;;
*)
echo "Unknown command ($1) or too many arguments"
exit 1
;;
esac
;;
*)
echo "Unknown command ($1) or too many arguments"
exit 1
;;
esac

+ 0
- 100
suckless/dwm/patch/dwmc.c View File

@ -1,100 +0,0 @@
void
setlayoutex(const Arg *arg)
{
setlayout(&((Arg) { .v = &layouts[arg->i] }));
}
void
viewex(const Arg *arg)
{
view(&((Arg) { .ui = 1 << arg->ui }));
}
void
viewallex(const Arg *arg)
{
#if SCRATCHPADS_PATCH
view(&((Arg){.ui = ~SPTAGMASK}));
#else
view(&((Arg){.ui = ~0}));
#endif // SCRATCHPADS_PATCH
}
void
toggleviewex(const Arg *arg)
{
toggleview(&((Arg) { .ui = 1 << arg->ui }));
}
void
tagex(const Arg *arg)
{
tag(&((Arg) { .ui = 1 << arg->ui }));
}
void
toggletagex(const Arg *arg)
{
toggletag(&((Arg) { .ui = 1 << arg->ui }));
}
void
tagallex(const Arg *arg)
{
#if SCRATCHPADS_PATCH
tag(&((Arg){.ui = ~SPTAGMASK}));
#else
tag(&((Arg){.ui = ~0}));
#endif // SCRATCHPADS_PATCH
}
int
fake_signal(void)
{
char fsignal[256];
char indicator[9] = "fsignal:";
char str_sig[50];
char param[16];
int i, len_str_sig, n, paramn;
size_t len_fsignal, len_indicator = strlen(indicator);
Arg arg;
// Get root name property
if (gettextprop(root, XA_WM_NAME, fsignal, sizeof(fsignal))) {
len_fsignal = strlen(fsignal);
// Check if this is indeed a fake signal
if (len_indicator > len_fsignal ? 0 : strncmp(indicator, fsignal, len_indicator) == 0) {
paramn = sscanf(fsignal+len_indicator, "%s%n%s%n", str_sig, &len_str_sig, param, &n);
if (paramn == 1) arg = (Arg) {0};
else if (paramn > 2) return 1;
else if (strncmp(param, "i", n - len_str_sig) == 0)
#if IPC_PATCH
sscanf(fsignal + len_indicator + n, "%li", &(arg.i));
#else
sscanf(fsignal + len_indicator + n, "%i", &(arg.i));
#endif // IPC_PATCH
else if (strncmp(param, "ui", n - len_str_sig) == 0)
#if IPC_PATCH
sscanf(fsignal + len_indicator + n, "%lu", &(arg.ui));
#else
sscanf(fsignal + len_indicator + n, "%u", &(arg.ui));
#endif // IPC_PATCH
else if (strncmp(param, "f", n - len_str_sig) == 0)
sscanf(fsignal + len_indicator + n, "%f", &(arg.f));
else return 1;
// Check if a signal was found, and if so handle it
for (i = 0; i < LENGTH(signals); i++)
if (strncmp(str_sig, signals[i].sig, len_str_sig) == 0 && signals[i].func)
signals[i].func(&(arg));
// A fake signal was sent
return 1;
}
}
// No fake signal was sent, so proceed with update
return 0;
}

+ 0
- 13
suckless/dwm/patch/dwmc.h View File

@ -1,13 +0,0 @@
typedef struct {
const char * sig;
void (*func)(const Arg *);
} Signal;
static void setlayoutex(const Arg *arg);
static void viewex(const Arg *arg);
static void viewallex(const Arg *arg);
static void toggleviewex(const Arg *arg);
static void tagex(const Arg *arg);
static void toggletagex(const Arg *arg);
static void tagallex(const Arg *arg);
static int fake_signal(void);

+ 0
- 195
suckless/dwm/patch/exresize.c View File

@ -1,195 +0,0 @@
#define EXPAND_LEFT (1 << 0)
#define EXPAND_RIGHT (1 << 2)
#define EXPAND_UP (1 << 4)
#define EXPAND_DOWN (1 << 6)
#define IS_SET(q, w) ((q & w) != 0)
#define IS_FORCED(q, w) IS_SET((q << 1), w)
#define EXPANDALL (EXPAND_LEFT | EXPAND_RIGHT | EXPAND_UP | EXPAND_DOWN)
#define UNEXPAND (EXPANDALL << 1) // Force all directions to 0
#define FORCE_EXPANDALL ~0 // Force expand in all directions
void
exresize(const Arg *arg)
{
Client *c;
int x, y, nx, ny, nw, nh;
c = selmon->sel;
if (!c || !arg) return;
if (selmon->lt[selmon->sellt]->arrange && !c->isfloating)
togglefloating(NULL);
if (c->expandmask != 0)
expand(UNEXPAND);
x = ((int *)arg->v)[0];
y = ((int *)arg->v)[1];
nw = MIN(selmon->ww - c->bw*2, c->w + x);
nh = MIN(selmon->wh - c->bw*2, c->h + y);
nx = c->x - x/2;
ny = c->y - y/2;
if (!((abs(c->x + c->w/2 - (selmon->wx + selmon->ww/2)) < snap))) {
if ((nw == selmon->ww) ||
(nx < selmon->wx) ||
(abs(selmon->wx - c->x) < snap))
nx = selmon->wx;
else if ((nx+nw > (selmon->wx + selmon->ww)) ||
(abs((selmon->wx + selmon->ww) - (c->x + c->w)) < snap))
nx = (selmon->wx + selmon->ww) - nw - c->bw*2;
} else
nx = selmon->wx + selmon->ww/2 - nw/2;
if (!((abs(c->y + c->h/2 - (selmon->wy + selmon->wh/2)) < snap))) {
if ((nh == selmon->wh) ||
(ny < selmon->wy) ||
(abs(selmon->wy - c->y) < snap))
ny = selmon->wy;
else if ((ny+nh > (selmon->wy + selmon->wh)) ||
(abs((selmon->wy + selmon->wh) - (c->y + c->h)) < snap))
ny = (selmon->wy + selmon->wh) - nh - c->bw*2;
} else
ny = selmon->wy + selmon->wh/2 - nh/2;
resizeclient(c, nx, ny, MAX(nw, 32), MAX(nh, 32));
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w/2, c->h/2);
}
void
explace(const Arg *arg)
{
Client *c;
int nx, ny;
c = selmon->sel;
if (!c || (arg->ui >= 9)) return;
if (selmon->lt[selmon->sellt]->arrange && !c->isfloating)
togglefloating(NULL);
nx = (arg->ui % 3) - 1;
ny = (arg->ui / 3) - 1;
if (nx < 0) nx = selmon->wx;
else if (nx > 0) nx = selmon->wx + selmon->ww - c->w - c->bw*2;
else nx = selmon->wx + selmon->ww/2 - c->w/2;
if (ny < 0) ny = selmon->wy;
else if (ny > 0) ny = selmon->wy + selmon->wh - c->h - c->bw*2;
else ny = selmon->wy + selmon->wh/2 - c->h/2;
resize(c, nx, ny, c->w, c->h, True);
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w/2, c->h/2);
}
int
calculate_expand(unsigned char mask, unsigned char curmask,
unsigned char *newmask, unsigned char key,
int *reset_value, int new_reset_value,
int max_value, int old_value)
{
if (IS_SET(key, mask) ||
(IS_SET(key, curmask) && (!IS_SET(key, mask) && IS_FORCED(key, mask))) ||
(!IS_SET(key, curmask) && (IS_SET(key, mask) && IS_FORCED(key, mask)))) {
if (IS_SET(key, mask) && (!IS_SET(key,curmask) || IS_FORCED(key,mask))) {
if (!IS_SET(key, curmask))
*reset_value = new_reset_value;
*newmask |= key;
return max_value;
} else if ((IS_SET(key,curmask) && IS_SET(key, mask)) ||
(!IS_SET(key, mask) && IS_FORCED(key, mask))) {
*newmask &= ~key;
return *reset_value;
} else {
*newmask &= ~key;
return old_value;
}
} else
return new_reset_value;
}
void
expand(unsigned char mask)
{
XEvent ev;
int nx1, ny1, nx2, ny2;
#if SETBORDERPX_PATCH
int bp = selmon->borderpx;
#else
int bp = borderpx;
#endif // SETBORDERPX_PATCH
unsigned char curmask;
unsigned char newmask;
if (!selmon->sel || selmon->sel->isfixed)
return;
XRaiseWindow(dpy, selmon->sel->win);
newmask = curmask = selmon->sel->expandmask;
if (curmask == 0) {
if(!selmon->lt[selmon->sellt]->arrange || selmon->sel->isfloating)
selmon->sel->wasfloating = 1;
else {
togglefloating(NULL);
selmon->sel->wasfloating = 0;
}
}
nx1 = calculate_expand(mask, curmask, &newmask,
EXPAND_LEFT, &selmon->sel->expandx1,
selmon->sel->x,
selmon->wx,
selmon->sel->oldx);
nx2 = calculate_expand(mask, curmask, &newmask,
EXPAND_RIGHT, &selmon->sel->expandx2,
selmon->sel->x + selmon->sel->w,
selmon->wx + selmon->ww - 2*bp,
selmon->sel->oldw + selmon->sel->x);
ny1 = calculate_expand(mask, curmask, &newmask,
EXPAND_UP, &selmon->sel->expandy1,
selmon->sel->y,
selmon->wy,
selmon->sel->oldy);
ny2 = calculate_expand(mask, curmask, &newmask,
EXPAND_DOWN, &selmon->sel->expandy2,
selmon->sel->y + selmon->sel->h,
selmon->wy + selmon->wh - 2*bp,
selmon->sel->oldh + selmon->sel->y);
resizeclient(selmon->sel, nx1, ny1, MAX(nx2-nx1, 32), MAX(ny2-ny1, 32));
if ((newmask == 0) && (!selmon->sel->wasfloating))
togglefloating(NULL);
selmon->sel->expandmask = newmask;
drawbar(selmon);
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
}
void
togglemaximize(const Arg *arg)
{
if (arg->i > 0) expand(FORCE_EXPANDALL);
else if (arg->i < 0) expand(UNEXPAND);
else expand(EXPANDALL);
}
void
toggleverticalexpand(const Arg *arg)
{
if (arg->i < 0) expand(EXPAND_DOWN);
else if (arg->i > 0) expand(EXPAND_UP);
else expand(EXPAND_DOWN | EXPAND_UP);
}
void
togglehorizontalexpand(const Arg *arg)
{
if (arg->i < 0) expand(EXPAND_LEFT);
else if (arg->i > 0) expand(EXPAND_RIGHT);
else expand(EXPAND_LEFT | EXPAND_RIGHT);
}

+ 0
- 8
suckless/dwm/patch/exresize.h View File

@ -1,8 +0,0 @@
enum { EX_NW, EX_N, EX_NE, EX_W, EX_C, EX_E, EX_SW, EX_S, EX_SE };
void expand(unsigned char mask);
void togglemaximize(const Arg *arg);
void toggleverticalexpand(const Arg *arg);
void togglehorizontalexpand(const Arg *arg);
void exresize(const Arg *arg);
void explace(const Arg *arg);

+ 0
- 18
suckless/dwm/patch/fakefullscreenclient.c View File

@ -1,18 +0,0 @@
void
togglefakefullscreen(const Arg *arg)
{
Client *c = selmon->sel;
if (!c)
return;
if (c->fakefullscreen != 1 && c->isfullscreen) { // exit fullscreen --> fake fullscreen
c->fakefullscreen = 2;
setfullscreen(c, 0);
} else if (c->fakefullscreen == 1) {
setfullscreen(c, 0);
c->fakefullscreen = 0;
} else {
c->fakefullscreen = 1;
setfullscreen(c, 1);
}
}

+ 0
- 1
suckless/dwm/patch/fakefullscreenclient.h View File

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

+ 0
- 11
suckless/dwm/patch/floatpos.c View File

@ -9,10 +9,8 @@ floatpos(const Arg *arg)
setfloatpos(c, (char *)arg->v);
resizeclient(c, c->x, c->y, c->w, c->h);
#if !FOCUSONCLICK_PATCH
XRaiseWindow(dpy, c->win);
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w/2, c->h/2);
#endif // FOCUSONCLICK_PATCH
}
void
@ -20,10 +18,8 @@ setfloatpos(Client *c, const char *floatpos)
{
char xCh, yCh, wCh, hCh;
int x, y, w, h, wx, ww, wy, wh;
#if FLOATPOS_RESPECT_GAPS_PATCH
int oh, ov, ih, iv;
unsigned int n;
#endif // FLOATPOS_RESPECT_GAPS_PATCH
if (!c || !floatpos)
return;
@ -57,18 +53,11 @@ setfloatpos(Client *c, const char *floatpos)
return;
}
#if FLOATPOS_RESPECT_GAPS_PATCH
getgaps(c->mon, &oh, &ov, &ih, &iv, &n);
wx = c->mon->wx + ov;
wy = c->mon->wy + oh;
ww = c->mon->ww - 2*ov;
wh = c->mon->wh - 2*oh;
#else
wx = c->mon->wx;
wy = c->mon->wy;
ww = c->mon->ww;
wh = c->mon->wh;
#endif // FLOATPOS_RESPECT_GAPS_PATCH
getfloatpos(x, xCh, w, wCh, wx, ww, c->x, c->w, c->bw, floatposgrid_x, &c->x, &c->w);
getfloatpos(y, yCh, h, hCh, wy, wh, c->y, c->h, c->bw, floatposgrid_y, &c->y, &c->h);


+ 1
- 1
suckless/dwm/patch/floatpos.h View File

@ -1,3 +1,3 @@
static void floatpos(const Arg *arg);
static void setfloatpos(Client *c, const char *floatpos);
static void getfloatpos(int pos, char pCh, int size, char sCh, int min_p, int max_s, int cp, int cs, int cbw, int defgrid, int *out_p, int *out_s);
static void getfloatpos(int pos, char pCh, int size, char sCh, int min_p, int max_s, int cp, int cs, int cbw, int defgrid, int *out_p, int *out_s);

+ 0
- 73
suckless/dwm/patch/focusadjacenttag.c View File

@ -1,73 +0,0 @@
void
tagtoleft(const Arg *arg)
{
if (selmon->sel != NULL
&& __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
&& selmon->tagset[selmon->seltags] > 1) {
selmon->sel->tags >>= 1;
focus(NULL);
arrange(selmon);
}
}
void
tagtoright(const Arg *arg)
{
if (selmon->sel != NULL
&& __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
&& selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
selmon->sel->tags <<= 1;
focus(NULL);
arrange(selmon);
}
}
void
viewtoleft(const Arg *arg)
{
if (__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
&& selmon->tagset[selmon->seltags] > 1) {
selmon->seltags ^= 1; /* toggle sel tagset */
selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] >> 1;
focus(NULL);
arrange(selmon);
}
}
void
viewtoright(const Arg *arg)
{
if (__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
&& selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
selmon->seltags ^= 1; /* toggle sel tagset */
selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] << 1;
focus(NULL);
arrange(selmon);
}
}
void
tagandviewtoleft(const Arg *arg)
{
if (__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
&& selmon->tagset[selmon->seltags] > 1) {
selmon->sel->tags >>= 1;
selmon->seltags ^= 1; /* toggle sel tagset */
selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] >> 1;
focus(selmon->sel);
arrange(selmon);
}
}
void
tagandviewtoright(const Arg *arg)
{
if (__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
&& selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
selmon->sel->tags <<= 1;
selmon->seltags ^= 1; /* toggle sel tagset */
selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] << 1;
focus(selmon->sel);
arrange(selmon);
}
}

+ 0
- 6
suckless/dwm/patch/focusadjacenttag.h View File

@ -1,6 +0,0 @@
static void tagtoleft(const Arg *arg);
static void tagtoright(const Arg *arg);
static void viewtoleft(const Arg *arg);
static void viewtoright(const Arg *arg);
static void tagandviewtoleft(const Arg *arg);
static void tagandviewtoright(const Arg *arg);

+ 0
- 65
suckless/dwm/patch/focusdir.c View File

@ -1,65 +0,0 @@
void
focusdir(const Arg *arg)
{
Client *s = selmon->sel, *f = NULL, *c, *next;
if (!s)
return;
unsigned int score = -1;
unsigned int client_score;
int dist;
int dirweight = 20;
int isfloating = s->isfloating;
next = s->next;
if (!next)
next = s->mon->clients;
for (c = next; c != s; c = next) {
next = c->next;
if (!next)
next = s->mon->clients;
if (!ISVISIBLE(c) || c->isfloating != isfloating) // || HIDDEN(c)
continue;
switch (arg->i) {
case 0: // left
dist = s->x - c->x - c->w;
client_score =
dirweight * MIN(abs(dist), abs(dist + s->mon->ww)) +
abs(s->y - c->y);
break;
case 1: // right
dist = c->x - s->x - s->w;
client_score =
dirweight * MIN(abs(dist), abs(dist + s->mon->ww)) +
abs(c->y - s->y);
break;
case 2: // up
dist = s->y - c->y - c->h;
client_score =
dirweight * MIN(abs(dist), abs(dist + s->mon->wh)) +
abs(s->x - c->x);
break;
default:
case 3: // down
dist = c->y - s->y - s->h;
client_score =
dirweight * MIN(abs(dist), abs(dist + s->mon->wh)) +
abs(c->x - s->x);
break;
}
if (((arg->i == 0 || arg->i == 2) && client_score <= score) || client_score < score) {
score = client_score;
f = c;
}
}
if (f && f != s) {
focus(f);
restack(f->mon);
}
}

+ 0
- 1
suckless/dwm/patch/focusdir.h View File

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

+ 0
- 13
suckless/dwm/patch/focusmaster.c View File

@ -1,13 +0,0 @@
void
focusmaster(const Arg *arg)
{
Client *c;
if (selmon->nmaster < 1)
return;
c = nexttiled(selmon->clients);
if (c)
focus(c);
}

+ 0
- 1
suckless/dwm/patch/focusmaster.h View File

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

+ 0
- 15
suckless/dwm/patch/focusurgent.c View File

@ -1,15 +0,0 @@
void
focusurgent(const Arg *arg)
{
Client *c;
int i;
for (c = selmon->clients; c && !c->isurgent; c = c->next);
if (c) {
for (i = 0; i < NUMTAGS && !((1 << i) & c->tags); i++);
if (i < NUMTAGS) {
if (((1 << i) & TAGMASK) != selmon->tagset[selmon->seltags])
view(&((Arg) { .ui = 1 << i }));
focus(c);
}
}
}

+ 0
- 1
suckless/dwm/patch/focusurgent.h View File

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

+ 0
- 40
suckless/dwm/patch/fsignal.c View File

@ -1,40 +0,0 @@
int
fake_signal(void)
{
char fsignal[256];
char indicator[9] = "fsignal:";
char str_signum[16];
int i, v, signum;
size_t len_fsignal, len_indicator = strlen(indicator);
// Get root name property
if (gettextprop(root, XA_WM_NAME, fsignal, sizeof(fsignal))) {
len_fsignal = strlen(fsignal);
// Check if this is indeed a fake signal
if (len_indicator > len_fsignal ? 0 : strncmp(indicator, fsignal, len_indicator) == 0) {
memcpy(str_signum, &fsignal[len_indicator], len_fsignal - len_indicator);
str_signum[len_fsignal - len_indicator] = '\0';
// Convert string value into managable integer
for (i = signum = 0; i < strlen(str_signum); i++) {
v = str_signum[i] - '0';
if (v >= 0 && v <= 9) {
signum = signum * 10 + v;
}
}
// Check if a signal was found, and if so handle it
if (signum)
for (i = 0; i < LENGTH(signals); i++)
if (signum == signals[i].signum && signals[i].func)
signals[i].func(&(signals[i].arg));
// A fake signal was sent
return 1;
}
}
// No fake signal was sent, so proceed with update
return 0;
}

+ 0
- 7
suckless/dwm/patch/fsignal.h View File

@ -1,7 +0,0 @@
typedef struct {
unsigned int signum;
void (*func)(const Arg *);
const Arg arg;
} Signal;
static int fake_signal(void);

+ 1
- 3
suckless/dwm/patch/fullscreen.c View File

@ -5,13 +5,11 @@ fullscreen(const Arg *arg)
{
int monocle_pos = 0;
if (selmon->showbar || last_layout == NULL) {
#if MONOCLE_LAYOUT
for (monocle_pos = 0, last_layout = (Layout *)layouts; !last_layout->arrange || last_layout->arrange != &monocle; monocle_pos++, last_layout++ );
#endif // MONOCLE_LAYOUT
for (last_layout = (Layout *)layouts; last_layout != selmon->lt[selmon->sellt]; last_layout++);
setlayout(&((Arg) { .v = &layouts[monocle_pos] }));
} else {
setlayout(&((Arg) { .v = last_layout }));
}
togglebar(arg);
}
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save