├── README.md ├── dmenu-5.0 ├── LICENSE ├── Makefile ├── README ├── arg.h ├── config.def.h ├── config.h ├── config.mk ├── dmenu ├── dmenu-alpha-20210605-1a13d04.diff ├── dmenu.1 ├── dmenu.c ├── dmenu.o ├── dmenu_path ├── dmenu_run ├── drw.c ├── drw.h ├── drw.o ├── stest ├── stest.1 ├── stest.c ├── stest.o ├── util.c ├── util.h └── util.o ├── dwm-6.2 ├── LICENSE ├── Makefile ├── README ├── config.def.h ├── config.h ├── config.mk ├── drw.c ├── drw.h ├── drw.o ├── dwm ├── dwm.1 ├── dwm.c ├── dwm.o ├── dwm.png ├── layoutmenu.sh ├── transient.c ├── util.c ├── util.h └── util.o ├── dwmblocks ├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── blks ├── blocks.h └── dwmblocks.c ├── dwmscrot.png ├── patches ├── dmenu-center-20200111-8cd37e1.diff ├── dmenu-grid-4.9.diff ├── dmenu-gridnav-5.0.diff ├── dmenu-highlight-20201211-fcdc159.diff ├── dwm-autostart-20210120-cb3f58a.diff ├── dwm-bar-height-6.2.diff ├── dwm-bottomstack-6.1.diff ├── dwm-cyclelayouts-20180524-6.2.diff ├── dwm-float-border-color-6.2.diff ├── dwm-focusadjacenttag-6.0.diff ├── dwm-namedscratchpads-6.2.diff ├── dwm-statuscolors-20181008-b69c870.diff ├── dwm-titlecolor-20210815-ed3ab6b4.diff ├── dwm-uselessgap-6.2.diff └── dwm-viewontag-20210312-61bb8b2.diff └── st-0.8.4 ├── FAQ ├── LEGACY ├── LICENSE ├── Makefile ├── README ├── TODO ├── arg.h ├── config.def.h ├── config.def.h.orig ├── config.h ├── config.mk ├── patches ├── st-anygeometry-0.8.1.diff ├── st-blinking_cursor-20200531-a2a7044.diff ├── st-scrollback-20210507-4536f46.diff ├── st-scrollback-mouse-20191024-a2c479c.diff ├── st-scrollback-mouse-altscreen-20200416-5703aa0.diff ├── st-scrollback-mouse-increment-0.8.2.diff ├── st-universcroll-0.8.4.diff └── st-w3m-0.8.3.diff ├── st ├── st-anygeometry-0.8.1.diff ├── st.1 ├── st.c ├── st.h ├── st.info ├── st.o ├── win.h ├── x.c ├── x.c.orig └── x.o /README.md: -------------------------------------------------------------------------------- 1 | # This is my current setup of DWM. 2 | ### This repo includes all of my currently used suckless utilities and files, such as: 3 | * dwm 4 | * ST (simple terminal) 5 | * dmenu 6 | * dwm blocks (for my status bar) 7 | * .dwm (autostart file) 8 | * patches I used 9 | 10 | ![](dwmscrot.png) 11 | -------------------------------------------------------------------------------- /dmenu-5.0/LICENSE: -------------------------------------------------------------------------------- 1 | MIT/X Consortium License 2 | 3 | © 2006-2019 Anselm R Garbe 4 | © 2006-2008 Sander van Dijk 5 | © 2006-2007 Michał Janeczek 6 | © 2007 Kris Maglione 7 | © 2009 Gottox 8 | © 2009 Markus Schnalke 9 | © 2009 Evan Gates 10 | © 2010-2012 Connor Lane Smith 11 | © 2014-2020 Hiltjo Posthuma 12 | © 2015-2019 Quentin Rameau 13 | 14 | Permission is hereby granted, free of charge, to any person obtaining a 15 | copy of this software and associated documentation files (the "Software"), 16 | to deal in the Software without restriction, including without limitation 17 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 18 | and/or sell copies of the Software, and to permit persons to whom the 19 | Software is furnished to do so, subject to the following conditions: 20 | 21 | The above copyright notice and this permission notice shall be included in 22 | all copies or substantial portions of the Software. 23 | 24 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 27 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 29 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 30 | DEALINGS IN THE SOFTWARE. 31 | -------------------------------------------------------------------------------- /dmenu-5.0/Makefile: -------------------------------------------------------------------------------- 1 | # dmenu - dynamic menu 2 | # See LICENSE file for copyright and license details. 3 | 4 | include config.mk 5 | 6 | SRC = drw.c dmenu.c stest.c util.c 7 | OBJ = $(SRC:.c=.o) 8 | 9 | all: options dmenu stest 10 | 11 | options: 12 | @echo dmenu build options: 13 | @echo "CFLAGS = $(CFLAGS)" 14 | @echo "LDFLAGS = $(LDFLAGS)" 15 | @echo "CC = $(CC)" 16 | 17 | .c.o: 18 | $(CC) -c $(CFLAGS) $< 19 | 20 | config.h: 21 | cp config.def.h $@ 22 | 23 | $(OBJ): arg.h config.h config.mk drw.h 24 | 25 | dmenu: dmenu.o drw.o util.o 26 | $(CC) -o $@ dmenu.o drw.o util.o $(LDFLAGS) 27 | 28 | stest: stest.o 29 | $(CC) -o $@ stest.o $(LDFLAGS) 30 | 31 | clean: 32 | rm -f dmenu stest $(OBJ) dmenu-$(VERSION).tar.gz 33 | 34 | dist: clean 35 | mkdir -p dmenu-$(VERSION) 36 | cp LICENSE Makefile README arg.h config.def.h config.mk dmenu.1\ 37 | drw.h util.h dmenu_path dmenu_run stest.1 $(SRC)\ 38 | dmenu-$(VERSION) 39 | tar -cf dmenu-$(VERSION).tar dmenu-$(VERSION) 40 | gzip dmenu-$(VERSION).tar 41 | rm -rf dmenu-$(VERSION) 42 | 43 | install: all 44 | mkdir -p $(DESTDIR)$(PREFIX)/bin 45 | cp -f dmenu dmenu_path dmenu_run stest $(DESTDIR)$(PREFIX)/bin 46 | chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu 47 | chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_path 48 | chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_run 49 | chmod 755 $(DESTDIR)$(PREFIX)/bin/stest 50 | mkdir -p $(DESTDIR)$(MANPREFIX)/man1 51 | sed "s/VERSION/$(VERSION)/g" < dmenu.1 > $(DESTDIR)$(MANPREFIX)/man1/dmenu.1 52 | sed "s/VERSION/$(VERSION)/g" < stest.1 > $(DESTDIR)$(MANPREFIX)/man1/stest.1 53 | chmod 644 $(DESTDIR)$(MANPREFIX)/man1/dmenu.1 54 | chmod 644 $(DESTDIR)$(MANPREFIX)/man1/stest.1 55 | 56 | uninstall: 57 | rm -f $(DESTDIR)$(PREFIX)/bin/dmenu\ 58 | $(DESTDIR)$(PREFIX)/bin/dmenu_path\ 59 | $(DESTDIR)$(PREFIX)/bin/dmenu_run\ 60 | $(DESTDIR)$(PREFIX)/bin/stest\ 61 | $(DESTDIR)$(MANPREFIX)/man1/dmenu.1\ 62 | $(DESTDIR)$(MANPREFIX)/man1/stest.1 63 | 64 | .PHONY: all options clean dist install uninstall 65 | -------------------------------------------------------------------------------- /dmenu-5.0/README: -------------------------------------------------------------------------------- 1 | dmenu - dynamic menu 2 | ==================== 3 | dmenu is an efficient dynamic menu for X. 4 | 5 | 6 | Requirements 7 | ------------ 8 | In order to build dmenu you need the Xlib header files. 9 | 10 | 11 | Installation 12 | ------------ 13 | Edit config.mk to match your local setup (dmenu is installed into 14 | the /usr/local namespace by default). 15 | 16 | Afterwards enter the following command to build and install dmenu 17 | (if necessary as root): 18 | 19 | make clean install 20 | 21 | 22 | Running dmenu 23 | ------------- 24 | See the man page for details. 25 | -------------------------------------------------------------------------------- /dmenu-5.0/arg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copy me if you can. 3 | * by 20h 4 | */ 5 | 6 | #ifndef ARG_H__ 7 | #define ARG_H__ 8 | 9 | extern char *argv0; 10 | 11 | /* use main(int argc, char *argv[]) */ 12 | #define ARGBEGIN for (argv0 = *argv, argv++, argc--;\ 13 | argv[0] && argv[0][0] == '-'\ 14 | && argv[0][1];\ 15 | argc--, argv++) {\ 16 | char argc_;\ 17 | char **argv_;\ 18 | int brk_;\ 19 | if (argv[0][1] == '-' && argv[0][2] == '\0') {\ 20 | argv++;\ 21 | argc--;\ 22 | break;\ 23 | }\ 24 | for (brk_ = 0, argv[0]++, argv_ = argv;\ 25 | argv[0][0] && !brk_;\ 26 | argv[0]++) {\ 27 | if (argv_ != argv)\ 28 | break;\ 29 | argc_ = argv[0][0];\ 30 | switch (argc_) 31 | 32 | #define ARGEND }\ 33 | } 34 | 35 | #define ARGC() argc_ 36 | 37 | #define EARGF(x) ((argv[0][1] == '\0' && argv[1] == NULL)?\ 38 | ((x), abort(), (char *)0) :\ 39 | (brk_ = 1, (argv[0][1] != '\0')?\ 40 | (&argv[0][1]) :\ 41 | (argc--, argv++, argv[0]))) 42 | 43 | #define ARGF() ((argv[0][1] == '\0' && argv[1] == NULL)?\ 44 | (char *)0 :\ 45 | (brk_ = 1, (argv[0][1] != '\0')?\ 46 | (&argv[0][1]) :\ 47 | (argc--, argv++, argv[0]))) 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /dmenu-5.0/config.def.h: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | /* Default settings; can be overriden by command line. */ 3 | 4 | static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */ 5 | static int centered = 0; /* -c option; centers dmenu on screen */ 6 | static int min_width = 500; /* minimum width when centered */ 7 | /* -fn option overrides fonts[0]; default X11 font or font set */ 8 | static const char *fonts[] = { 9 | "hermit:size=10" 10 | }; 11 | static const char *prompt = NULL; /* -p option; prompt to the left of input field */ 12 | static const char *colors[SchemeLast][2] = { 13 | /* fg bg */ 14 | [SchemeNorm] = { "#bbbbbb", "#000000" }, 15 | [SchemeSel] = { "#b5bd68", "#478061" }, 16 | [SchemeSelHighlight] = { "#528b8b", "#181818" }, 17 | [SchemeNormHighlight] = { "#528b8b", "#222222" }, 18 | [SchemeOut] = { "#000000", "#00ffff" }, 19 | [SchemeOutHighlight] = { "#000000", "#00ffff" }, 20 | }; 21 | /* -l and -g options; controls number of lines and columns in grid if > 0 */ 22 | static unsigned int lines = 0; 23 | static unsigned int columns = 0; 24 | 25 | /* 26 | * Characters not considered part of a word while deleting words 27 | * for example: " /?\"&[]" 28 | */ 29 | static const char worddelimiters[] = " "; 30 | -------------------------------------------------------------------------------- /dmenu-5.0/config.h: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | /* Default settings; can be overriden by command line. */ 3 | 4 | static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */ 5 | static int centered = 0; /* -c option; centers dmenu on screen */ 6 | static int min_width = 500; /* minimum width when centered */ 7 | /* -fn option overrides fonts[0]; default X11 font or font set */ 8 | static const char *fonts[] = { 9 | "hermit:size=10" 10 | }; 11 | static const char *prompt = NULL; /* -p option; prompt to the left of input field */ 12 | static const char *colors[SchemeLast][2] = { 13 | /* fg bg */ 14 | [SchemeNorm] = { "#bbbbbb", "#000000" }, 15 | [SchemeSel] = { "#b5bd68", "#478061" }, 16 | [SchemeSelHighlight] = { "#528b8b", "#181818" }, 17 | [SchemeNormHighlight] = { "#528b8b", "#222222" }, 18 | [SchemeOut] = { "#000000", "#00ffff" }, 19 | [SchemeOutHighlight] = { "#000000", "#00ffff" }, 20 | }; 21 | /* -l and -g options; controls number of lines and columns in grid if > 0 */ 22 | static unsigned int lines = 0; 23 | static unsigned int columns = 0; 24 | 25 | /* 26 | * Characters not considered part of a word while deleting words 27 | * for example: " /?\"&[]" 28 | */ 29 | static const char worddelimiters[] = " "; 30 | -------------------------------------------------------------------------------- /dmenu-5.0/config.mk: -------------------------------------------------------------------------------- 1 | # dmenu version 2 | VERSION = 5.0 3 | 4 | # paths 5 | PREFIX = /usr/local 6 | MANPREFIX = $(PREFIX)/share/man 7 | 8 | X11INC = /usr/X11R6/include 9 | X11LIB = /usr/X11R6/lib 10 | 11 | # Xinerama, comment if you don't want it 12 | XINERAMALIBS = -lXinerama 13 | XINERAMAFLAGS = -DXINERAMA 14 | 15 | # freetype 16 | FREETYPELIBS = -lfontconfig -lXft 17 | FREETYPEINC = /usr/include/freetype2 18 | # OpenBSD (uncomment) 19 | #FREETYPEINC = $(X11INC)/freetype2 20 | 21 | # includes and libs 22 | INCS = -I$(X11INC) -I$(FREETYPEINC) 23 | LIBS = -L$(X11LIB) -lX11 $(XINERAMALIBS) $(FREETYPELIBS) 24 | 25 | # flags 26 | CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" $(XINERAMAFLAGS) 27 | CFLAGS = -std=c99 -pedantic -Wall -Os $(INCS) $(CPPFLAGS) 28 | LDFLAGS = $(LIBS) 29 | 30 | # compiler and linker 31 | CC = cc 32 | -------------------------------------------------------------------------------- /dmenu-5.0/dmenu: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdpedersen1/void-suckless/e01b4cf76ec5fd12be8d9343140410cef355f425/dmenu-5.0/dmenu -------------------------------------------------------------------------------- /dmenu-5.0/dmenu-alpha-20210605-1a13d04.diff: -------------------------------------------------------------------------------- 1 | diff --git a/config.def.h b/config.def.h 2 | index 1edb647..697d511 100644 3 | --- a/config.def.h 4 | +++ b/config.def.h 5 | @@ -2,6 +2,7 @@ 6 | /* Default settings; can be overriden by command line. */ 7 | 8 | static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */ 9 | +static const unsigned int alpha = 0xf0; 10 | /* -fn option overrides fonts[0]; default X11 font or font set */ 11 | static const char *fonts[] = { 12 | "monospace:size=10" 13 | @@ -13,6 +14,13 @@ static const char *colors[SchemeLast][2] = { 14 | [SchemeSel] = { "#eeeeee", "#005577" }, 15 | [SchemeOut] = { "#000000", "#00ffff" }, 16 | }; 17 | + 18 | +static const unsigned int alphas[SchemeLast][2] = { 19 | + [SchemeNorm] = { OPAQUE, alpha }, 20 | + [SchemeSel] = { OPAQUE, alpha }, 21 | + [SchemeOut] = { OPAQUE, alpha }, 22 | +}; 23 | + 24 | /* -l option; if nonzero, dmenu uses vertical list with given number of lines */ 25 | static unsigned int lines = 0; 26 | 27 | diff --git a/dmenu.c b/dmenu.c 28 | index 65f25ce..3e56e1a 100644 29 | --- a/dmenu.c 30 | +++ b/dmenu.c 31 | @@ -10,6 +10,7 @@ 32 | 33 | #include 34 | #include 35 | +#include 36 | #include 37 | #ifdef XINERAMA 38 | #include 39 | @@ -25,6 +26,8 @@ 40 | #define LENGTH(X) (sizeof X / sizeof X[0]) 41 | #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) 42 | 43 | +#define OPAQUE 0xffU 44 | + 45 | /* enums */ 46 | enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */ 47 | 48 | @@ -53,10 +56,16 @@ static XIC xic; 49 | static Drw *drw; 50 | static Clr *scheme[SchemeLast]; 51 | 52 | +static int useargb = 0; 53 | +static Visual *visual; 54 | +static int depth; 55 | +static Colormap cmap; 56 | + 57 | #include "config.h" 58 | 59 | static int (*fstrncmp)(const char *, const char *, size_t) = strncmp; 60 | static char *(*fstrstr)(const char *, const char *) = strstr; 61 | +static void xinitvisual(); 62 | 63 | static void 64 | appenditem(struct item *item, struct item **list, struct item **last) 65 | @@ -602,7 +611,7 @@ setup(void) 66 | #endif 67 | /* init appearance */ 68 | for (j = 0; j < SchemeLast; j++) 69 | - scheme[j] = drw_scm_create(drw, colors[j], 2); 70 | + scheme[j] = drw_scm_create(drw, colors[j], alphas[i], 2); 71 | 72 | clip = XInternAtom(dpy, "CLIPBOARD", False); 73 | utf8 = XInternAtom(dpy, "UTF8_STRING", False); 74 | @@ -640,6 +649,7 @@ setup(void) 75 | x = info[i].x_org; 76 | y = info[i].y_org + (topbar ? 0 : info[i].height - mh); 77 | mw = info[i].width; 78 | + 79 | XFree(info); 80 | } else 81 | #endif 82 | @@ -657,11 +667,13 @@ setup(void) 83 | 84 | /* create menu window */ 85 | swa.override_redirect = True; 86 | - swa.background_pixel = scheme[SchemeNorm][ColBg].pixel; 87 | + swa.background_pixel = 0; 88 | + swa.border_pixel = 0; 89 | + swa.colormap = cmap; 90 | swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask; 91 | - win = XCreateWindow(dpy, parentwin, x, y, mw, mh, 0, 92 | - CopyFromParent, CopyFromParent, CopyFromParent, 93 | - CWOverrideRedirect | CWBackPixel | CWEventMask, &swa); 94 | + win = XCreateWindow(dpy, parentwin, x, y, mw, mh, border_width, 95 | + depth, CopyFromParent, visual, 96 | + CWOverrideRedirect | CWBackPixel | CWBorderPixel | CWColormap | CWEventMask, &swa); 97 | XSetClassHint(dpy, win, &ch); 98 | 99 | 100 | @@ -747,7 +759,8 @@ main(int argc, char *argv[]) 101 | if (!XGetWindowAttributes(dpy, parentwin, &wa)) 102 | die("could not get embedding window attributes: 0x%lx", 103 | parentwin); 104 | - drw = drw_create(dpy, screen, root, wa.width, wa.height); 105 | + xinitvisual(); 106 | + drw = drw_create(dpy, screen, root, wa.width, wa.height, visual, depth, cmap); 107 | if (!drw_fontset_create(drw, fonts, LENGTH(fonts))) 108 | die("no fonts could be loaded."); 109 | lrpad = drw->fonts->h; 110 | @@ -769,3 +782,40 @@ main(int argc, char *argv[]) 111 | 112 | return 1; /* unreachable */ 113 | } 114 | + 115 | + void 116 | +xinitvisual() 117 | +{ 118 | + XVisualInfo *infos; 119 | + XRenderPictFormat *fmt; 120 | + int nitems; 121 | + int i; 122 | + 123 | + XVisualInfo tpl = { 124 | + .screen = screen, 125 | + .depth = 32, 126 | + .class = TrueColor 127 | + }; 128 | + long masks = VisualScreenMask | VisualDepthMask | VisualClassMask; 129 | + 130 | + infos = XGetVisualInfo(dpy, masks, &tpl, &nitems); 131 | + visual = NULL; 132 | + for(i = 0; i < nitems; i ++) { 133 | + fmt = XRenderFindVisualFormat(dpy, infos[i].visual); 134 | + if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) { 135 | + visual = infos[i].visual; 136 | + depth = infos[i].depth; 137 | + cmap = XCreateColormap(dpy, root, visual, AllocNone); 138 | + useargb = 1; 139 | + break; 140 | + } 141 | + } 142 | + 143 | + XFree(infos); 144 | + 145 | + if (! visual) { 146 | + visual = DefaultVisual(dpy, screen); 147 | + depth = DefaultDepth(dpy, screen); 148 | + cmap = DefaultColormap(dpy, screen); 149 | + } 150 | +} 151 | diff --git a/drw.c b/drw.c 152 | index 4cdbcbe..fe3aadd 100644 153 | --- a/drw.c 154 | +++ b/drw.c 155 | @@ -61,7 +61,7 @@ utf8decode(const char *c, long *u, size_t clen) 156 | } 157 | 158 | Drw * 159 | -drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h) 160 | +drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap) 161 | { 162 | Drw *drw = ecalloc(1, sizeof(Drw)); 163 | 164 | @@ -70,8 +70,11 @@ drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h 165 | drw->root = root; 166 | drw->w = w; 167 | drw->h = h; 168 | - drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen)); 169 | - drw->gc = XCreateGC(dpy, root, 0, NULL); 170 | + drw->visual = visual; 171 | + drw->depth = depth; 172 | + drw->cmap = cmap; 173 | + drw->drawable = XCreatePixmap(dpy, root, w, h, depth); 174 | + drw->gc = XCreateGC(dpy, drw->drawable, 0, NULL); 175 | XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter); 176 | 177 | return drw; 178 | @@ -87,7 +90,7 @@ drw_resize(Drw *drw, unsigned int w, unsigned int h) 179 | drw->h = h; 180 | if (drw->drawable) 181 | XFreePixmap(drw->dpy, drw->drawable); 182 | - drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen)); 183 | + drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, drw->depth); 184 | } 185 | 186 | void 187 | @@ -194,21 +197,22 @@ drw_fontset_free(Fnt *font) 188 | } 189 | 190 | void 191 | -drw_clr_create(Drw *drw, Clr *dest, const char *clrname) 192 | +drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha) 193 | { 194 | if (!drw || !dest || !clrname) 195 | return; 196 | 197 | - if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen), 198 | - DefaultColormap(drw->dpy, drw->screen), 199 | + if (!XftColorAllocName(drw->dpy, drw->visual, drw->cmap, 200 | clrname, dest)) 201 | die("error, cannot allocate color '%s'", clrname); 202 | + 203 | + dest->pixel = (dest->pixel & 0x00ffffffU) | (alpha << 24); 204 | } 205 | 206 | /* Wrapper to create color schemes. The caller has to call free(3) on the 207 | * returned color scheme when done using it. */ 208 | Clr * 209 | -drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount) 210 | +drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount) 211 | { 212 | size_t i; 213 | Clr *ret; 214 | @@ -218,7 +222,7 @@ drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount) 215 | return NULL; 216 | 217 | for (i = 0; i < clrcount; i++) 218 | - drw_clr_create(drw, &ret[i], clrnames[i]); 219 | + drw_clr_create(drw, &ret[i], clrnames[i], alphas[i]); 220 | return ret; 221 | } 222 | 223 | @@ -274,9 +278,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp 224 | } else { 225 | XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel); 226 | XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h); 227 | - d = XftDrawCreate(drw->dpy, drw->drawable, 228 | - DefaultVisual(drw->dpy, drw->screen), 229 | - DefaultColormap(drw->dpy, drw->screen)); 230 | + d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap); 231 | x += lpad; 232 | w -= lpad; 233 | } 234 | diff --git a/drw.h b/drw.h 235 | index 4c67419..f6fa5cd 100644 236 | --- a/drw.h 237 | +++ b/drw.h 238 | @@ -20,6 +20,9 @@ typedef struct { 239 | Display *dpy; 240 | int screen; 241 | Window root; 242 | + Visual *visual; 243 | + unsigned int depth; 244 | + Colormap cmap; 245 | Drawable drawable; 246 | GC gc; 247 | Clr *scheme; 248 | @@ -27,7 +30,7 @@ typedef struct { 249 | } Drw; 250 | 251 | /* Drawable abstraction */ 252 | -Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h); 253 | +Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h, Visual*, unsigned int, Colormap); 254 | void drw_resize(Drw *drw, unsigned int w, unsigned int h); 255 | void drw_free(Drw *drw); 256 | 257 | @@ -38,8 +41,8 @@ unsigned int drw_fontset_getwidth(Drw *drw, const char *text); 258 | void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h); 259 | 260 | /* Colorscheme abstraction */ 261 | -void drw_clr_create(Drw *drw, Clr *dest, const char *clrname); 262 | -Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount); 263 | +void drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha); 264 | +Clr *drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount); 265 | 266 | /* Cursor abstraction */ 267 | Cur *drw_cur_create(Drw *drw, int shape); 268 | -------------------------------------------------------------------------------- /dmenu-5.0/dmenu.1: -------------------------------------------------------------------------------- 1 | .TH DMENU 1 dmenu\-VERSION 2 | .SH NAME 3 | dmenu \- dynamic menu 4 | .SH SYNOPSIS 5 | .B dmenu 6 | .RB [ \-bfiv ] 7 | .RB [ \-g 8 | .IR columns ] 9 | .RB [ \-l 10 | .IR lines ] 11 | .RB [ \-m 12 | .IR monitor ] 13 | .RB [ \-p 14 | .IR prompt ] 15 | .RB [ \-fn 16 | .IR font ] 17 | .RB [ \-nb 18 | .IR color ] 19 | .RB [ \-nf 20 | .IR color ] 21 | .RB [ \-sb 22 | .IR color ] 23 | .RB [ \-sf 24 | .IR color ] 25 | .RB [ \-w 26 | .IR windowid ] 27 | .P 28 | .BR dmenu_run " ..." 29 | .SH DESCRIPTION 30 | .B dmenu 31 | is a dynamic menu for X, which reads a list of newline\-separated items from 32 | stdin. When the user selects an item and presses Return, their choice is printed 33 | to stdout and dmenu terminates. Entering text will narrow the items to those 34 | matching the tokens in the input. 35 | .P 36 | .B dmenu_run 37 | is a script used by 38 | .IR dwm (1) 39 | which lists programs in the user's $PATH and runs the result in their $SHELL. 40 | .SH OPTIONS 41 | .TP 42 | .B \-b 43 | dmenu appears at the bottom of the screen. 44 | .TP 45 | .B \-c 46 | dmenu appears centered on the screen. 47 | .TP 48 | .B \-f 49 | dmenu grabs the keyboard before reading stdin if not reading from a tty. This 50 | is faster, but will lock up X until stdin reaches end\-of\-file. 51 | .TP 52 | .B \-i 53 | dmenu matches menu items case insensitively. 54 | .TP 55 | .BI \-g " columns" 56 | dmenu lists items in a grid with the given number of columns. 57 | .TP 58 | .BI \-l " lines" 59 | dmenu lists items in a grid with the given number of lines. 60 | .TP 61 | .BI \-m " monitor" 62 | dmenu is displayed on the monitor number supplied. Monitor numbers are starting 63 | from 0. 64 | .TP 65 | .BI \-p " prompt" 66 | defines the prompt to be displayed to the left of the input field. 67 | .TP 68 | .BI \-fn " font" 69 | defines the font or font set used. 70 | .TP 71 | .BI \-nb " color" 72 | defines the normal background color. 73 | .IR #RGB , 74 | .IR #RRGGBB , 75 | and X color names are supported. 76 | .TP 77 | .BI \-nf " color" 78 | defines the normal foreground color. 79 | .TP 80 | .BI \-sb " color" 81 | defines the selected background color. 82 | .TP 83 | .BI \-sf " color" 84 | defines the selected foreground color. 85 | .TP 86 | .B \-v 87 | prints version information to stdout, then exits. 88 | .TP 89 | .BI \-w " windowid" 90 | embed into windowid. 91 | .SH USAGE 92 | dmenu is completely controlled by the keyboard. Items are selected using the 93 | arrow keys, page up, page down, home, and end. 94 | .TP 95 | .B Tab 96 | Copy the selected item to the input field. 97 | .TP 98 | .B Return 99 | Confirm selection. Prints the selected item to stdout and exits, returning 100 | success. 101 | .TP 102 | .B Ctrl-Return 103 | Confirm selection. Prints the selected item to stdout and continues. 104 | .TP 105 | .B Shift\-Return 106 | Confirm input. Prints the input text to stdout and exits, returning success. 107 | .TP 108 | .B Escape 109 | Exit without selecting an item, returning failure. 110 | .TP 111 | .B Ctrl-Left 112 | Move cursor to the start of the current word 113 | .TP 114 | .B Ctrl-Right 115 | Move cursor to the end of the current word 116 | .TP 117 | .B C\-a 118 | Home 119 | .TP 120 | .B C\-b 121 | Left 122 | .TP 123 | .B C\-c 124 | Escape 125 | .TP 126 | .B C\-d 127 | Delete 128 | .TP 129 | .B C\-e 130 | End 131 | .TP 132 | .B C\-f 133 | Right 134 | .TP 135 | .B C\-g 136 | Escape 137 | .TP 138 | .B C\-h 139 | Backspace 140 | .TP 141 | .B C\-i 142 | Tab 143 | .TP 144 | .B C\-j 145 | Return 146 | .TP 147 | .B C\-J 148 | Shift-Return 149 | .TP 150 | .B C\-k 151 | Delete line right 152 | .TP 153 | .B C\-m 154 | Return 155 | .TP 156 | .B C\-M 157 | Shift-Return 158 | .TP 159 | .B C\-n 160 | Down 161 | .TP 162 | .B C\-p 163 | Up 164 | .TP 165 | .B C\-u 166 | Delete line left 167 | .TP 168 | .B C\-w 169 | Delete word left 170 | .TP 171 | .B C\-y 172 | Paste from primary X selection 173 | .TP 174 | .B C\-Y 175 | Paste from X clipboard 176 | .TP 177 | .B M\-b 178 | Move cursor to the start of the current word 179 | .TP 180 | .B M\-f 181 | Move cursor to the end of the current word 182 | .TP 183 | .B M\-g 184 | Home 185 | .TP 186 | .B M\-G 187 | End 188 | .TP 189 | .B M\-h 190 | Up 191 | .TP 192 | .B M\-j 193 | Page down 194 | .TP 195 | .B M\-k 196 | Page up 197 | .TP 198 | .B M\-l 199 | Down 200 | .SH SEE ALSO 201 | .IR dwm (1), 202 | .IR stest (1) 203 | -------------------------------------------------------------------------------- /dmenu-5.0/dmenu.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdpedersen1/void-suckless/e01b4cf76ec5fd12be8d9343140410cef355f425/dmenu-5.0/dmenu.o -------------------------------------------------------------------------------- /dmenu-5.0/dmenu_path: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cachedir="${XDG_CACHE_HOME:-"$HOME/.cache"}" 4 | cache="$cachedir/dmenu_run" 5 | 6 | [ ! -e "$cachedir" ] && mkdir -p "$cachedir" 7 | 8 | IFS=: 9 | if stest -dqr -n "$cache" $PATH; then 10 | stest -flx $PATH | sort -u | tee "$cache" 11 | else 12 | cat "$cache" 13 | fi 14 | -------------------------------------------------------------------------------- /dmenu-5.0/dmenu_run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | dmenu_path | dmenu "$@" | ${SHELL:-"/bin/sh"} & 3 | -------------------------------------------------------------------------------- /dmenu-5.0/drw.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "drw.h" 9 | #include "util.h" 10 | 11 | #define UTF_INVALID 0xFFFD 12 | #define UTF_SIZ 4 13 | 14 | static const unsigned char utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0}; 15 | static const unsigned char utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8}; 16 | static const long utfmin[UTF_SIZ + 1] = { 0, 0, 0x80, 0x800, 0x10000}; 17 | static const long utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF}; 18 | 19 | static long 20 | utf8decodebyte(const char c, size_t *i) 21 | { 22 | for (*i = 0; *i < (UTF_SIZ + 1); ++(*i)) 23 | if (((unsigned char)c & utfmask[*i]) == utfbyte[*i]) 24 | return (unsigned char)c & ~utfmask[*i]; 25 | return 0; 26 | } 27 | 28 | static size_t 29 | utf8validate(long *u, size_t i) 30 | { 31 | if (!BETWEEN(*u, utfmin[i], utfmax[i]) || BETWEEN(*u, 0xD800, 0xDFFF)) 32 | *u = UTF_INVALID; 33 | for (i = 1; *u > utfmax[i]; ++i) 34 | ; 35 | return i; 36 | } 37 | 38 | static size_t 39 | utf8decode(const char *c, long *u, size_t clen) 40 | { 41 | size_t i, j, len, type; 42 | long udecoded; 43 | 44 | *u = UTF_INVALID; 45 | if (!clen) 46 | return 0; 47 | udecoded = utf8decodebyte(c[0], &len); 48 | if (!BETWEEN(len, 1, UTF_SIZ)) 49 | return 1; 50 | for (i = 1, j = 1; i < clen && j < len; ++i, ++j) { 51 | udecoded = (udecoded << 6) | utf8decodebyte(c[i], &type); 52 | if (type) 53 | return j; 54 | } 55 | if (j < len) 56 | return 0; 57 | *u = udecoded; 58 | utf8validate(u, len); 59 | 60 | return len; 61 | } 62 | 63 | Drw * 64 | drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h) 65 | { 66 | Drw *drw = ecalloc(1, sizeof(Drw)); 67 | 68 | drw->dpy = dpy; 69 | drw->screen = screen; 70 | drw->root = root; 71 | drw->w = w; 72 | drw->h = h; 73 | drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen)); 74 | drw->gc = XCreateGC(dpy, root, 0, NULL); 75 | XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter); 76 | 77 | return drw; 78 | } 79 | 80 | void 81 | drw_resize(Drw *drw, unsigned int w, unsigned int h) 82 | { 83 | if (!drw) 84 | return; 85 | 86 | drw->w = w; 87 | drw->h = h; 88 | if (drw->drawable) 89 | XFreePixmap(drw->dpy, drw->drawable); 90 | drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen)); 91 | } 92 | 93 | void 94 | drw_free(Drw *drw) 95 | { 96 | XFreePixmap(drw->dpy, drw->drawable); 97 | XFreeGC(drw->dpy, drw->gc); 98 | drw_fontset_free(drw->fonts); 99 | free(drw); 100 | } 101 | 102 | /* This function is an implementation detail. Library users should use 103 | * drw_fontset_create instead. 104 | */ 105 | static Fnt * 106 | xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern) 107 | { 108 | Fnt *font; 109 | XftFont *xfont = NULL; 110 | FcPattern *pattern = NULL; 111 | 112 | if (fontname) { 113 | /* Using the pattern found at font->xfont->pattern does not yield the 114 | * same substitution results as using the pattern returned by 115 | * FcNameParse; using the latter results in the desired fallback 116 | * behaviour whereas the former just results in missing-character 117 | * rectangles being drawn, at least with some fonts. */ 118 | if (!(xfont = XftFontOpenName(drw->dpy, drw->screen, fontname))) { 119 | fprintf(stderr, "error, cannot load font from name: '%s'\n", fontname); 120 | return NULL; 121 | } 122 | if (!(pattern = FcNameParse((FcChar8 *) fontname))) { 123 | fprintf(stderr, "error, cannot parse font name to pattern: '%s'\n", fontname); 124 | XftFontClose(drw->dpy, xfont); 125 | return NULL; 126 | } 127 | } else if (fontpattern) { 128 | if (!(xfont = XftFontOpenPattern(drw->dpy, fontpattern))) { 129 | fprintf(stderr, "error, cannot load font from pattern.\n"); 130 | return NULL; 131 | } 132 | } else { 133 | die("no font specified."); 134 | } 135 | 136 | /* Do not allow using color fonts. This is a workaround for a BadLength 137 | * error from Xft with color glyphs. Modelled on the Xterm workaround. See 138 | * https://bugzilla.redhat.com/show_bug.cgi?id=1498269 139 | * https://lists.suckless.org/dev/1701/30932.html 140 | * https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916349 141 | * and lots more all over the internet. 142 | */ 143 | FcBool iscol; 144 | if(FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) { 145 | XftFontClose(drw->dpy, xfont); 146 | return NULL; 147 | } 148 | 149 | font = ecalloc(1, sizeof(Fnt)); 150 | font->xfont = xfont; 151 | font->pattern = pattern; 152 | font->h = xfont->ascent + xfont->descent; 153 | font->dpy = drw->dpy; 154 | 155 | return font; 156 | } 157 | 158 | static void 159 | xfont_free(Fnt *font) 160 | { 161 | if (!font) 162 | return; 163 | if (font->pattern) 164 | FcPatternDestroy(font->pattern); 165 | XftFontClose(font->dpy, font->xfont); 166 | free(font); 167 | } 168 | 169 | Fnt* 170 | drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount) 171 | { 172 | Fnt *cur, *ret = NULL; 173 | size_t i; 174 | 175 | if (!drw || !fonts) 176 | return NULL; 177 | 178 | for (i = 1; i <= fontcount; i++) { 179 | if ((cur = xfont_create(drw, fonts[fontcount - i], NULL))) { 180 | cur->next = ret; 181 | ret = cur; 182 | } 183 | } 184 | return (drw->fonts = ret); 185 | } 186 | 187 | void 188 | drw_fontset_free(Fnt *font) 189 | { 190 | if (font) { 191 | drw_fontset_free(font->next); 192 | xfont_free(font); 193 | } 194 | } 195 | 196 | void 197 | drw_clr_create(Drw *drw, Clr *dest, const char *clrname) 198 | { 199 | if (!drw || !dest || !clrname) 200 | return; 201 | 202 | if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen), 203 | DefaultColormap(drw->dpy, drw->screen), 204 | clrname, dest)) 205 | die("error, cannot allocate color '%s'", clrname); 206 | } 207 | 208 | /* Wrapper to create color schemes. The caller has to call free(3) on the 209 | * returned color scheme when done using it. */ 210 | Clr * 211 | drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount) 212 | { 213 | size_t i; 214 | Clr *ret; 215 | 216 | /* need at least two colors for a scheme */ 217 | if (!drw || !clrnames || clrcount < 2 || !(ret = ecalloc(clrcount, sizeof(XftColor)))) 218 | return NULL; 219 | 220 | for (i = 0; i < clrcount; i++) 221 | drw_clr_create(drw, &ret[i], clrnames[i]); 222 | return ret; 223 | } 224 | 225 | void 226 | drw_setfontset(Drw *drw, Fnt *set) 227 | { 228 | if (drw) 229 | drw->fonts = set; 230 | } 231 | 232 | void 233 | drw_setscheme(Drw *drw, Clr *scm) 234 | { 235 | if (drw) 236 | drw->scheme = scm; 237 | } 238 | 239 | void 240 | drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert) 241 | { 242 | if (!drw || !drw->scheme) 243 | return; 244 | XSetForeground(drw->dpy, drw->gc, invert ? drw->scheme[ColBg].pixel : drw->scheme[ColFg].pixel); 245 | if (filled) 246 | XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h); 247 | else 248 | XDrawRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w - 1, h - 1); 249 | } 250 | 251 | int 252 | drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert) 253 | { 254 | char buf[1024]; 255 | int ty; 256 | unsigned int ew; 257 | XftDraw *d = NULL; 258 | Fnt *usedfont, *curfont, *nextfont; 259 | size_t i, len; 260 | int utf8strlen, utf8charlen, render = x || y || w || h; 261 | long utf8codepoint = 0; 262 | const char *utf8str; 263 | FcCharSet *fccharset; 264 | FcPattern *fcpattern; 265 | FcPattern *match; 266 | XftResult result; 267 | int charexists = 0; 268 | 269 | if (!drw || (render && !drw->scheme) || !text || !drw->fonts) 270 | return 0; 271 | 272 | if (!render) { 273 | w = ~w; 274 | } else { 275 | XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel); 276 | XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h); 277 | d = XftDrawCreate(drw->dpy, drw->drawable, 278 | DefaultVisual(drw->dpy, drw->screen), 279 | DefaultColormap(drw->dpy, drw->screen)); 280 | x += lpad; 281 | w -= lpad; 282 | } 283 | 284 | usedfont = drw->fonts; 285 | while (1) { 286 | utf8strlen = 0; 287 | utf8str = text; 288 | nextfont = NULL; 289 | while (*text) { 290 | utf8charlen = utf8decode(text, &utf8codepoint, UTF_SIZ); 291 | for (curfont = drw->fonts; curfont; curfont = curfont->next) { 292 | charexists = charexists || XftCharExists(drw->dpy, curfont->xfont, utf8codepoint); 293 | if (charexists) { 294 | if (curfont == usedfont) { 295 | utf8strlen += utf8charlen; 296 | text += utf8charlen; 297 | } else { 298 | nextfont = curfont; 299 | } 300 | break; 301 | } 302 | } 303 | 304 | if (!charexists || nextfont) 305 | break; 306 | else 307 | charexists = 0; 308 | } 309 | 310 | if (utf8strlen) { 311 | drw_font_getexts(usedfont, utf8str, utf8strlen, &ew, NULL); 312 | /* shorten text if necessary */ 313 | for (len = MIN(utf8strlen, sizeof(buf) - 1); len && ew > w; len--) 314 | drw_font_getexts(usedfont, utf8str, len, &ew, NULL); 315 | 316 | if (len) { 317 | memcpy(buf, utf8str, len); 318 | buf[len] = '\0'; 319 | if (len < utf8strlen) 320 | for (i = len; i && i > len - 3; buf[--i] = '.') 321 | ; /* NOP */ 322 | 323 | if (render) { 324 | ty = y + (h - usedfont->h) / 2 + usedfont->xfont->ascent; 325 | XftDrawStringUtf8(d, &drw->scheme[invert ? ColBg : ColFg], 326 | usedfont->xfont, x, ty, (XftChar8 *)buf, len); 327 | } 328 | x += ew; 329 | w -= ew; 330 | } 331 | } 332 | 333 | if (!*text) { 334 | break; 335 | } else if (nextfont) { 336 | charexists = 0; 337 | usedfont = nextfont; 338 | } else { 339 | /* Regardless of whether or not a fallback font is found, the 340 | * character must be drawn. */ 341 | charexists = 1; 342 | 343 | fccharset = FcCharSetCreate(); 344 | FcCharSetAddChar(fccharset, utf8codepoint); 345 | 346 | if (!drw->fonts->pattern) { 347 | /* Refer to the comment in xfont_create for more information. */ 348 | die("the first font in the cache must be loaded from a font string."); 349 | } 350 | 351 | fcpattern = FcPatternDuplicate(drw->fonts->pattern); 352 | FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset); 353 | FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue); 354 | FcPatternAddBool(fcpattern, FC_COLOR, FcFalse); 355 | 356 | FcConfigSubstitute(NULL, fcpattern, FcMatchPattern); 357 | FcDefaultSubstitute(fcpattern); 358 | match = XftFontMatch(drw->dpy, drw->screen, fcpattern, &result); 359 | 360 | FcCharSetDestroy(fccharset); 361 | FcPatternDestroy(fcpattern); 362 | 363 | if (match) { 364 | usedfont = xfont_create(drw, NULL, match); 365 | if (usedfont && XftCharExists(drw->dpy, usedfont->xfont, utf8codepoint)) { 366 | for (curfont = drw->fonts; curfont->next; curfont = curfont->next) 367 | ; /* NOP */ 368 | curfont->next = usedfont; 369 | } else { 370 | xfont_free(usedfont); 371 | usedfont = drw->fonts; 372 | } 373 | } 374 | } 375 | } 376 | if (d) 377 | XftDrawDestroy(d); 378 | 379 | return x + (render ? w : 0); 380 | } 381 | 382 | void 383 | drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h) 384 | { 385 | if (!drw) 386 | return; 387 | 388 | XCopyArea(drw->dpy, drw->drawable, win, drw->gc, x, y, w, h, x, y); 389 | XSync(drw->dpy, False); 390 | } 391 | 392 | unsigned int 393 | drw_fontset_getwidth(Drw *drw, const char *text) 394 | { 395 | if (!drw || !drw->fonts || !text) 396 | return 0; 397 | return drw_text(drw, 0, 0, 0, 0, 0, text, 0); 398 | } 399 | 400 | void 401 | drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h) 402 | { 403 | XGlyphInfo ext; 404 | 405 | if (!font || !text) 406 | return; 407 | 408 | XftTextExtentsUtf8(font->dpy, font->xfont, (XftChar8 *)text, len, &ext); 409 | if (w) 410 | *w = ext.xOff; 411 | if (h) 412 | *h = font->h; 413 | } 414 | 415 | Cur * 416 | drw_cur_create(Drw *drw, int shape) 417 | { 418 | Cur *cur; 419 | 420 | if (!drw || !(cur = ecalloc(1, sizeof(Cur)))) 421 | return NULL; 422 | 423 | cur->cursor = XCreateFontCursor(drw->dpy, shape); 424 | 425 | return cur; 426 | } 427 | 428 | void 429 | drw_cur_free(Drw *drw, Cur *cursor) 430 | { 431 | if (!cursor) 432 | return; 433 | 434 | XFreeCursor(drw->dpy, cursor->cursor); 435 | free(cursor); 436 | } 437 | -------------------------------------------------------------------------------- /dmenu-5.0/drw.h: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | 3 | typedef struct { 4 | Cursor cursor; 5 | } Cur; 6 | 7 | typedef struct Fnt { 8 | Display *dpy; 9 | unsigned int h; 10 | XftFont *xfont; 11 | FcPattern *pattern; 12 | struct Fnt *next; 13 | } Fnt; 14 | 15 | enum { ColFg, ColBg }; /* Clr scheme index */ 16 | typedef XftColor Clr; 17 | 18 | typedef struct { 19 | unsigned int w, h; 20 | Display *dpy; 21 | int screen; 22 | Window root; 23 | Drawable drawable; 24 | GC gc; 25 | Clr *scheme; 26 | Fnt *fonts; 27 | } Drw; 28 | 29 | /* Drawable abstraction */ 30 | Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h); 31 | void drw_resize(Drw *drw, unsigned int w, unsigned int h); 32 | void drw_free(Drw *drw); 33 | 34 | /* Fnt abstraction */ 35 | Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount); 36 | void drw_fontset_free(Fnt* set); 37 | unsigned int drw_fontset_getwidth(Drw *drw, const char *text); 38 | void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h); 39 | 40 | /* Colorscheme abstraction */ 41 | void drw_clr_create(Drw *drw, Clr *dest, const char *clrname); 42 | Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount); 43 | 44 | /* Cursor abstraction */ 45 | Cur *drw_cur_create(Drw *drw, int shape); 46 | void drw_cur_free(Drw *drw, Cur *cursor); 47 | 48 | /* Drawing context manipulation */ 49 | void drw_setfontset(Drw *drw, Fnt *set); 50 | void drw_setscheme(Drw *drw, Clr *scm); 51 | 52 | /* Drawing functions */ 53 | void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert); 54 | int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert); 55 | 56 | /* Map functions */ 57 | void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h); 58 | -------------------------------------------------------------------------------- /dmenu-5.0/drw.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdpedersen1/void-suckless/e01b4cf76ec5fd12be8d9343140410cef355f425/dmenu-5.0/drw.o -------------------------------------------------------------------------------- /dmenu-5.0/stest: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdpedersen1/void-suckless/e01b4cf76ec5fd12be8d9343140410cef355f425/dmenu-5.0/stest -------------------------------------------------------------------------------- /dmenu-5.0/stest.1: -------------------------------------------------------------------------------- 1 | .TH STEST 1 dmenu\-VERSION 2 | .SH NAME 3 | stest \- filter a list of files by properties 4 | .SH SYNOPSIS 5 | .B stest 6 | .RB [ -abcdefghlpqrsuwx ] 7 | .RB [ -n 8 | .IR file ] 9 | .RB [ -o 10 | .IR file ] 11 | .RI [ file ...] 12 | .SH DESCRIPTION 13 | .B stest 14 | takes a list of files and filters by the files' properties, analogous to 15 | .IR test (1). 16 | Files which pass all tests are printed to stdout. If no files are given, stest 17 | reads files from stdin. 18 | .SH OPTIONS 19 | .TP 20 | .B \-a 21 | Test hidden files. 22 | .TP 23 | .B \-b 24 | Test that files are block specials. 25 | .TP 26 | .B \-c 27 | Test that files are character specials. 28 | .TP 29 | .B \-d 30 | Test that files are directories. 31 | .TP 32 | .B \-e 33 | Test that files exist. 34 | .TP 35 | .B \-f 36 | Test that files are regular files. 37 | .TP 38 | .B \-g 39 | Test that files have their set-group-ID flag set. 40 | .TP 41 | .B \-h 42 | Test that files are symbolic links. 43 | .TP 44 | .B \-l 45 | Test the contents of a directory given as an argument. 46 | .TP 47 | .BI \-n " file" 48 | Test that files are newer than 49 | .IR file . 50 | .TP 51 | .BI \-o " file" 52 | Test that files are older than 53 | .IR file . 54 | .TP 55 | .B \-p 56 | Test that files are named pipes. 57 | .TP 58 | .B \-q 59 | No files are printed, only the exit status is returned. 60 | .TP 61 | .B \-r 62 | Test that files are readable. 63 | .TP 64 | .B \-s 65 | Test that files are not empty. 66 | .TP 67 | .B \-u 68 | Test that files have their set-user-ID flag set. 69 | .TP 70 | .B \-v 71 | Invert the sense of tests, only failing files pass. 72 | .TP 73 | .B \-w 74 | Test that files are writable. 75 | .TP 76 | .B \-x 77 | Test that files are executable. 78 | .SH EXIT STATUS 79 | .TP 80 | .B 0 81 | At least one file passed all tests. 82 | .TP 83 | .B 1 84 | No files passed all tests. 85 | .TP 86 | .B 2 87 | An error occurred. 88 | .SH SEE ALSO 89 | .IR dmenu (1), 90 | .IR test (1) 91 | -------------------------------------------------------------------------------- /dmenu-5.0/stest.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "arg.h" 12 | char *argv0; 13 | 14 | #define FLAG(x) (flag[(x)-'a']) 15 | 16 | static void test(const char *, const char *); 17 | static void usage(void); 18 | 19 | static int match = 0; 20 | static int flag[26]; 21 | static struct stat old, new; 22 | 23 | static void 24 | test(const char *path, const char *name) 25 | { 26 | struct stat st, ln; 27 | 28 | if ((!stat(path, &st) && (FLAG('a') || name[0] != '.') /* hidden files */ 29 | && (!FLAG('b') || S_ISBLK(st.st_mode)) /* block special */ 30 | && (!FLAG('c') || S_ISCHR(st.st_mode)) /* character special */ 31 | && (!FLAG('d') || S_ISDIR(st.st_mode)) /* directory */ 32 | && (!FLAG('e') || access(path, F_OK) == 0) /* exists */ 33 | && (!FLAG('f') || S_ISREG(st.st_mode)) /* regular file */ 34 | && (!FLAG('g') || st.st_mode & S_ISGID) /* set-group-id flag */ 35 | && (!FLAG('h') || (!lstat(path, &ln) && S_ISLNK(ln.st_mode))) /* symbolic link */ 36 | && (!FLAG('n') || st.st_mtime > new.st_mtime) /* newer than file */ 37 | && (!FLAG('o') || st.st_mtime < old.st_mtime) /* older than file */ 38 | && (!FLAG('p') || S_ISFIFO(st.st_mode)) /* named pipe */ 39 | && (!FLAG('r') || access(path, R_OK) == 0) /* readable */ 40 | && (!FLAG('s') || st.st_size > 0) /* not empty */ 41 | && (!FLAG('u') || st.st_mode & S_ISUID) /* set-user-id flag */ 42 | && (!FLAG('w') || access(path, W_OK) == 0) /* writable */ 43 | && (!FLAG('x') || access(path, X_OK) == 0)) != FLAG('v')) { /* executable */ 44 | if (FLAG('q')) 45 | exit(0); 46 | match = 1; 47 | puts(name); 48 | } 49 | } 50 | 51 | static void 52 | usage(void) 53 | { 54 | fprintf(stderr, "usage: %s [-abcdefghlpqrsuvwx] " 55 | "[-n file] [-o file] [file...]\n", argv0); 56 | exit(2); /* like test(1) return > 1 on error */ 57 | } 58 | 59 | int 60 | main(int argc, char *argv[]) 61 | { 62 | struct dirent *d; 63 | char path[PATH_MAX], *line = NULL, *file; 64 | size_t linesiz = 0; 65 | ssize_t n; 66 | DIR *dir; 67 | int r; 68 | 69 | ARGBEGIN { 70 | case 'n': /* newer than file */ 71 | case 'o': /* older than file */ 72 | file = EARGF(usage()); 73 | if (!(FLAG(ARGC()) = !stat(file, (ARGC() == 'n' ? &new : &old)))) 74 | perror(file); 75 | break; 76 | default: 77 | /* miscellaneous operators */ 78 | if (strchr("abcdefghlpqrsuvwx", ARGC())) 79 | FLAG(ARGC()) = 1; 80 | else 81 | usage(); /* unknown flag */ 82 | } ARGEND; 83 | 84 | if (!argc) { 85 | /* read list from stdin */ 86 | while ((n = getline(&line, &linesiz, stdin)) > 0) { 87 | if (n && line[n - 1] == '\n') 88 | line[n - 1] = '\0'; 89 | test(line, line); 90 | } 91 | free(line); 92 | } else { 93 | for (; argc; argc--, argv++) { 94 | if (FLAG('l') && (dir = opendir(*argv))) { 95 | /* test directory contents */ 96 | while ((d = readdir(dir))) { 97 | r = snprintf(path, sizeof path, "%s/%s", 98 | *argv, d->d_name); 99 | if (r >= 0 && (size_t)r < sizeof path) 100 | test(path, d->d_name); 101 | } 102 | closedir(dir); 103 | } else { 104 | test(*argv, *argv); 105 | } 106 | } 107 | } 108 | return match ? 0 : 1; 109 | } 110 | -------------------------------------------------------------------------------- /dmenu-5.0/stest.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdpedersen1/void-suckless/e01b4cf76ec5fd12be8d9343140410cef355f425/dmenu-5.0/stest.o -------------------------------------------------------------------------------- /dmenu-5.0/util.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include "util.h" 8 | 9 | void * 10 | ecalloc(size_t nmemb, size_t size) 11 | { 12 | void *p; 13 | 14 | if (!(p = calloc(nmemb, size))) 15 | die("calloc:"); 16 | return p; 17 | } 18 | 19 | void 20 | die(const char *fmt, ...) { 21 | va_list ap; 22 | 23 | va_start(ap, fmt); 24 | vfprintf(stderr, fmt, ap); 25 | va_end(ap); 26 | 27 | if (fmt[0] && fmt[strlen(fmt)-1] == ':') { 28 | fputc(' ', stderr); 29 | perror(NULL); 30 | } else { 31 | fputc('\n', stderr); 32 | } 33 | 34 | exit(1); 35 | } 36 | -------------------------------------------------------------------------------- /dmenu-5.0/util.h: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | 3 | #define MAX(A, B) ((A) > (B) ? (A) : (B)) 4 | #define MIN(A, B) ((A) < (B) ? (A) : (B)) 5 | #define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B)) 6 | 7 | void die(const char *fmt, ...); 8 | void *ecalloc(size_t nmemb, size_t size); 9 | -------------------------------------------------------------------------------- /dmenu-5.0/util.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdpedersen1/void-suckless/e01b4cf76ec5fd12be8d9343140410cef355f425/dmenu-5.0/util.o -------------------------------------------------------------------------------- /dwm-6.2/LICENSE: -------------------------------------------------------------------------------- 1 | MIT/X Consortium License 2 | 3 | © 2006-2019 Anselm R Garbe 4 | © 2006-2009 Jukka Salmi 5 | © 2006-2007 Sander van Dijk 6 | © 2007-2011 Peter Hartlich 7 | © 2007-2009 Szabolcs Nagy 8 | © 2007-2009 Christof Musik 9 | © 2007-2009 Premysl Hruby 10 | © 2007-2008 Enno Gottox Boland 11 | © 2008 Martin Hurton 12 | © 2008 Neale Pickett 13 | © 2009 Mate Nagy 14 | © 2010-2016 Hiltjo Posthuma 15 | © 2010-2012 Connor Lane Smith 16 | © 2011 Christoph Lohmann <20h@r-36.net> 17 | © 2015-2016 Quentin Rameau 18 | © 2015-2016 Eric Pruitt 19 | © 2016-2017 Markus Teich 20 | 21 | Permission is hereby granted, free of charge, to any person obtaining a 22 | copy of this software and associated documentation files (the "Software"), 23 | to deal in the Software without restriction, including without limitation 24 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 25 | and/or sell copies of the Software, and to permit persons to whom the 26 | Software is furnished to do so, subject to the following conditions: 27 | 28 | The above copyright notice and this permission notice shall be included in 29 | all copies or substantial portions of the Software. 30 | 31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 33 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 34 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 35 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 36 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 37 | DEALINGS IN THE SOFTWARE. 38 | -------------------------------------------------------------------------------- /dwm-6.2/Makefile: -------------------------------------------------------------------------------- 1 | # dwm - dynamic window manager 2 | # See LICENSE file for copyright and license details. 3 | 4 | include config.mk 5 | 6 | SRC = drw.c dwm.c util.c 7 | OBJ = ${SRC:.c=.o} 8 | 9 | all: options dwm 10 | 11 | options: 12 | @echo dwm build options: 13 | @echo "CFLAGS = ${CFLAGS}" 14 | @echo "LDFLAGS = ${LDFLAGS}" 15 | @echo "CC = ${CC}" 16 | 17 | .c.o: 18 | ${CC} -c ${CFLAGS} $< 19 | 20 | ${OBJ}: config.h config.mk 21 | 22 | config.h: 23 | cp config.def.h $@ 24 | 25 | dwm: ${OBJ} 26 | ${CC} -o $@ ${OBJ} ${LDFLAGS} 27 | 28 | clean: 29 | rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz 30 | 31 | dist: clean 32 | mkdir -p dwm-${VERSION} 33 | cp -R LICENSE Makefile README config.def.h config.mk\ 34 | dwm.1 drw.h util.h ${SRC} dwm.png transient.c dwm-${VERSION} 35 | tar -cf dwm-${VERSION}.tar dwm-${VERSION} 36 | gzip dwm-${VERSION}.tar 37 | rm -rf dwm-${VERSION} 38 | 39 | install: all 40 | mkdir -p ${DESTDIR}${PREFIX}/bin 41 | cp -f dwm ${DESTDIR}${PREFIX}/bin 42 | chmod 755 ${DESTDIR}${PREFIX}/bin/dwm 43 | mkdir -p ${DESTDIR}${MANPREFIX}/man1 44 | sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1 45 | chmod 644 ${DESTDIR}${MANPREFIX}/man1/dwm.1 46 | 47 | uninstall: 48 | rm -f ${DESTDIR}${PREFIX}/bin/dwm\ 49 | ${DESTDIR}${MANPREFIX}/man1/dwm.1 50 | 51 | .PHONY: all options clean dist install uninstall 52 | -------------------------------------------------------------------------------- /dwm-6.2/README: -------------------------------------------------------------------------------- 1 | dwm - dynamic window manager 2 | ============================ 3 | dwm is an extremely fast, small, and dynamic window manager for X. 4 | 5 | 6 | Requirements 7 | ------------ 8 | In order to build dwm you need the Xlib header files. 9 | 10 | 11 | Installation 12 | ------------ 13 | Edit config.mk to match your local setup (dwm is installed into 14 | the /usr/local namespace by default). 15 | 16 | Afterwards enter the following command to build and install dwm (if 17 | necessary as root): 18 | 19 | make clean install 20 | 21 | 22 | Running dwm 23 | ----------- 24 | Add the following line to your .xinitrc to start dwm using startx: 25 | 26 | exec dwm 27 | 28 | In order to connect dwm to a specific display, make sure that 29 | the DISPLAY environment variable is set correctly, e.g.: 30 | 31 | DISPLAY=foo.bar:1 exec dwm 32 | 33 | (This will start dwm on display :1 of the host foo.bar.) 34 | 35 | In order to display status info in the bar, you can do something 36 | like this in your .xinitrc: 37 | 38 | while xsetroot -name "`date` `uptime | sed 's/.*,//'`" 39 | do 40 | sleep 1 41 | done & 42 | exec dwm 43 | 44 | 45 | Configuration 46 | ------------- 47 | The configuration of dwm is done by creating a custom config.h 48 | and (re)compiling the source code. 49 | -------------------------------------------------------------------------------- /dwm-6.2/config.def.h: -------------------------------------------------------------------------------- 1 | /* appearance */ 2 | static const unsigned int borderpx = 3; /* border pixel of windows */ 3 | static const unsigned int gappx = 5; /* gap pixel between windows */ 4 | static const unsigned int snap = 32; /* snap pixel */ 5 | static const int showbar = 1; /* 0 means no bar */ 6 | static const int topbar = 1; /* 0 means bottom bar */ 7 | /* Display modes of the tab bar: never shown, always shown, shown only in */ 8 | /* monocle mode in the presence of several windows. */ 9 | /* Modes after showtab_nmodes are disabled. */ 10 | enum showtab_modes { showtab_never, showtab_auto, showtab_nmodes, showtab_always}; 11 | static const int showtab = showtab_auto; /* Default tab bar show mode */ 12 | static const int toptab = False; /* False means bottom tab bar */ 13 | static const Bool viewontag = True; /* Switch view on tag switch */ 14 | static const int user_bh = 25; /* 0 means that dwm will calculate bar height, >= 1 means dwm will user_bh as bar height */ 15 | static const char *fonts[] = { "Hermit:size=12", "JoyPixels:pixelsize=14", "siji:pixelsize=14", "fontAwesome:size=14" }; 16 | static const char dmenufont[] = "monospace:size=10"; 17 | static const char col_gray1[] = "#222222"; 18 | static const char col_gray2[] = "#444444"; 19 | static const char col_gray3[] = "#bbbbbb"; 20 | static const char col_gray4[] = "#eeeeee"; 21 | static const char col_cyan[] = "#005577"; 22 | static const char col_black[] = "#000000"; 23 | static const char col_red[] = "#ff0000"; 24 | static const char col_yellow[] = "#ffff00"; 25 | static const char col_white[] = "#ffffff"; 26 | static const char col_grn[] = "#589072"; 27 | static const char col_grn2[] = "#10713c"; 28 | static const char col_blu[] = "#008080"; 29 | static const char *colors[][4] = { 30 | /* fg bg border float */ 31 | [SchemeNorm] = { col_gray3, col_black, col_gray1, col_black }, 32 | [SchemeSel] = { col_blu, col_black, col_blu, col_white }, 33 | [SchemeTitle] = { col_grn, col_black, col_black }, 34 | }; 35 | 36 | typedef struct { 37 | const char *name; 38 | const void *cmd; 39 | } Sp; 40 | const char *spcmd1[] = {"st", "-n", "spterm", "-g", "120x34", NULL }; 41 | const char *spcmd2[] = {"st", "-n", "spfm", "-g", "144x41", "-e", "ranger", NULL }; 42 | const char *spcmd3[] = {"mailspring", "-g", "41x144", NULL }; 43 | const char *spcmd4[] = {"st", "-n", "spmenu", "-g", "120x34", "-e", "./scripts/testmenu.sh", NULL }; 44 | const char *spcmd5[] = {"kitty", "-T", "spkeys", "--hold", "-e", "./.local/scripts/hotkeys.sh", NULL }; 45 | const char *spcmd6[] = {"st", "-n", "menu", "-g", "75x34", "-e", "./.local/scripts/launch.sh", NULL }; 46 | 47 | static Sp scratchpads[] = { 48 | /* name cmd */ 49 | {"spterm", spcmd1}, 50 | {"spranger", spcmd2}, 51 | {"mailspring", spcmd3}, 52 | {"sptestmenu.sh", spcmd4}, 53 | {"sphotkeys.sh", spcmd5}, 54 | {"menu", spcmd6}, 55 | }; 56 | 57 | /* tagging */ 58 | static const char *tags[] = { "\uf269", "\uf19d", "\uf121", "\uf07c", "\uf03d", "\uf15c", "\uf120", "\uf0e0", "\uf296" }; 59 | static const char *tagsalt[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; 60 | static const Rule rules[] = { 61 | /* xprop(1): 62 | * WM_CLASS(STRING) = instance, class 63 | * WM_NAME(STRING) = title 64 | */ 65 | /* class instance title tags mask isfloating monitor */ 66 | { "Gimp", NULL, NULL, 0, 0, -1 }, 67 | { "Firefox", NULL, NULL, 0, 0, -1 }, 68 | { "st", NULL, NULL, 0, 1, -1 }, 69 | { NULL, "spterm", NULL, SPTAG(0), 1, -1 }, 70 | { NULL, "spfm", NULL, SPTAG(1), 1, -1 }, 71 | { NULL, "mailspring", NULL, SPTAG(2), 1, -1 }, 72 | { NULL, "spmenu", NULL, SPTAG(3), 1, -1 }, 73 | { NULL, "spkeys", NULL, SPTAG(4), 1, -1 }, 74 | { NULL, "menu", NULL, SPTAG(5), 1, -1 }, 75 | }; 76 | 77 | /* layout(s) */ 78 | static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ 79 | static const int nmaster = 1; /* number of clients in master area */ 80 | static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */ 81 | 82 | static const Layout layouts[] = { 83 | /* symbol arrange function */ 84 | { "[]=", tile }, /* first entry is default */ 85 | { "><>", NULL }, /* no layout function means floating behavior */ 86 | { "[M]", monocle }, 87 | { "TTT", bstack }, 88 | { "===", bstackhoriz }, 89 | { NULL, NULL }, 90 | }; 91 | 92 | /* key definitions */ 93 | #define MODKEY Mod1Mask 94 | #define TAGKEYS(KEY,TAG) \ 95 | { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ 96 | { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ 97 | { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ 98 | { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, 99 | 100 | /* helper for spawning shell commands in the pre dwm-5.0 fashion */ 101 | #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } 102 | 103 | /* commands */ 104 | static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ 105 | static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_black, "-nf", col_gray3, "-sb", col_grn, "-sf", col_black, NULL }; 106 | static const char *termcmd[] = { "kitty", NULL }; 107 | static const char *layoutmenu_cmd = "layoutmenu.sh"; 108 | 109 | 110 | static Key keys[] = { 111 | /* modifier key function argument */ 112 | /* { MODKEY, XK_d, spawn, {.v = dmenucmd } },*/ 113 | { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, 114 | { MODKEY|ControlMask, XK_w, togglebar, {0} }, 115 | { MODKEY, XK_w, tabmode, {-1} }, 116 | { MODKEY, XK_j, focusstack, {.i = +1 } }, 117 | { MODKEY, XK_k, focusstack, {.i = -1 } }, 118 | { MODKEY|ControlMask, XK_i, incnmaster, {.i = +1 } }, 119 | { MODKEY|ControlMask, XK_d, incnmaster, {.i = -1 } }, 120 | { MODKEY, XK_h, setmfact, {.f = -0.05} }, 121 | { MODKEY, XK_l, setmfact, {.f = +0.05} }, 122 | { MODKEY|ControlMask, XK_Return, zoom, {0} }, 123 | { MODKEY, XK_Tab, view, {0} }, 124 | { MODKEY|ShiftMask, XK_q, killclient, {0} }, 125 | { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, 126 | { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, 127 | { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, 128 | { MODKEY, XK_u, setlayout, {.v = &layouts[3]} }, 129 | { MODKEY, XK_o, setlayout, {.v = &layouts[4]} }, 130 | { MODKEY|ControlMask, XK_comma, cyclelayout, {.i = -1 } }, 131 | { MODKEY|ControlMask, XK_period, cyclelayout, {.i = +1 } }, 132 | { MODKEY, XK_space, setlayout, {0} }, 133 | { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, 134 | { MODKEY|ShiftMask, XK_f, togglefullscr, {0} }, 135 | { MODKEY, XK_0, view, {.ui = ~0 } }, 136 | { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, 137 | { MODKEY, XK_comma, focusmon, {.i = -1 } }, 138 | { MODKEY, XK_period, focusmon, {.i = +1 } }, 139 | { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, 140 | { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, 141 | { MODKEY, XK_Left, viewtoleft, {0} }, 142 | { MODKEY, XK_Right, viewtoright, {0} }, 143 | { MODKEY|ShiftMask, XK_Left, tagtoleft, {0} }, 144 | { MODKEY|ShiftMask, XK_Right, tagtoright, {0} }, 145 | { MODKEY, XK_n, togglealttag, {0} }, 146 | { MODKEY, XK_Return, togglescratch, {.ui = 0 } }, 147 | { MODKEY, XK_r, togglescratch, {.ui = 1 } }, 148 | { MODKEY, XK_e, togglescratch, {.ui = 2 } }, 149 | { MODKEY, XK_c, togglescratch, {.ui = 3 } }, 150 | { MODKEY|ControlMask, XK_h, togglescratch, {.ui = 4 } }, 151 | { MODKEY|ShiftMask, XK_d, togglescratch, {.ui = 5 } }, 152 | TAGKEYS( XK_1, 0) 153 | TAGKEYS( XK_2, 1) 154 | TAGKEYS( XK_3, 2) 155 | TAGKEYS( XK_4, 3) 156 | TAGKEYS( XK_5, 4) 157 | TAGKEYS( XK_6, 5) 158 | TAGKEYS( XK_7, 6) 159 | TAGKEYS( XK_8, 7) 160 | TAGKEYS( XK_9, 8) 161 | { MODKEY|ShiftMask, XK_c, quit, {0} }, 162 | }; 163 | 164 | /* button definitions */ 165 | /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ 166 | static Button buttons[] = { 167 | /* click event mask button function argument */ 168 | { ClkLtSymbol, 0, Button1, setlayout, {0} }, 169 | { ClkLtSymbol, 0, Button3, layoutmenu, {0} }, 170 | { ClkWinTitle, 0, Button2, zoom, {0} }, 171 | { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, 172 | { ClkClientWin, MODKEY, Button1, movemouse, {0} }, 173 | { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, 174 | { ClkClientWin, MODKEY, Button1, resizemouse, {0} }, 175 | { ClkTagBar, 0, Button1, view, {0} }, 176 | { ClkTagBar, 0, Button3, toggleview, {0} }, 177 | { ClkTagBar, MODKEY, Button1, tag, {0} }, 178 | { ClkTagBar, MODKEY, Button3, toggletag, {0} }, 179 | { ClkTabBar, 0, Button1, focuswin, {0} }, 180 | }; 181 | 182 | -------------------------------------------------------------------------------- /dwm-6.2/config.h: -------------------------------------------------------------------------------- 1 | /* appearance */ 2 | static const unsigned int borderpx = 3; /* border pixel of windows */ 3 | static const unsigned int gappx = 5; /* gap pixel between windows */ 4 | static const unsigned int snap = 32; /* snap pixel */ 5 | static const int showbar = 1; /* 0 means no bar */ 6 | static const int topbar = 1; /* 0 means bottom bar */ 7 | /* Display modes of the tab bar: never shown, always shown, shown only in */ 8 | /* monocle mode in the presence of several windows. */ 9 | /* Modes after showtab_nmodes are disabled. */ 10 | enum showtab_modes { showtab_never, showtab_auto, showtab_nmodes, showtab_always}; 11 | static const int showtab = showtab_auto; /* Default tab bar show mode */ 12 | static const int toptab = False; /* False means bottom tab bar */ 13 | static const Bool viewontag = True; /* Switch view on tag switch */ 14 | static const int user_bh = 25; /* 0 means that dwm will calculate bar height, >= 1 means dwm will user_bh as bar height */ 15 | static const char *fonts[] = { "FantasqueSansMono:style=bold:size=12", "JoyPixels:pixelsize=14", "siji:pixelsize=14", "fontAwesome:size=14" }; 16 | static const char dmenufont[] = "monospace:size=10"; 17 | static const char col_gray1[] = "#222222"; 18 | static const char col_gray2[] = "#444444"; 19 | static const char col_gray3[] = "#bbbbbb"; 20 | static const char col_gray4[] = "#eeeeee"; 21 | static const char col_cyan[] = "#005577"; 22 | static const char col_black[] = "#000000"; 23 | static const char col_red[] = "#9b1e1c"; 24 | static const char col_yellow[] = "#ffff00"; 25 | static const char col_white[] = "#ffffff"; 26 | static const char col_grn[] = "#589072"; 27 | static const char col_grn2[] = "#10713c"; 28 | static const char col_blu[] = "#008080"; 29 | static const char *colors[][4] = { 30 | /* fg bg border float */ 31 | [SchemeNorm] = { col_gray3, col_black, col_gray1, col_black }, 32 | [SchemeSel] = { col_red, col_black, col_red, col_blu }, 33 | [SchemeTitle] = { col_blu, col_black, col_black }, 34 | }; 35 | 36 | typedef struct { 37 | const char *name; 38 | const void *cmd; 39 | } Sp; 40 | const char *spcmd1[] = {"st", "-n", "spterm", "-g", "120x34", NULL }; 41 | const char *spcmd2[] = {"st", "-n", "spfm", "-g", "144x41", "-e", "ranger", NULL }; 42 | const char *spcmd3[] = {"mailspring", "-g", "41x144", NULL }; 43 | const char *spcmd4[] = {"st", "-n", "spmenu", "-g", "120x34", "-e", "./scripts/testmenu.sh", NULL }; 44 | const char *spcmd5[] = {"kitty", "-T", "spkeys", "--hold", "-e", "./.local/scripts/hotkeys.sh", NULL }; 45 | const char *spcmd6[] = {"st", "-n", "menu", "-g", "75x34", "-e", "./.local/scripts/launch.sh", NULL }; 46 | 47 | static Sp scratchpads[] = { 48 | /* name cmd */ 49 | {"spterm", spcmd1}, 50 | {"spranger", spcmd2}, 51 | {"mailspring", spcmd3}, 52 | {"sptestmenu.sh", spcmd4}, 53 | {"sphotkeys.sh", spcmd5}, 54 | {"menu", spcmd6}, 55 | }; 56 | 57 | /* tagging */ 58 | static const char *tags[] = { "\uf269", "\uf19d", "\uf121", "\uf07c", "\uf03d", "\uf15c", "\uf120", "\uf0e0", "\uf296" }; 59 | static const char *tagsalt[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; 60 | static const Rule rules[] = { 61 | /* xprop(1): 62 | * WM_CLASS(STRING) = instance, class 63 | * WM_NAME(STRING) = title 64 | */ 65 | /* class instance title tags mask isfloating monitor */ 66 | { "Gimp", NULL, NULL, 0, 0, -1 }, 67 | { "Firefox", NULL, NULL, 0, 0, -1 }, 68 | { "st", NULL, NULL, 0, 1, -1 }, 69 | { NULL, "spterm", NULL, SPTAG(0), 1, -1 }, 70 | { NULL, "spfm", NULL, SPTAG(1), 1, -1 }, 71 | { NULL, "mailspring", NULL, SPTAG(2), 1, -1 }, 72 | { NULL, "spmenu", NULL, SPTAG(3), 1, -1 }, 73 | { NULL, "spkeys", NULL, SPTAG(4), 1, -1 }, 74 | { NULL, "menu", NULL, SPTAG(5), 1, -1 }, 75 | }; 76 | 77 | /* layout(s) */ 78 | static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ 79 | static const int nmaster = 1; /* number of clients in master area */ 80 | static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */ 81 | 82 | static const Layout layouts[] = { 83 | /* symbol arrange function */ 84 | { "[]=", tile }, /* first entry is default */ 85 | { "><>", NULL }, /* no layout function means floating behavior */ 86 | { "[M]", monocle }, 87 | { "TTT", bstack }, 88 | { "===", bstackhoriz }, 89 | { NULL, NULL }, 90 | }; 91 | 92 | /* key definitions */ 93 | #define MODKEY Mod1Mask 94 | #define TAGKEYS(KEY,TAG) \ 95 | { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ 96 | { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ 97 | { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ 98 | { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, 99 | 100 | /* helper for spawning shell commands in the pre dwm-5.0 fashion */ 101 | #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } 102 | 103 | /* commands */ 104 | static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ 105 | static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_black, "-nf", col_gray3, "-sb", col_grn, "-sf", col_black, NULL }; 106 | static const char *termcmd[] = { "alacritty", NULL }; 107 | static const char *layoutmenu_cmd = "layoutmenu.sh"; 108 | 109 | 110 | static Key keys[] = { 111 | /* modifier key function argument */ 112 | /* { MODKEY, XK_d, spawn, {.v = dmenucmd } },*/ 113 | { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, 114 | { MODKEY|ControlMask, XK_w, togglebar, {0} }, 115 | { MODKEY, XK_w, tabmode, {-1} }, 116 | { MODKEY, XK_j, focusstack, {.i = +1 } }, 117 | { MODKEY, XK_k, focusstack, {.i = -1 } }, 118 | { MODKEY|ControlMask, XK_i, incnmaster, {.i = +1 } }, 119 | { MODKEY|ControlMask, XK_d, incnmaster, {.i = -1 } }, 120 | { MODKEY, XK_h, setmfact, {.f = -0.05} }, 121 | { MODKEY, XK_l, setmfact, {.f = +0.05} }, 122 | { MODKEY|ControlMask, XK_Return, zoom, {0} }, 123 | { MODKEY, XK_Tab, view, {0} }, 124 | { MODKEY|ShiftMask, XK_q, killclient, {0} }, 125 | { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, 126 | { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, 127 | { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, 128 | { MODKEY, XK_u, setlayout, {.v = &layouts[3]} }, 129 | { MODKEY, XK_o, setlayout, {.v = &layouts[4]} }, 130 | { MODKEY|ControlMask, XK_comma, cyclelayout, {.i = -1 } }, 131 | { MODKEY|ControlMask, XK_period, cyclelayout, {.i = +1 } }, 132 | { MODKEY, XK_space, setlayout, {0} }, 133 | { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, 134 | { MODKEY|ShiftMask, XK_f, togglefullscr, {0} }, 135 | { MODKEY, XK_0, view, {.ui = ~0 } }, 136 | { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, 137 | { MODKEY, XK_comma, focusmon, {.i = -1 } }, 138 | { MODKEY, XK_period, focusmon, {.i = +1 } }, 139 | { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, 140 | { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, 141 | { MODKEY, XK_Left, viewtoleft, {0} }, 142 | { MODKEY, XK_Right, viewtoright, {0} }, 143 | { MODKEY|ShiftMask, XK_Left, tagtoleft, {0} }, 144 | { MODKEY|ShiftMask, XK_Right, tagtoright, {0} }, 145 | { MODKEY, XK_n, togglealttag, {0} }, 146 | { MODKEY, XK_Return, togglescratch, {.ui = 0 } }, 147 | { MODKEY, XK_r, togglescratch, {.ui = 1 } }, 148 | { MODKEY, XK_e, togglescratch, {.ui = 2 } }, 149 | { MODKEY, XK_c, togglescratch, {.ui = 3 } }, 150 | { MODKEY|ControlMask, XK_h, togglescratch, {.ui = 4 } }, 151 | { MODKEY|ShiftMask, XK_d, togglescratch, {.ui = 5 } }, 152 | TAGKEYS( XK_1, 0) 153 | TAGKEYS( XK_2, 1) 154 | TAGKEYS( XK_3, 2) 155 | TAGKEYS( XK_4, 3) 156 | TAGKEYS( XK_5, 4) 157 | TAGKEYS( XK_6, 5) 158 | TAGKEYS( XK_7, 6) 159 | TAGKEYS( XK_8, 7) 160 | TAGKEYS( XK_9, 8) 161 | { MODKEY|ShiftMask, XK_c, quit, {0} }, 162 | }; 163 | 164 | /* button definitions */ 165 | /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ 166 | static Button buttons[] = { 167 | /* click event mask button function argument */ 168 | { ClkLtSymbol, 0, Button1, setlayout, {0} }, 169 | { ClkLtSymbol, 0, Button3, layoutmenu, {0} }, 170 | { ClkWinTitle, 0, Button2, zoom, {0} }, 171 | { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, 172 | { ClkClientWin, MODKEY, Button1, movemouse, {0} }, 173 | { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, 174 | { ClkClientWin, MODKEY, Button1, resizemouse, {0} }, 175 | { ClkTagBar, 0, Button1, view, {0} }, 176 | { ClkTagBar, 0, Button3, toggleview, {0} }, 177 | { ClkTagBar, MODKEY, Button1, tag, {0} }, 178 | { ClkTagBar, MODKEY, Button3, toggletag, {0} }, 179 | { ClkTabBar, 0, Button1, focuswin, {0} }, 180 | }; 181 | 182 | -------------------------------------------------------------------------------- /dwm-6.2/config.mk: -------------------------------------------------------------------------------- 1 | # dwm version 2 | VERSION = 6.2 3 | 4 | # Customize below to fit your system 5 | 6 | # paths 7 | PREFIX = /usr/local 8 | MANPREFIX = ${PREFIX}/share/man 9 | 10 | X11INC = /usr/X11R6/include 11 | X11LIB = /usr/X11R6/lib 12 | 13 | # Xinerama, comment if you don't want it 14 | XINERAMALIBS = -lXinerama 15 | XINERAMAFLAGS = -DXINERAMA 16 | 17 | # freetype 18 | FREETYPELIBS = -lfontconfig -lXft 19 | FREETYPEINC = /usr/include/freetype2 20 | # OpenBSD (uncomment) 21 | #FREETYPEINC = ${X11INC}/freetype2 22 | 23 | # includes and libs 24 | INCS = -I${X11INC} -I${FREETYPEINC} 25 | LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} 26 | 27 | # flags 28 | CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} 29 | #CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS} 30 | CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS} 31 | LDFLAGS = ${LIBS} 32 | 33 | # Solaris 34 | #CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\" 35 | #LDFLAGS = ${LIBS} 36 | 37 | # compiler and linker 38 | CC = cc 39 | -------------------------------------------------------------------------------- /dwm-6.2/drw.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "drw.h" 9 | #include "util.h" 10 | 11 | #define UTF_INVALID 0xFFFD 12 | #define UTF_SIZ 4 13 | 14 | static const unsigned char utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0}; 15 | static const unsigned char utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8}; 16 | static const long utfmin[UTF_SIZ + 1] = { 0, 0, 0x80, 0x800, 0x10000}; 17 | static const long utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF}; 18 | 19 | static long 20 | utf8decodebyte(const char c, size_t *i) 21 | { 22 | for (*i = 0; *i < (UTF_SIZ + 1); ++(*i)) 23 | if (((unsigned char)c & utfmask[*i]) == utfbyte[*i]) 24 | return (unsigned char)c & ~utfmask[*i]; 25 | return 0; 26 | } 27 | 28 | static size_t 29 | utf8validate(long *u, size_t i) 30 | { 31 | if (!BETWEEN(*u, utfmin[i], utfmax[i]) || BETWEEN(*u, 0xD800, 0xDFFF)) 32 | *u = UTF_INVALID; 33 | for (i = 1; *u > utfmax[i]; ++i) 34 | ; 35 | return i; 36 | } 37 | 38 | static size_t 39 | utf8decode(const char *c, long *u, size_t clen) 40 | { 41 | size_t i, j, len, type; 42 | long udecoded; 43 | 44 | *u = UTF_INVALID; 45 | if (!clen) 46 | return 0; 47 | udecoded = utf8decodebyte(c[0], &len); 48 | if (!BETWEEN(len, 1, UTF_SIZ)) 49 | return 1; 50 | for (i = 1, j = 1; i < clen && j < len; ++i, ++j) { 51 | udecoded = (udecoded << 6) | utf8decodebyte(c[i], &type); 52 | if (type) 53 | return j; 54 | } 55 | if (j < len) 56 | return 0; 57 | *u = udecoded; 58 | utf8validate(u, len); 59 | 60 | return len; 61 | } 62 | 63 | Drw * 64 | drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h) 65 | { 66 | Drw *drw = ecalloc(1, sizeof(Drw)); 67 | 68 | drw->dpy = dpy; 69 | drw->screen = screen; 70 | drw->root = root; 71 | drw->w = w; 72 | drw->h = h; 73 | drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen)); 74 | drw->gc = XCreateGC(dpy, root, 0, NULL); 75 | XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter); 76 | 77 | return drw; 78 | } 79 | 80 | void 81 | drw_resize(Drw *drw, unsigned int w, unsigned int h) 82 | { 83 | if (!drw) 84 | return; 85 | 86 | drw->w = w; 87 | drw->h = h; 88 | if (drw->drawable) 89 | XFreePixmap(drw->dpy, drw->drawable); 90 | drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen)); 91 | } 92 | 93 | void 94 | drw_free(Drw *drw) 95 | { 96 | XFreePixmap(drw->dpy, drw->drawable); 97 | XFreeGC(drw->dpy, drw->gc); 98 | free(drw); 99 | } 100 | 101 | /* This function is an implementation detail. Library users should use 102 | * drw_fontset_create instead. 103 | */ 104 | static Fnt * 105 | xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern) 106 | { 107 | Fnt *font; 108 | XftFont *xfont = NULL; 109 | FcPattern *pattern = NULL; 110 | 111 | if (fontname) { 112 | /* Using the pattern found at font->xfont->pattern does not yield the 113 | * same substitution results as using the pattern returned by 114 | * FcNameParse; using the latter results in the desired fallback 115 | * behaviour whereas the former just results in missing-character 116 | * rectangles being drawn, at least with some fonts. */ 117 | if (!(xfont = XftFontOpenName(drw->dpy, drw->screen, fontname))) { 118 | fprintf(stderr, "error, cannot load font from name: '%s'\n", fontname); 119 | return NULL; 120 | } 121 | if (!(pattern = FcNameParse((FcChar8 *) fontname))) { 122 | fprintf(stderr, "error, cannot parse font name to pattern: '%s'\n", fontname); 123 | XftFontClose(drw->dpy, xfont); 124 | return NULL; 125 | } 126 | } else if (fontpattern) { 127 | if (!(xfont = XftFontOpenPattern(drw->dpy, fontpattern))) { 128 | fprintf(stderr, "error, cannot load font from pattern.\n"); 129 | return NULL; 130 | } 131 | } else { 132 | die("no font specified."); 133 | } 134 | 135 | /* Do not allow using color fonts. This is a workaround for a BadLength 136 | * error from Xft with color glyphs. Modelled on the Xterm workaround. See 137 | * https://bugzilla.redhat.com/show_bug.cgi?id=1498269 138 | * https://lists.suckless.org/dev/1701/30932.html 139 | * https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916349 140 | * and lots more all over the internet. 141 | */ 142 | FcBool iscol; 143 | if(FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) { 144 | XftFontClose(drw->dpy, xfont); 145 | return NULL; 146 | } 147 | 148 | font = ecalloc(1, sizeof(Fnt)); 149 | font->xfont = xfont; 150 | font->pattern = pattern; 151 | font->h = xfont->ascent + xfont->descent; 152 | font->dpy = drw->dpy; 153 | 154 | return font; 155 | } 156 | 157 | static void 158 | xfont_free(Fnt *font) 159 | { 160 | if (!font) 161 | return; 162 | if (font->pattern) 163 | FcPatternDestroy(font->pattern); 164 | XftFontClose(font->dpy, font->xfont); 165 | free(font); 166 | } 167 | 168 | Fnt* 169 | drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount) 170 | { 171 | Fnt *cur, *ret = NULL; 172 | size_t i; 173 | 174 | if (!drw || !fonts) 175 | return NULL; 176 | 177 | for (i = 1; i <= fontcount; i++) { 178 | if ((cur = xfont_create(drw, fonts[fontcount - i], NULL))) { 179 | cur->next = ret; 180 | ret = cur; 181 | } 182 | } 183 | return (drw->fonts = ret); 184 | } 185 | 186 | void 187 | drw_fontset_free(Fnt *font) 188 | { 189 | if (font) { 190 | drw_fontset_free(font->next); 191 | xfont_free(font); 192 | } 193 | } 194 | 195 | void 196 | drw_clr_create(Drw *drw, Clr *dest, const char *clrname) 197 | { 198 | if (!drw || !dest || !clrname) 199 | return; 200 | 201 | if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen), 202 | DefaultColormap(drw->dpy, drw->screen), 203 | clrname, dest)) 204 | die("error, cannot allocate color '%s'", clrname); 205 | } 206 | 207 | /* Wrapper to create color schemes. The caller has to call free(3) on the 208 | * returned color scheme when done using it. */ 209 | Clr * 210 | drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount) 211 | { 212 | size_t i; 213 | Clr *ret; 214 | 215 | /* need at least two colors for a scheme */ 216 | if (!drw || !clrnames || clrcount < 2 || !(ret = ecalloc(clrcount, sizeof(XftColor)))) 217 | return NULL; 218 | 219 | for (i = 0; i < clrcount; i++) 220 | drw_clr_create(drw, &ret[i], clrnames[i]); 221 | return ret; 222 | } 223 | 224 | void 225 | drw_setfontset(Drw *drw, Fnt *set) 226 | { 227 | if (drw) 228 | drw->fonts = set; 229 | } 230 | 231 | void 232 | drw_setscheme(Drw *drw, Clr *scm) 233 | { 234 | if (drw) 235 | drw->scheme = scm; 236 | } 237 | 238 | void 239 | drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert) 240 | { 241 | if (!drw || !drw->scheme) 242 | return; 243 | XSetForeground(drw->dpy, drw->gc, invert ? drw->scheme[ColBg].pixel : drw->scheme[ColFg].pixel); 244 | if (filled) 245 | XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h); 246 | else 247 | XDrawRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w - 1, h - 1); 248 | } 249 | 250 | int 251 | drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert) 252 | { 253 | char buf[1024]; 254 | int ty; 255 | unsigned int ew; 256 | XftDraw *d = NULL; 257 | Fnt *usedfont, *curfont, *nextfont; 258 | size_t i, len; 259 | int utf8strlen, utf8charlen, render = x || y || w || h; 260 | long utf8codepoint = 0; 261 | const char *utf8str; 262 | FcCharSet *fccharset; 263 | FcPattern *fcpattern; 264 | FcPattern *match; 265 | XftResult result; 266 | int charexists = 0; 267 | 268 | if (!drw || (render && !drw->scheme) || !text || !drw->fonts) 269 | return 0; 270 | 271 | if (!render) { 272 | w = ~w; 273 | } else { 274 | XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel); 275 | XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h); 276 | d = XftDrawCreate(drw->dpy, drw->drawable, 277 | DefaultVisual(drw->dpy, drw->screen), 278 | DefaultColormap(drw->dpy, drw->screen)); 279 | x += lpad; 280 | w -= lpad; 281 | } 282 | 283 | usedfont = drw->fonts; 284 | while (1) { 285 | utf8strlen = 0; 286 | utf8str = text; 287 | nextfont = NULL; 288 | while (*text) { 289 | utf8charlen = utf8decode(text, &utf8codepoint, UTF_SIZ); 290 | for (curfont = drw->fonts; curfont; curfont = curfont->next) { 291 | charexists = charexists || XftCharExists(drw->dpy, curfont->xfont, utf8codepoint); 292 | if (charexists) { 293 | if (curfont == usedfont) { 294 | utf8strlen += utf8charlen; 295 | text += utf8charlen; 296 | } else { 297 | nextfont = curfont; 298 | } 299 | break; 300 | } 301 | } 302 | 303 | if (!charexists || nextfont) 304 | break; 305 | else 306 | charexists = 0; 307 | } 308 | 309 | if (utf8strlen) { 310 | drw_font_getexts(usedfont, utf8str, utf8strlen, &ew, NULL); 311 | /* shorten text if necessary */ 312 | for (len = MIN(utf8strlen, sizeof(buf) - 1); len && ew > w; len--) 313 | drw_font_getexts(usedfont, utf8str, len, &ew, NULL); 314 | 315 | if (len) { 316 | memcpy(buf, utf8str, len); 317 | buf[len] = '\0'; 318 | if (len < utf8strlen) 319 | for (i = len; i && i > len - 3; buf[--i] = '.') 320 | ; /* NOP */ 321 | 322 | if (render) { 323 | ty = y + (h - usedfont->h) / 2 + usedfont->xfont->ascent; 324 | XftDrawStringUtf8(d, &drw->scheme[invert ? ColBg : ColFg], 325 | usedfont->xfont, x, ty, (XftChar8 *)buf, len); 326 | } 327 | x += ew; 328 | w -= ew; 329 | } 330 | } 331 | 332 | if (!*text) { 333 | break; 334 | } else if (nextfont) { 335 | charexists = 0; 336 | usedfont = nextfont; 337 | } else { 338 | /* Regardless of whether or not a fallback font is found, the 339 | * character must be drawn. */ 340 | charexists = 1; 341 | 342 | fccharset = FcCharSetCreate(); 343 | FcCharSetAddChar(fccharset, utf8codepoint); 344 | 345 | if (!drw->fonts->pattern) { 346 | /* Refer to the comment in xfont_create for more information. */ 347 | die("the first font in the cache must be loaded from a font string."); 348 | } 349 | 350 | fcpattern = FcPatternDuplicate(drw->fonts->pattern); 351 | FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset); 352 | FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue); 353 | FcPatternAddBool(fcpattern, FC_COLOR, FcFalse); 354 | 355 | FcConfigSubstitute(NULL, fcpattern, FcMatchPattern); 356 | FcDefaultSubstitute(fcpattern); 357 | match = XftFontMatch(drw->dpy, drw->screen, fcpattern, &result); 358 | 359 | FcCharSetDestroy(fccharset); 360 | FcPatternDestroy(fcpattern); 361 | 362 | if (match) { 363 | usedfont = xfont_create(drw, NULL, match); 364 | if (usedfont && XftCharExists(drw->dpy, usedfont->xfont, utf8codepoint)) { 365 | for (curfont = drw->fonts; curfont->next; curfont = curfont->next) 366 | ; /* NOP */ 367 | curfont->next = usedfont; 368 | } else { 369 | xfont_free(usedfont); 370 | usedfont = drw->fonts; 371 | } 372 | } 373 | } 374 | } 375 | if (d) 376 | XftDrawDestroy(d); 377 | 378 | return x + (render ? w : 0); 379 | } 380 | 381 | void 382 | drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h) 383 | { 384 | if (!drw) 385 | return; 386 | 387 | XCopyArea(drw->dpy, drw->drawable, win, drw->gc, x, y, w, h, x, y); 388 | XSync(drw->dpy, False); 389 | } 390 | 391 | unsigned int 392 | drw_fontset_getwidth(Drw *drw, const char *text) 393 | { 394 | if (!drw || !drw->fonts || !text) 395 | return 0; 396 | return drw_text(drw, 0, 0, 0, 0, 0, text, 0); 397 | } 398 | 399 | void 400 | drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h) 401 | { 402 | XGlyphInfo ext; 403 | 404 | if (!font || !text) 405 | return; 406 | 407 | XftTextExtentsUtf8(font->dpy, font->xfont, (XftChar8 *)text, len, &ext); 408 | if (w) 409 | *w = ext.xOff; 410 | if (h) 411 | *h = font->h; 412 | } 413 | 414 | Cur * 415 | drw_cur_create(Drw *drw, int shape) 416 | { 417 | Cur *cur; 418 | 419 | if (!drw || !(cur = ecalloc(1, sizeof(Cur)))) 420 | return NULL; 421 | 422 | cur->cursor = XCreateFontCursor(drw->dpy, shape); 423 | 424 | return cur; 425 | } 426 | 427 | void 428 | drw_cur_free(Drw *drw, Cur *cursor) 429 | { 430 | if (!cursor) 431 | return; 432 | 433 | XFreeCursor(drw->dpy, cursor->cursor); 434 | free(cursor); 435 | } 436 | -------------------------------------------------------------------------------- /dwm-6.2/drw.h: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | 3 | typedef struct { 4 | Cursor cursor; 5 | } Cur; 6 | 7 | typedef struct Fnt { 8 | Display *dpy; 9 | unsigned int h; 10 | XftFont *xfont; 11 | FcPattern *pattern; 12 | struct Fnt *next; 13 | } Fnt; 14 | 15 | enum { ColFg, ColBg, ColBorder }; /* Clr scheme index */ 16 | typedef XftColor Clr; 17 | 18 | typedef struct { 19 | unsigned int w, h; 20 | Display *dpy; 21 | int screen; 22 | Window root; 23 | Drawable drawable; 24 | GC gc; 25 | Clr *scheme; 26 | Fnt *fonts; 27 | } Drw; 28 | 29 | /* Drawable abstraction */ 30 | Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h); 31 | void drw_resize(Drw *drw, unsigned int w, unsigned int h); 32 | void drw_free(Drw *drw); 33 | 34 | /* Fnt abstraction */ 35 | Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount); 36 | void drw_fontset_free(Fnt* set); 37 | unsigned int drw_fontset_getwidth(Drw *drw, const char *text); 38 | void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h); 39 | 40 | /* Colorscheme abstraction */ 41 | void drw_clr_create(Drw *drw, Clr *dest, const char *clrname); 42 | Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount); 43 | 44 | /* Cursor abstraction */ 45 | Cur *drw_cur_create(Drw *drw, int shape); 46 | void drw_cur_free(Drw *drw, Cur *cursor); 47 | 48 | /* Drawing context manipulation */ 49 | void drw_setfontset(Drw *drw, Fnt *set); 50 | void drw_setscheme(Drw *drw, Clr *scm); 51 | 52 | /* Drawing functions */ 53 | void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert); 54 | int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert); 55 | 56 | /* Map functions */ 57 | void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h); 58 | -------------------------------------------------------------------------------- /dwm-6.2/drw.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdpedersen1/void-suckless/e01b4cf76ec5fd12be8d9343140410cef355f425/dwm-6.2/drw.o -------------------------------------------------------------------------------- /dwm-6.2/dwm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdpedersen1/void-suckless/e01b4cf76ec5fd12be8d9343140410cef355f425/dwm-6.2/dwm -------------------------------------------------------------------------------- /dwm-6.2/dwm.1: -------------------------------------------------------------------------------- 1 | .TH DWM 1 dwm\-VERSION 2 | .SH NAME 3 | dwm \- dynamic window manager 4 | .SH SYNOPSIS 5 | .B dwm 6 | .RB [ \-v ] 7 | .SH DESCRIPTION 8 | dwm is a dynamic window manager for X. It manages windows in tiled, monocle 9 | and floating layouts. Either layout can be applied dynamically, optimising the 10 | environment for the application in use and the task performed. 11 | .P 12 | In tiled layouts windows are managed in a master and stacking area. The master 13 | area on the left contains one window by default, and the stacking area on the 14 | right contains all other windows. The number of master area windows can be 15 | adjusted from zero to an arbitrary number. In monocle layout all windows are 16 | maximised to the screen size. In floating layout windows can be resized and 17 | moved freely. Dialog windows are always managed floating, regardless of the 18 | layout applied. 19 | .P 20 | Windows are grouped by tags. Each window can be tagged with one or multiple 21 | tags. Selecting certain tags displays all windows with these tags. 22 | .P 23 | Each screen contains two small status bars. 24 | .P 25 | One bar displays all available tags, the layout, the title of the focused 26 | window, and the text read from the root window name property, if the screen is 27 | focused. A floating window is indicated with an empty square and a maximised 28 | floating window is indicated with a filled square before the windows title. The 29 | selected tags are indicated with a different color. The tags of the focused 30 | window are indicated with a filled square in the top left corner. The tags 31 | which are applied to one or more windows are indicated with an empty square in 32 | the top left corner. 33 | .P 34 | Another bar contains a tab for each window of the current view and allows 35 | navigation between windows, especially in the monocle mode. The different 36 | display modes of this bar are described under the Mod1\-w Keybord command 37 | section. When a single tag is selected, this tag is indicated in the left corner 38 | of the tab bar. 39 | .P 40 | dwm draws a small border around windows to indicate the focus state. 41 | .P 42 | On start, dwm can start additional programs that may be specified in two special 43 | shell scripts (see the FILES section below), autostart_blocking.sh and 44 | autostart.sh. The former is executed first and dwm will wait for its 45 | termination before starting. The latter is executed in the background before 46 | dwm enters its handler loop. 47 | .P 48 | Either of these files may be omitted. 49 | .SH OPTIONS 50 | .TP 51 | .B \-v 52 | prints version information to standard output, then exits. 53 | .SH USAGE 54 | .SS Status bar 55 | .TP 56 | .B X root window name 57 | is read and displayed in the status text area. It can be set with the 58 | .BR xsetroot (1) 59 | command. 60 | .TP 61 | .B Button1 62 | click on a tag label to display all windows with that tag, click on the layout 63 | label toggles between tiled and floating layout, click on a window name in the 64 | tab bar brings focus to that window. 65 | .TP 66 | .B Button3 67 | click on a tag label adds/removes all windows with that tag to/from the view. 68 | .TP 69 | .B Mod1\-Button1 70 | click on a tag label applies that tag to the focused window. 71 | .TP 72 | .B Mod1\-Button3 73 | click on a tag label adds/removes that tag to/from the focused window. 74 | .SS Keyboard commands 75 | .TP 76 | .B Mod1\-Shift\-Return 77 | Start 78 | .BR st(1). 79 | .TP 80 | .B Mod1\-p 81 | Spawn 82 | .BR dmenu(1) 83 | for launching other programs. 84 | .TP 85 | .B Mod1\-, 86 | Focus previous screen, if any. 87 | .TP 88 | .B Mod1\-. 89 | Focus next screen, if any. 90 | .TP 91 | .B Mod1\-Shift\-, 92 | Send focused window to previous screen, if any. 93 | .TP 94 | .B Mod1\-Shift\-. 95 | Send focused window to next screen, if any. 96 | .TP 97 | .B Mod1\-Right 98 | Focus tag on the right, if any. 99 | .TP 100 | .B Mod1\-Left 101 | Focus tag on the left, if any. 102 | .TP 103 | .B Mod1\-Shift\-Right 104 | Send focused window to tag on the right, if any. 105 | .TP 106 | .B Mod1\-Shift\-Left 107 | Send focused window to tag on the left, if any. 108 | .TP 109 | .B Mod1\-b 110 | Toggles bar on and off. 111 | .TP 112 | .B Mod1\-t 113 | Sets tiled layout. 114 | .TP 115 | .B Mod1\-f 116 | Sets floating layout. 117 | .TP 118 | .B Mod1\-m 119 | Sets monocle layout. 120 | .TP 121 | .B Mod1\-space 122 | Toggles between current and previous layout. 123 | .TP 124 | .B Mod1\-Control\-, 125 | Cycles backwards in layout list. 126 | .TP 127 | .B Mod1\-Control\-. 128 | Cycles forwards in layout list. 129 | .TP 130 | .B Mod1\-j 131 | Focus next window. 132 | .TP 133 | .B Mod1\-k 134 | Focus previous window. 135 | .TP 136 | .B Mod1\-i 137 | Increase number of windows in master area. 138 | .TP 139 | .B Mod1\-d 140 | Decrease number of windows in master area. 141 | .TP 142 | .B Mod1\-l 143 | Increase master area size. 144 | .TP 145 | .B Mod1\-h 146 | Decrease master area size. 147 | .TP 148 | .B Mod1\-w 149 | Cycle over the tab bar display modes: never displayed, always displayed, 150 | displayed only in monocle mode when the view contains more than one window (auto 151 | mode). Some display modes can be disabled in the configuration, config.h. In 152 | the default configuration only "never" and "auto" display modes are enabled. 153 | .TP 154 | .B Mod1\-Return 155 | Zooms/cycles focused window to/from master area (tiled layouts only). 156 | .TP 157 | .B Mod1\-Shift\-c 158 | Close focused window. 159 | .TP 160 | .B Mod1\-Shift\-space 161 | Toggle focused window between tiled and floating state. 162 | .TP 163 | .B Mod1\-Tab 164 | Toggles to the previously selected tags. 165 | .TP 166 | .B Mod1\-Shift\-[1..n] 167 | Apply nth tag to focused window. 168 | .TP 169 | .B Mod1\-Shift\-0 170 | Apply all tags to focused window. 171 | .TP 172 | .B Mod1\-Control\-Shift\-[1..n] 173 | Add/remove nth tag to/from focused window. 174 | .TP 175 | .B Mod1\-[1..n] 176 | View all windows with nth tag. 177 | .TP 178 | .B Mod1\-0 179 | View all windows with any tag. 180 | .TP 181 | .B Mod1\-Control\-[1..n] 182 | Add/remove all windows with nth tag to/from the view. 183 | .TP 184 | .B Mod1\-Shift\-q 185 | Quit dwm. 186 | .SS Mouse commands 187 | .TP 188 | .B Mod1\-Button1 189 | Move focused window while dragging. Tiled windows will be toggled to the floating state. 190 | .TP 191 | .B Mod1\-Button2 192 | Toggles focused window between floating and tiled state. 193 | .TP 194 | .B Mod1\-Button3 195 | Resize focused window while dragging. Tiled windows will be toggled to the floating state. 196 | .SH FILES 197 | The files containing programs to be started along with dwm are searched for in 198 | the following directories: 199 | .IP "1. $XDG_DATA_HOME/dwm" 200 | .IP "2. $HOME/.local/share/dwm" 201 | .IP "3. $HOME/.dwm" 202 | .P 203 | The first existing directory is scanned for any of the autostart files below. 204 | .TP 15 205 | autostart.sh 206 | This file is started as a shell background process before dwm enters its handler 207 | loop. 208 | .TP 15 209 | autostart_blocking.sh 210 | This file is started before any autostart.sh; dwm waits for its termination. 211 | .SH CUSTOMIZATION 212 | dwm is customized by creating a custom config.h and (re)compiling the source 213 | code. This keeps it fast, secure and simple. 214 | .SH SEE ALSO 215 | .BR dmenu (1), 216 | .BR st (1) 217 | .SH ISSUES 218 | Java applications which use the XToolkit/XAWT backend may draw grey windows 219 | only. The XToolkit/XAWT backend breaks ICCCM-compliance in recent JDK 1.5 and early 220 | JDK 1.6 versions, because it assumes a reparenting window manager. Possible workarounds 221 | are using JDK 1.4 (which doesn't contain the XToolkit/XAWT backend) or setting the 222 | environment variable 223 | .BR AWT_TOOLKIT=MToolkit 224 | (to use the older Motif backend instead) or running 225 | .B xprop -root -f _NET_WM_NAME 32a -set _NET_WM_NAME LG3D 226 | or 227 | .B wmname LG3D 228 | (to pretend that a non-reparenting window manager is running that the 229 | XToolkit/XAWT backend can recognize) or when using OpenJDK setting the environment variable 230 | .BR _JAVA_AWT_WM_NONREPARENTING=1 . 231 | .SH BUGS 232 | Send all bug reports with a patch to hackers@suckless.org. 233 | -------------------------------------------------------------------------------- /dwm-6.2/dwm.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdpedersen1/void-suckless/e01b4cf76ec5fd12be8d9343140410cef355f425/dwm-6.2/dwm.o -------------------------------------------------------------------------------- /dwm-6.2/dwm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdpedersen1/void-suckless/e01b4cf76ec5fd12be8d9343140410cef355f425/dwm-6.2/dwm.png -------------------------------------------------------------------------------- /dwm-6.2/layoutmenu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cat <<> Floating Layout 1 6 | [M] Monocle Layout 2 7 | EOF 8 | -------------------------------------------------------------------------------- /dwm-6.2/transient.c: -------------------------------------------------------------------------------- 1 | /* cc transient.c -o transient -lX11 */ 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | int main(void) { 9 | Display *d; 10 | Window r, f, t = None; 11 | XSizeHints h; 12 | XEvent e; 13 | 14 | d = XOpenDisplay(NULL); 15 | if (!d) 16 | exit(1); 17 | r = DefaultRootWindow(d); 18 | 19 | f = XCreateSimpleWindow(d, r, 100, 100, 400, 400, 0, 0, 0); 20 | h.min_width = h.max_width = h.min_height = h.max_height = 400; 21 | h.flags = PMinSize | PMaxSize; 22 | XSetWMNormalHints(d, f, &h); 23 | XStoreName(d, f, "floating"); 24 | XMapWindow(d, f); 25 | 26 | XSelectInput(d, f, ExposureMask); 27 | while (1) { 28 | XNextEvent(d, &e); 29 | 30 | if (t == None) { 31 | sleep(5); 32 | t = XCreateSimpleWindow(d, r, 50, 50, 100, 100, 0, 0, 0); 33 | XSetTransientForHint(d, t, f); 34 | XStoreName(d, t, "transient"); 35 | XMapWindow(d, t); 36 | XSelectInput(d, t, ExposureMask); 37 | } 38 | } 39 | 40 | XCloseDisplay(d); 41 | exit(0); 42 | } 43 | -------------------------------------------------------------------------------- /dwm-6.2/util.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include "util.h" 8 | 9 | void * 10 | ecalloc(size_t nmemb, size_t size) 11 | { 12 | void *p; 13 | 14 | if (!(p = calloc(nmemb, size))) 15 | die("calloc:"); 16 | return p; 17 | } 18 | 19 | void 20 | die(const char *fmt, ...) { 21 | va_list ap; 22 | 23 | va_start(ap, fmt); 24 | vfprintf(stderr, fmt, ap); 25 | va_end(ap); 26 | 27 | if (fmt[0] && fmt[strlen(fmt)-1] == ':') { 28 | fputc(' ', stderr); 29 | perror(NULL); 30 | } else { 31 | fputc('\n', stderr); 32 | } 33 | 34 | exit(1); 35 | } 36 | -------------------------------------------------------------------------------- /dwm-6.2/util.h: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | 3 | #define MAX(A, B) ((A) > (B) ? (A) : (B)) 4 | #define MIN(A, B) ((A) < (B) ? (A) : (B)) 5 | #define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B)) 6 | 7 | void die(const char *fmt, ...); 8 | void *ecalloc(size_t nmemb, size_t size); 9 | -------------------------------------------------------------------------------- /dwm-6.2/util.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdpedersen1/void-suckless/e01b4cf76ec5fd12be8d9343140410cef355f425/dwm-6.2/util.o -------------------------------------------------------------------------------- /dwmblocks/.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Object files 5 | *.o 6 | *.ko 7 | *.obj 8 | *.elf 9 | 10 | # Linker output 11 | *.ilk 12 | *.map 13 | *.exp 14 | 15 | # Precompiled Headers 16 | *.gch 17 | *.pch 18 | 19 | # Libraries 20 | *.lib 21 | *.a 22 | *.la 23 | *.lo 24 | 25 | # Shared objects (inc. Windows DLLs) 26 | *.dll 27 | *.so 28 | *.so.* 29 | *.dylib 30 | 31 | # Executables 32 | *.exe 33 | *.out 34 | *.app 35 | *.i*86 36 | *.x86_64 37 | *.hex 38 | dwmblocks 39 | 40 | # Debug files 41 | *.dSYM/ 42 | *.su 43 | *.idb 44 | *.pdb 45 | 46 | # Kernel Module Compile Results 47 | *.mod* 48 | *.cmd 49 | .tmp_versions/ 50 | modules.order 51 | Module.symvers 52 | Mkfile.old 53 | dkms.conf 54 | -------------------------------------------------------------------------------- /dwmblocks/LICENSE: -------------------------------------------------------------------------------- 1 | ISC License (ISC) 2 | 3 | Copyright 2020 torrinfail 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 8 | -------------------------------------------------------------------------------- /dwmblocks/Makefile: -------------------------------------------------------------------------------- 1 | PREFIX ?= /usr/local 2 | CC ?= cc 3 | output: dwmblocks.c blocks.h 4 | ${CC} dwmblocks.c `pkg-config --cflags x11` `pkg-config --libs x11` -o dwmblocks 5 | clean: 6 | rm -f *.o *.gch dwmblocks 7 | install: output 8 | mkdir -p $(DESTDIR)$(PREFIX)/bin 9 | cp -f dwmblocks $(DESTDIR)$(PREFIX)/bin 10 | chmod 755 $(DESTDIR)$(PREFIX)/bin/dwmblocks 11 | uninstall: 12 | rm -f $(DESTDIR)$(PREFIX)/bin/dwmblocks 13 | -------------------------------------------------------------------------------- /dwmblocks/README.md: -------------------------------------------------------------------------------- 1 | # dwmblocks 2 | Modular status bar for dwm written in c. 3 | # modifying blocks 4 | The statusbar is made from text output from commandline programs. 5 | Blocks are added and removed by editing the blocks.h header file. 6 | -------------------------------------------------------------------------------- /dwmblocks/blks: -------------------------------------------------------------------------------- 1 | //Modify this file to change what commands output to your statusbar, and recompile using the make command. 2 | static const Block blocks[] = { 3 | /*Icon*/ /*Command*/ /*Update Interval*/ /*Update Signal*/ 4 | {" ⚙ ", "pacupdate", 3600, 9}, 5 | 6 | /*{" 🧠 ", "free -h | awk '/^Mem/ { print $3\"/\"$2 }' | sed s/i//g" , 30, 0},*/ 7 | 8 | {" ", "web", 10, 0}, 9 | 10 | /*{" 🔊 ", "volume", 1, 10}, */ 11 | {" ", "volume", 1, 10}, 12 | 13 | {" ", "weather" , 3600, 11}, 14 | 15 | {" ", "battery" , 5, 0}, 16 | 17 | /* {"🌡", "sensors | awk '/^temp1:/{print $2}'", 5, 0},*/ 18 | 19 | {" 🎸 ", "audio", 2, 0}, 20 | 21 | {" 📆 ", "clock", 5, 0}, 22 | 23 | }; 24 | 25 | //sets delimeter between status commands. NULL character ('\0') means no delimeter. 26 | static char delim = '|'; 27 | -------------------------------------------------------------------------------- /dwmblocks/blocks.h: -------------------------------------------------------------------------------- 1 | //Modify this file to change what commands output to your statusbar, and recompile using the make command. 2 | static const Block blocks[] = { 3 | /*Icon*/ /*Command*/ /*Update Interval*/ /*Update Signal*/ 4 | //{"  ", "audio", 1, 0}, 5 | 6 | {"  ", "vol", 1, 10}, 7 | 8 | /*{"  ", "cat /sys/class/power_supply/BAT0/capacity", 5, 0},*/ 9 | 10 | {" ", "battery", 300, 0}, 11 | 12 | {" ", "weather3", 60, 0}, 13 | 14 | {"  ", "clock", 30, 0}, 15 | 16 | {"  ", "pacupdate", 3600, 9}, 17 | 18 | {" ", "web2", 30, 0}, 19 | 20 | }; 21 | 22 | //sets delimeter between status commands. NULL character ('\0') means no delimeter. 23 | static char delim = ' | '; 24 | -------------------------------------------------------------------------------- /dwmblocks/dwmblocks.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #define LENGTH(X) (sizeof(X) / sizeof (X[0])) 8 | #define CMDLENGTH 50 9 | 10 | typedef struct { 11 | char* icon; 12 | char* command; 13 | unsigned int interval; 14 | unsigned int signal; 15 | } Block; 16 | void dummysighandler(int num); 17 | void sighandler(int num); 18 | void getcmds(int time); 19 | #ifndef __OpenBSD__ 20 | void getsigcmds(int signal); 21 | void setupsignals(); 22 | void sighandler(int signum); 23 | #endif 24 | int getstatus(char *str, char *last); 25 | void setroot(); 26 | void statusloop(); 27 | void termhandler(int signum); 28 | 29 | 30 | #include "blocks.h" 31 | 32 | static Display *dpy; 33 | static int screen; 34 | static Window root; 35 | static char statusbar[LENGTH(blocks)][CMDLENGTH] = {0}; 36 | static char statusstr[2][256]; 37 | static int statusContinue = 1; 38 | static void (*writestatus) () = setroot; 39 | 40 | //opens process *cmd and stores output in *output 41 | void getcmd(const Block *block, char *output) 42 | { 43 | strcpy(output, block->icon); 44 | char *cmd = block->command; 45 | FILE *cmdf = popen(cmd,"r"); 46 | if (!cmdf) 47 | return; 48 | char c; 49 | int i = strlen(block->icon); 50 | fgets(output+i, CMDLENGTH-i, cmdf); 51 | i = strlen(output); 52 | if (delim != '\0' && --i) 53 | output[i++] = delim; 54 | output[i++] = '\0'; 55 | pclose(cmdf); 56 | } 57 | 58 | void getcmds(int time) 59 | { 60 | const Block* current; 61 | for(int i = 0; i < LENGTH(blocks); i++) 62 | { 63 | current = blocks + i; 64 | if ((current->interval != 0 && time % current->interval == 0) || time == -1) 65 | getcmd(current,statusbar[i]); 66 | } 67 | } 68 | 69 | #ifndef __OpenBSD__ 70 | void getsigcmds(int signal) 71 | { 72 | const Block *current; 73 | for (int i = 0; i < LENGTH(blocks); i++) 74 | { 75 | current = blocks + i; 76 | if (current->signal == signal) 77 | getcmd(current,statusbar[i]); 78 | } 79 | } 80 | 81 | void setupsignals() 82 | { 83 | /* initialize all real time signals with dummy handler */ 84 | for(int i = SIGRTMIN; i <= SIGRTMAX; i++) 85 | signal(i, dummysighandler); 86 | 87 | for(int i = 0; i < LENGTH(blocks); i++) 88 | { 89 | if (blocks[i].signal > 0) 90 | signal(SIGRTMIN+blocks[i].signal, sighandler); 91 | } 92 | 93 | } 94 | #endif 95 | 96 | int getstatus(char *str, char *last) 97 | { 98 | strcpy(last, str); 99 | str[0] = '\0'; 100 | for(int i = 0; i < LENGTH(blocks); i++) 101 | strcat(str, statusbar[i]); 102 | str[strlen(str)-1] = '\0'; 103 | return strcmp(str, last);//0 if they are the same 104 | } 105 | 106 | void setroot() 107 | { 108 | if (!getstatus(statusstr[0], statusstr[1]))//Only set root if text has changed. 109 | return; 110 | Display *d = XOpenDisplay(NULL); 111 | if (d) { 112 | dpy = d; 113 | } 114 | screen = DefaultScreen(dpy); 115 | root = RootWindow(dpy, screen); 116 | XStoreName(dpy, root, statusstr[0]); 117 | XCloseDisplay(dpy); 118 | } 119 | 120 | void pstdout() 121 | { 122 | if (!getstatus(statusstr[0], statusstr[1]))//Only write out if text has changed. 123 | return; 124 | printf("%s\n",statusstr[0]); 125 | fflush(stdout); 126 | } 127 | 128 | 129 | void statusloop() 130 | { 131 | #ifndef __OpenBSD__ 132 | setupsignals(); 133 | #endif 134 | int i = 0; 135 | getcmds(-1); 136 | while(statusContinue) 137 | { 138 | getcmds(i); 139 | writestatus(); 140 | sleep(1.0); 141 | i++; 142 | } 143 | } 144 | 145 | #ifndef __OpenBSD__ 146 | /* this signal handler should do nothing */ 147 | void dummysighandler(int signum) 148 | { 149 | return; 150 | } 151 | #endif 152 | 153 | #ifndef __OpenBSD__ 154 | void sighandler(int signum) 155 | { 156 | getsigcmds(signum-SIGRTMIN); 157 | writestatus(); 158 | } 159 | #endif 160 | 161 | void termhandler(int signum) 162 | { 163 | statusContinue = 0; 164 | exit(0); 165 | } 166 | 167 | int main(int argc, char** argv) 168 | { 169 | for(int i = 0; i < argc; i++) 170 | { 171 | if (!strcmp("-d",argv[i])) 172 | delim = argv[++i][0]; 173 | else if(!strcmp("-p",argv[i])) 174 | writestatus = pstdout; 175 | } 176 | signal(SIGTERM, termhandler); 177 | signal(SIGINT, termhandler); 178 | statusloop(); 179 | } 180 | -------------------------------------------------------------------------------- /dwmscrot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdpedersen1/void-suckless/e01b4cf76ec5fd12be8d9343140410cef355f425/dwmscrot.png -------------------------------------------------------------------------------- /patches/dmenu-center-20200111-8cd37e1.diff: -------------------------------------------------------------------------------- 1 | From 8cd37e1ab9e7cb025224aeb3543f1a5be8bceb93 Mon Sep 17 00:00:00 2001 2 | From: Nihal Jere 3 | Date: Sat, 11 Jan 2020 21:16:08 -0600 4 | Subject: [PATCH] center patch now has adjustable minimum width 5 | 6 | --- 7 | config.def.h | 2 ++ 8 | dmenu.1 | 3 +++ 9 | dmenu.c | 39 ++++++++++++++++++++++++++++++++------- 10 | 3 files changed, 37 insertions(+), 7 deletions(-) 11 | 12 | diff --git a/config.def.h b/config.def.h 13 | index 1edb647..88ef264 100644 14 | --- a/config.def.h 15 | +++ b/config.def.h 16 | @@ -2,6 +2,8 @@ 17 | /* Default settings; can be overriden by command line. */ 18 | 19 | static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */ 20 | +static int centered = 0; /* -c option; centers dmenu on screen */ 21 | +static int min_width = 500; /* minimum width when centered */ 22 | /* -fn option overrides fonts[0]; default X11 font or font set */ 23 | static const char *fonts[] = { 24 | "monospace:size=10" 25 | diff --git a/dmenu.1 b/dmenu.1 26 | index 323f93c..c036baa 100644 27 | --- a/dmenu.1 28 | +++ b/dmenu.1 29 | @@ -40,6 +40,9 @@ which lists programs in the user's $PATH and runs the result in their $SHELL. 30 | .B \-b 31 | dmenu appears at the bottom of the screen. 32 | .TP 33 | +.B \-c 34 | +dmenu appears centered on the screen. 35 | +.TP 36 | .B \-f 37 | dmenu grabs the keyboard before reading stdin if not reading from a tty. This 38 | is faster, but will lock up X until stdin reaches end\-of\-file. 39 | diff --git a/dmenu.c b/dmenu.c 40 | index 65f25ce..041c7f8 100644 41 | --- a/dmenu.c 42 | +++ b/dmenu.c 43 | @@ -89,6 +89,15 @@ calcoffsets(void) 44 | break; 45 | } 46 | 47 | +static int 48 | +max_textw(void) 49 | +{ 50 | + int len = 0; 51 | + for (struct item *item = items; item && item->text; item++) 52 | + len = MAX(TEXTW(item->text), len); 53 | + return len; 54 | +} 55 | + 56 | static void 57 | cleanup(void) 58 | { 59 | @@ -611,6 +620,7 @@ setup(void) 60 | bh = drw->fonts->h + 2; 61 | lines = MAX(lines, 0); 62 | mh = (lines + 1) * bh; 63 | + promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0; 64 | #ifdef XINERAMA 65 | i = 0; 66 | if (parentwin == root && (info = XineramaQueryScreens(dpy, &n))) { 67 | @@ -637,9 +647,16 @@ setup(void) 68 | if (INTERSECT(x, y, 1, 1, info[i])) 69 | break; 70 | 71 | - x = info[i].x_org; 72 | - y = info[i].y_org + (topbar ? 0 : info[i].height - mh); 73 | - mw = info[i].width; 74 | + if (centered) { 75 | + mw = MIN(MAX(max_textw() + promptw, min_width), info[i].width); 76 | + x = info[i].x_org + ((info[i].width - mw) / 2); 77 | + y = info[i].y_org + ((info[i].height - mh) / 2); 78 | + } else { 79 | + x = info[i].x_org; 80 | + y = info[i].y_org + (topbar ? 0 : info[i].height - mh); 81 | + mw = info[i].width; 82 | + } 83 | + 84 | XFree(info); 85 | } else 86 | #endif 87 | @@ -647,11 +664,17 @@ setup(void) 88 | if (!XGetWindowAttributes(dpy, parentwin, &wa)) 89 | die("could not get embedding window attributes: 0x%lx", 90 | parentwin); 91 | - x = 0; 92 | - y = topbar ? 0 : wa.height - mh; 93 | - mw = wa.width; 94 | + 95 | + if (centered) { 96 | + mw = MIN(MAX(max_textw() + promptw, min_width), wa.width); 97 | + x = (wa.width - mw) / 2; 98 | + y = (wa.height - mh) / 2; 99 | + } else { 100 | + x = 0; 101 | + y = topbar ? 0 : wa.height - mh; 102 | + mw = wa.width; 103 | + } 104 | } 105 | - promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0; 106 | inputw = MIN(inputw, mw/3); 107 | match(); 108 | 109 | @@ -709,6 +732,8 @@ main(int argc, char *argv[]) 110 | topbar = 0; 111 | else if (!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */ 112 | fast = 1; 113 | + else if (!strcmp(argv[i], "-c")) /* centers dmenu on screen */ 114 | + centered = 1; 115 | else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */ 116 | fstrncmp = strncasecmp; 117 | fstrstr = cistrstr; 118 | -- 119 | 2.24.1 120 | 121 | -------------------------------------------------------------------------------- /patches/dmenu-grid-4.9.diff: -------------------------------------------------------------------------------- 1 | From 39ab9676914bd0d8105d0f96bbd7611a53077438 Mon Sep 17 00:00:00 2001 2 | From: Miles Alan 3 | Date: Sat, 4 Jul 2020 11:19:04 -0500 4 | Subject: [PATCH] Add -g option to display entries in the given number of grid 5 | columns 6 | 7 | This option can be used in conjunction with -l to format dmenu's options in 8 | arbitrary size grids. For example, to create a 4 column by 6 line grid, you 9 | could use: dmenu -g 4 -l 6 10 | --- 11 | config.def.h | 3 ++- 12 | dmenu.1 | 7 ++++++- 13 | dmenu.c | 22 ++++++++++++++++------ 14 | 3 files changed, 24 insertions(+), 8 deletions(-) 15 | 16 | diff --git a/config.def.h b/config.def.h 17 | index 1edb647..96cf3c9 100644 18 | --- a/config.def.h 19 | +++ b/config.def.h 20 | @@ -13,8 +13,9 @@ static const char *colors[SchemeLast][2] = { 21 | [SchemeSel] = { "#eeeeee", "#005577" }, 22 | [SchemeOut] = { "#000000", "#00ffff" }, 23 | }; 24 | -/* -l option; if nonzero, dmenu uses vertical list with given number of lines */ 25 | +/* -l and -g options; controls number of lines and columns in grid if > 0 */ 26 | static unsigned int lines = 0; 27 | +static unsigned int columns = 0; 28 | 29 | /* 30 | * Characters not considered part of a word while deleting words 31 | diff --git a/dmenu.1 b/dmenu.1 32 | index 323f93c..d0a734a 100644 33 | --- a/dmenu.1 34 | +++ b/dmenu.1 35 | @@ -4,6 +4,8 @@ dmenu \- dynamic menu 36 | .SH SYNOPSIS 37 | .B dmenu 38 | .RB [ \-bfiv ] 39 | +.RB [ \-g 40 | +.IR columns ] 41 | .RB [ \-l 42 | .IR lines ] 43 | .RB [ \-m 44 | @@ -47,8 +49,11 @@ is faster, but will lock up X until stdin reaches end\-of\-file. 45 | .B \-i 46 | dmenu matches menu items case insensitively. 47 | .TP 48 | +.BI \-g " columns" 49 | +dmenu lists items in a grid with the given number of columns. 50 | +.TP 51 | .BI \-l " lines" 52 | -dmenu lists items vertically, with the given number of lines. 53 | +dmenu lists items in a grid with the given number of lines. 54 | .TP 55 | .BI \-m " monitor" 56 | dmenu is displayed on the monitor number supplied. Monitor numbers are starting 57 | diff --git a/dmenu.c b/dmenu.c 58 | index 6b8f51b..d79b6bb 100644 59 | --- a/dmenu.c 60 | +++ b/dmenu.c 61 | @@ -77,7 +77,7 @@ calcoffsets(void) 62 | int i, n; 63 | 64 | if (lines > 0) 65 | - n = lines * bh; 66 | + n = lines * columns * bh; 67 | else 68 | n = mw - (promptw + inputw + TEXTW("<") + TEXTW(">")); 69 | /* calculate which items will begin the next page and previous page */ 70 | @@ -152,9 +152,15 @@ drawmenu(void) 71 | } 72 | 73 | if (lines > 0) { 74 | - /* draw vertical list */ 75 | - for (item = curr; item != next; item = item->right) 76 | - drawitem(item, x, y += bh, mw - x); 77 | + /* draw grid */ 78 | + int i = 0; 79 | + for (item = curr; item != next; item = item->right, i++) 80 | + drawitem( 81 | + item, 82 | + x + ((i / lines) * ((mw - x) / columns)), 83 | + y + (((i % lines) + 1) * bh), 84 | + (mw - x) / columns 85 | + ); 86 | } else if (matches) { 87 | /* draw horizontal list */ 88 | x += inputw; 89 | @@ -708,9 +714,13 @@ main(int argc, char *argv[]) 90 | } else if (i + 1 == argc) 91 | usage(); 92 | /* these options take one argument */ 93 | - else if (!strcmp(argv[i], "-l")) /* number of lines in vertical list */ 94 | + else if (!strcmp(argv[i], "-g")) { /* number of columns in grid */ 95 | + columns = atoi(argv[++i]); 96 | + if (lines == 0) lines = 1; 97 | + } else if (!strcmp(argv[i], "-l")) { /* number of lines in grid */ 98 | lines = atoi(argv[++i]); 99 | - else if (!strcmp(argv[i], "-m")) 100 | + if (columns == 0) columns = 1; 101 | + } else if (!strcmp(argv[i], "-m")) 102 | mon = atoi(argv[++i]); 103 | else if (!strcmp(argv[i], "-p")) /* adds prompt to left of input field */ 104 | prompt = argv[++i]; 105 | -- 106 | 2.23.1 107 | 108 | -------------------------------------------------------------------------------- /patches/dmenu-gridnav-5.0.diff: -------------------------------------------------------------------------------- 1 | diff --git a/dmenu.c b/dmenu.c 2 | index 7361377..fcec79b 100644 3 | --- a/dmenu.c 4 | +++ b/dmenu.c 5 | @@ -317,6 +317,8 @@ keypress(XKeyEvent *ev) 6 | int len; 7 | KeySym ksym; 8 | Status status; 9 | + int i, offscreen = 0; 10 | + struct item *tmpsel; 11 | 12 | len = XmbLookupString(xic, ev, buf, sizeof buf, &ksym, &status); 13 | switch (status) { 14 | @@ -443,6 +445,27 @@ insert: 15 | calcoffsets(); 16 | break; 17 | case XK_Left: 18 | + if (columns > 1) { 19 | + if (!sel) 20 | + return; 21 | + tmpsel = sel; 22 | + for (i = 0; i < lines; i++) { 23 | + if (!tmpsel->left || tmpsel->left->right != tmpsel) { 24 | + if (offscreen) 25 | + break; 26 | + return; 27 | + } 28 | + if (tmpsel == curr) 29 | + offscreen = 1; 30 | + tmpsel = tmpsel->left; 31 | + } 32 | + sel = tmpsel; 33 | + if (offscreen) { 34 | + curr = prev; 35 | + calcoffsets(); 36 | + } 37 | + break; 38 | + } 39 | if (cursor > 0 && (!sel || !sel->left || lines > 0)) { 40 | cursor = nextrune(-1); 41 | break; 42 | @@ -479,6 +502,27 @@ insert: 43 | sel->out = 1; 44 | break; 45 | case XK_Right: 46 | + if (columns > 1) { 47 | + if (!sel) 48 | + return; 49 | + tmpsel = sel; 50 | + for (i = 0; i < lines; i++) { 51 | + if (!tmpsel->right || tmpsel->right->left != tmpsel) { 52 | + if (offscreen) 53 | + break; 54 | + return; 55 | + } 56 | + tmpsel = tmpsel->right; 57 | + if (tmpsel == next) 58 | + offscreen = 1; 59 | + } 60 | + sel = tmpsel; 61 | + if (offscreen) { 62 | + curr = next; 63 | + calcoffsets(); 64 | + } 65 | + break; 66 | + } 67 | if (text[cursor] != '\0') { 68 | cursor = nextrune(+1); 69 | break; 70 | -------------------------------------------------------------------------------- /patches/dmenu-highlight-20201211-fcdc159.diff: -------------------------------------------------------------------------------- 1 | From fcdc1593ed418166f20b7e691a49b1e6eefc116e Mon Sep 17 00:00:00 2001 2 | From: Nathaniel Evan 3 | Date: Fri, 11 Dec 2020 11:08:12 +0700 4 | Subject: [PATCH] Highlight matched text in a different color scheme 5 | 6 | --- 7 | config.def.h | 3 +++ 8 | dmenu.c | 44 +++++++++++++++++++++++++++++++++++++++++--- 9 | 2 files changed, 44 insertions(+), 3 deletions(-) 10 | 11 | diff --git a/config.def.h b/config.def.h 12 | index 1edb647..79be73a 100644 13 | --- a/config.def.h 14 | +++ b/config.def.h 15 | @@ -11,7 +11,10 @@ static const char *colors[SchemeLast][2] = { 16 | /* fg bg */ 17 | [SchemeNorm] = { "#bbbbbb", "#222222" }, 18 | [SchemeSel] = { "#eeeeee", "#005577" }, 19 | + [SchemeSelHighlight] = { "#ffc978", "#005577" }, 20 | + [SchemeNormHighlight] = { "#ffc978", "#222222" }, 21 | [SchemeOut] = { "#000000", "#00ffff" }, 22 | + [SchemeOutHighlight] = { "#ffc978", "#00ffff" }, 23 | }; 24 | /* -l option; if nonzero, dmenu uses vertical list with given number of lines */ 25 | static unsigned int lines = 0; 26 | diff --git a/dmenu.c b/dmenu.c 27 | index 65f25ce..cce1ad1 100644 28 | --- a/dmenu.c 29 | +++ b/dmenu.c 30 | @@ -26,8 +26,7 @@ 31 | #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) 32 | 33 | /* enums */ 34 | -enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */ 35 | - 36 | +enum { SchemeNorm, SchemeSel, SchemeOut, SchemeNormHighlight, SchemeSelHighlight, SchemeOutHighlight, SchemeLast }; /* color schemes */ 37 | struct item { 38 | char *text; 39 | struct item *left, *right; 40 | @@ -113,6 +112,43 @@ cistrstr(const char *s, const char *sub) 41 | return NULL; 42 | } 43 | 44 | +static void 45 | +drawhighlights(struct item *item, int x, int y, int maxw) 46 | +{ 47 | + char restorechar, tokens[sizeof text], *highlight, *token; 48 | + int indentx, highlightlen; 49 | + 50 | + drw_setscheme(drw, scheme[item == sel ? SchemeSelHighlight : item->out ? SchemeOutHighlight : SchemeNormHighlight]); 51 | + strcpy(tokens, text); 52 | + for (token = strtok(tokens, " "); token; token = strtok(NULL, " ")) { 53 | + highlight = fstrstr(item->text, token); 54 | + while (highlight) { 55 | + // Move item str end, calc width for highlight indent, & restore 56 | + highlightlen = highlight - item->text; 57 | + restorechar = *highlight; 58 | + item->text[highlightlen] = '\0'; 59 | + indentx = TEXTW(item->text); 60 | + item->text[highlightlen] = restorechar; 61 | + 62 | + // Move highlight str end, draw highlight, & restore 63 | + restorechar = highlight[strlen(token)]; 64 | + highlight[strlen(token)] = '\0'; 65 | + if (indentx - (lrpad / 2) - 1 < maxw) 66 | + drw_text( 67 | + drw, 68 | + x + indentx - (lrpad / 2) - 1, 69 | + y, 70 | + MIN(maxw - indentx, TEXTW(highlight) - lrpad), 71 | + bh, 0, highlight, 0 72 | + ); 73 | + highlight[strlen(token)] = restorechar; 74 | + 75 | + if (strlen(highlight) - strlen(token) < strlen(token)) break; 76 | + highlight = fstrstr(highlight + strlen(token), token); 77 | + } 78 | + } 79 | +} 80 | + 81 | static int 82 | drawitem(struct item *item, int x, int y, int w) 83 | { 84 | @@ -123,7 +159,9 @@ drawitem(struct item *item, int x, int y, int w) 85 | else 86 | drw_setscheme(drw, scheme[SchemeNorm]); 87 | 88 | - return drw_text(drw, x, y, w, bh, lrpad / 2, item->text, 0); 89 | + int r = drw_text(drw, x, y, w, bh, lrpad / 2, item->text, 0); 90 | + drawhighlights(item, x, y, w); 91 | + return r; 92 | } 93 | 94 | static void 95 | -- 96 | 2.29.2 97 | 98 | -------------------------------------------------------------------------------- /patches/dwm-autostart-20210120-cb3f58a.diff: -------------------------------------------------------------------------------- 1 | From 37e970479dc5d40e57fc0cbfeaa5e39941483237 Mon Sep 17 00:00:00 2001 2 | From: Gan Ainm 3 | Date: Wed, 10 Jun 2020 10:59:02 +0000 4 | Subject: [PATCH] dwm-xdgautostart-6.2.diff 5 | 6 | =================================================================== 7 | --- 8 | dwm.1 | 23 +++++++++++++++++ 9 | dwm.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 10 | 2 files changed, 105 insertions(+) 11 | 12 | diff --git a/dwm.1 b/dwm.1 13 | index 13b3729..9533aa6 100644 14 | --- a/dwm.1 15 | +++ b/dwm.1 16 | @@ -30,6 +30,14 @@ top left corner. The tags which are applied to one or more windows are 17 | indicated with an empty square in the top left corner. 18 | .P 19 | dwm draws a small border around windows to indicate the focus state. 20 | +.P 21 | +On start, dwm can start additional programs that may be specified in two special 22 | +shell scripts (see the FILES section below), autostart_blocking.sh and 23 | +autostart.sh. The former is executed first and dwm will wait for its 24 | +termination before starting. The latter is executed in the background before 25 | +dwm enters its handler loop. 26 | +.P 27 | +Either of these files may be omitted. 28 | .SH OPTIONS 29 | .TP 30 | .B \-v 31 | @@ -152,6 +160,21 @@ Toggles focused window between floating and tiled state. 32 | .TP 33 | .B Mod1\-Button3 34 | Resize focused window while dragging. Tiled windows will be toggled to the floating state. 35 | +.SH FILES 36 | +The files containing programs to be started along with dwm are searched for in 37 | +the following directories: 38 | +.IP "1. $XDG_DATA_HOME/dwm" 39 | +.IP "2. $HOME/.local/share/dwm" 40 | +.IP "3. $HOME/.dwm" 41 | +.P 42 | +The first existing directory is scanned for any of the autostart files below. 43 | +.TP 15 44 | +autostart.sh 45 | +This file is started as a shell background process before dwm enters its handler 46 | +loop. 47 | +.TP 15 48 | +autostart_blocking.sh 49 | +This file is started before any autostart.sh; dwm waits for its termination. 50 | .SH CUSTOMIZATION 51 | dwm is customized by creating a custom config.h and (re)compiling the source 52 | code. This keeps it fast, secure and simple. 53 | diff --git a/dwm.c b/dwm.c 54 | index 4465af1..2156b49 100644 55 | --- a/dwm.c 56 | +++ b/dwm.c 57 | @@ -29,6 +29,7 @@ 58 | #include 59 | #include 60 | #include 61 | +#include 62 | #include 63 | #include 64 | #include 65 | @@ -193,6 +194,7 @@ static void resizeclient(Client *c, int x, int y, int w, int h); 66 | static void resizemouse(const Arg *arg); 67 | static void restack(Monitor *m); 68 | static void run(void); 69 | +static void runautostart(void); 70 | static void scan(void); 71 | static int sendevent(Client *c, Atom proto); 72 | static void sendmon(Client *c, Monitor *m); 73 | @@ -235,7 +237,11 @@ static int xerrorstart(Display *dpy, XErrorEvent *ee); 74 | static void zoom(const Arg *arg); 75 | 76 | /* variables */ 77 | +static const char autostartblocksh[] = "autostart_blocking.sh"; 78 | +static const char autostartsh[] = "autostart.sh"; 79 | static const char broken[] = "broken"; 80 | +static const char dwmdir[] = "dwm"; 81 | +static const char localshare[] = ".local/share"; 82 | static char stext[256]; 83 | static int screen; 84 | static int sw, sh; /* X display screen geometry width, height */ 85 | @@ -1380,6 +1386,83 @@ run(void) 86 | handler[ev.type](&ev); /* call handler */ 87 | } 88 | 89 | +void 90 | +runautostart(void) 91 | +{ 92 | + char *pathpfx; 93 | + char *path; 94 | + char *xdgdatahome; 95 | + char *home; 96 | + struct stat sb; 97 | + 98 | + if ((home = getenv("HOME")) == NULL) 99 | + /* this is almost impossible */ 100 | + return; 101 | + 102 | + /* if $XDG_DATA_HOME is set and not empty, use $XDG_DATA_HOME/dwm, 103 | + * otherwise use ~/.local/share/dwm as autostart script directory 104 | + */ 105 | + xdgdatahome = getenv("XDG_DATA_HOME"); 106 | + if (xdgdatahome != NULL && *xdgdatahome != '\0') { 107 | + /* space for path segments, separators and nul */ 108 | + pathpfx = ecalloc(1, strlen(xdgdatahome) + strlen(dwmdir) + 2); 109 | + 110 | + if (sprintf(pathpfx, "%s/%s", xdgdatahome, dwmdir) <= 0) { 111 | + free(pathpfx); 112 | + return; 113 | + } 114 | + } else { 115 | + /* space for path segments, separators and nul */ 116 | + pathpfx = ecalloc(1, strlen(home) + strlen(localshare) 117 | + + strlen(dwmdir) + 3); 118 | + 119 | + if (sprintf(pathpfx, "%s/%s/%s", home, localshare, dwmdir) < 0) { 120 | + free(pathpfx); 121 | + return; 122 | + } 123 | + } 124 | + 125 | + /* check if the autostart script directory exists */ 126 | + if (! (stat(pathpfx, &sb) == 0 && S_ISDIR(sb.st_mode))) { 127 | + /* the XDG conformant path does not exist or is no directory 128 | + * so we try ~/.dwm instead 129 | + */ 130 | + char *pathpfx_new = realloc(pathpfx, strlen(home) + strlen(dwmdir) + 3); 131 | + if(pathpfx_new == NULL) { 132 | + free(pathpfx); 133 | + return; 134 | + } 135 | + pathpfx = pathpfx_new; 136 | + 137 | + if (sprintf(pathpfx, "%s/.%s", home, dwmdir) <= 0) { 138 | + free(pathpfx); 139 | + return; 140 | + } 141 | + } 142 | + 143 | + /* try the blocking script first */ 144 | + path = ecalloc(1, strlen(pathpfx) + strlen(autostartblocksh) + 2); 145 | + if (sprintf(path, "%s/%s", pathpfx, autostartblocksh) <= 0) { 146 | + free(path); 147 | + free(pathpfx); 148 | + } 149 | + 150 | + if (access(path, X_OK) == 0) 151 | + system(path); 152 | + 153 | + /* now the non-blocking script */ 154 | + if (sprintf(path, "%s/%s", pathpfx, autostartsh) <= 0) { 155 | + free(path); 156 | + free(pathpfx); 157 | + } 158 | + 159 | + if (access(path, X_OK) == 0) 160 | + system(strcat(path, " &")); 161 | + 162 | + free(pathpfx); 163 | + free(path); 164 | +} 165 | + 166 | void 167 | scan(void) 168 | { 169 | @@ -2142,6 +2223,7 @@ main(int argc, char *argv[]) 170 | die("pledge"); 171 | #endif /* __OpenBSD__ */ 172 | scan(); 173 | + runautostart(); 174 | run(); 175 | cleanup(); 176 | XCloseDisplay(dpy); 177 | -- 178 | 2.27.0 179 | 180 | -------------------------------------------------------------------------------- /patches/dwm-bar-height-6.2.diff: -------------------------------------------------------------------------------- 1 | diff --git a/config.def.h b/config.def.h 2 | index 1c0b587..9814500 100644 3 | --- a/config.def.h 4 | +++ b/config.def.h 5 | @@ -5,6 +5,7 @@ static const unsigned int borderpx = 1; /* border pixel of windows */ 6 | static const unsigned int snap = 32; /* snap pixel */ 7 | static const int showbar = 1; /* 0 means no bar */ 8 | static const int topbar = 1; /* 0 means bottom bar */ 9 | +static const int user_bh = 0; /* 0 means that dwm will calculate bar height, >= 1 means dwm will user_bh as bar height */ 10 | static const char *fonts[] = { "monospace:size=10" }; 11 | static const char dmenufont[] = "monospace:size=10"; 12 | static const char col_gray1[] = "#222222"; 13 | diff --git a/dwm.c b/dwm.c 14 | index 4465af1..2c27cb3 100644 15 | --- a/dwm.c 16 | +++ b/dwm.c 17 | @@ -1545,7 +1545,7 @@ setup(void) 18 | if (!drw_fontset_create(drw, fonts, LENGTH(fonts))) 19 | die("no fonts could be loaded."); 20 | lrpad = drw->fonts->h; 21 | - bh = drw->fonts->h + 2; 22 | + bh = user_bh ? user_bh : drw->fonts->h + 2; 23 | updategeom(); 24 | /* init atoms */ 25 | utf8string = XInternAtom(dpy, "UTF8_STRING", False); 26 | -------------------------------------------------------------------------------- /patches/dwm-bottomstack-6.1.diff: -------------------------------------------------------------------------------- 1 | diff --git a/config.def.h b/config.def.h 2 | index 7054c06..554f1db 100644 3 | --- a/config.def.h 4 | +++ b/config.def.h 5 | @@ -39,6 +39,8 @@ static const Layout layouts[] = { 6 | { "[]=", tile }, /* first entry is default */ 7 | { "><>", NULL }, /* no layout function means floating behavior */ 8 | { "[M]", monocle }, 9 | + { "TTT", bstack }, 10 | + { "===", bstackhoriz }, 11 | }; 12 | 13 | /* key definitions */ 14 | @@ -74,6 +76,8 @@ static Key keys[] = { 15 | { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, 16 | { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, 17 | { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, 18 | + { MODKEY, XK_u, setlayout, {.v = &layouts[3]} }, 19 | + { MODKEY, XK_o, setlayout, {.v = &layouts[4]} }, 20 | { MODKEY, XK_space, setlayout, {0} }, 21 | { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, 22 | { MODKEY, XK_0, view, {.ui = ~0 } }, 23 | diff --git a/dwm.c b/dwm.c 24 | index 0362114..c313b5e 100644 25 | --- a/dwm.c 26 | +++ b/dwm.c 27 | @@ -233,6 +233,8 @@ static int xerror(Display *dpy, XErrorEvent *ee); 28 | static int xerrordummy(Display *dpy, XErrorEvent *ee); 29 | static int xerrorstart(Display *dpy, XErrorEvent *ee); 30 | static void zoom(const Arg *arg); 31 | +static void bstack(Monitor *m); 32 | +static void bstackhoriz(Monitor *m); 33 | 34 | /* variables */ 35 | static const char broken[] = "broken"; 36 | @@ -2139,3 +2141,65 @@ main(int argc, char *argv[]) 37 | XCloseDisplay(dpy); 38 | return EXIT_SUCCESS; 39 | } 40 | + 41 | +static void 42 | +bstack(Monitor *m) { 43 | + int w, h, mh, mx, tx, ty, tw; 44 | + unsigned int i, n; 45 | + Client *c; 46 | + 47 | + for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); 48 | + if (n == 0) 49 | + return; 50 | + if (n > m->nmaster) { 51 | + mh = m->nmaster ? m->mfact * m->wh : 0; 52 | + tw = m->ww / (n - m->nmaster); 53 | + ty = m->wy + mh; 54 | + } else { 55 | + mh = m->wh; 56 | + tw = m->ww; 57 | + ty = m->wy; 58 | + } 59 | + for (i = mx = 0, tx = m->wx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) { 60 | + if (i < m->nmaster) { 61 | + w = (m->ww - mx) / (MIN(n, m->nmaster) - i); 62 | + resize(c, m->wx + mx, m->wy, w - (2 * c->bw), mh - (2 * c->bw), 0); 63 | + mx += WIDTH(c); 64 | + } else { 65 | + h = m->wh - mh; 66 | + resize(c, tx, ty, tw - (2 * c->bw), h - (2 * c->bw), 0); 67 | + if (tw != m->ww) 68 | + tx += WIDTH(c); 69 | + } 70 | + } 71 | +} 72 | + 73 | +static void 74 | +bstackhoriz(Monitor *m) { 75 | + int w, mh, mx, tx, ty, th; 76 | + unsigned int i, n; 77 | + Client *c; 78 | + 79 | + for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); 80 | + if (n == 0) 81 | + return; 82 | + if (n > m->nmaster) { 83 | + mh = m->nmaster ? m->mfact * m->wh : 0; 84 | + th = (m->wh - mh) / (n - m->nmaster); 85 | + ty = m->wy + mh; 86 | + } else { 87 | + th = mh = m->wh; 88 | + ty = m->wy; 89 | + } 90 | + for (i = mx = 0, tx = m->wx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) { 91 | + if (i < m->nmaster) { 92 | + w = (m->ww - mx) / (MIN(n, m->nmaster) - i); 93 | + resize(c, m->wx + mx, m->wy, w - (2 * c->bw), mh - (2 * c->bw), 0); 94 | + mx += WIDTH(c); 95 | + } else { 96 | + resize(c, tx, ty, m->ww - (2 * c->bw), th - (2 * c->bw), 0); 97 | + if (th != m->wh) 98 | + ty += HEIGHT(c); 99 | + } 100 | + } 101 | +} 102 | -------------------------------------------------------------------------------- /patches/dwm-cyclelayouts-20180524-6.2.diff: -------------------------------------------------------------------------------- 1 | From a09e766a4342f580582082a92b2de65f33208eb4 Mon Sep 17 00:00:00 2001 2 | From: Christopher Drelich 3 | Date: Thu, 24 May 2018 00:56:56 -0400 4 | Subject: [PATCH] Function to cycle through available layouts. 5 | 6 | MOD-CTRL-, and MOD-CTRL-. 7 | cycle backwards and forwards through available layouts. 8 | Probably only useful if you have a lot of additional layouts. 9 | The NULL, NULL layout should always be the last layout in your list, 10 | in order to guarantee consistent behavior. 11 | --- 12 | config.def.h | 3 +++ 13 | dwm.1 | 6 ++++++ 14 | dwm.c | 18 ++++++++++++++++++ 15 | 3 files changed, 27 insertions(+) 16 | 17 | diff --git a/config.def.h b/config.def.h 18 | index a9ac303..153b880 100644 19 | --- a/config.def.h 20 | +++ b/config.def.h 21 | @@ -41,6 +41,7 @@ static const Layout layouts[] = { 22 | { "[]=", tile }, /* first entry is default */ 23 | { "><>", NULL }, /* no layout function means floating behavior */ 24 | { "[M]", monocle }, 25 | + { NULL, NULL }, 26 | }; 27 | 28 | /* key definitions */ 29 | @@ -76,6 +77,8 @@ static Key keys[] = { 30 | { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, 31 | { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, 32 | { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, 33 | + { MODKEY|ControlMask, XK_comma, cyclelayout, {.i = -1 } }, 34 | + { MODKEY|ControlMask, XK_period, cyclelayout, {.i = +1 } }, 35 | { MODKEY, XK_space, setlayout, {0} }, 36 | { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, 37 | { MODKEY, XK_0, view, {.ui = ~0 } }, 38 | diff --git a/dwm.1 b/dwm.1 39 | index 13b3729..165891b 100644 40 | --- a/dwm.1 41 | +++ b/dwm.1 42 | @@ -92,6 +92,12 @@ Sets monocle layout. 43 | .B Mod1\-space 44 | Toggles between current and previous layout. 45 | .TP 46 | +.B Mod1\-Control\-, 47 | +Cycles backwards in layout list. 48 | +.TP 49 | +.B Mod1\-Control\-. 50 | +Cycles forwards in layout list. 51 | +.TP 52 | .B Mod1\-j 53 | Focus next window. 54 | .TP 55 | diff --git a/dwm.c b/dwm.c 56 | index bb95e26..db73000 100644 57 | --- a/dwm.c 58 | +++ b/dwm.c 59 | @@ -157,6 +157,7 @@ static void configure(Client *c); 60 | static void configurenotify(XEvent *e); 61 | static void configurerequest(XEvent *e); 62 | static Monitor *createmon(void); 63 | +static void cyclelayout(const Arg *arg); 64 | static void destroynotify(XEvent *e); 65 | static void detach(Client *c); 66 | static void detachstack(Client *c); 67 | @@ -645,6 +646,23 @@ createmon(void) 68 | } 69 | 70 | void 71 | +cyclelayout(const Arg *arg) { 72 | + Layout *l; 73 | + for(l = (Layout *)layouts; l != selmon->lt[selmon->sellt]; l++); 74 | + if(arg->i > 0) { 75 | + if(l->symbol && (l + 1)->symbol) 76 | + setlayout(&((Arg) { .v = (l + 1) })); 77 | + else 78 | + setlayout(&((Arg) { .v = layouts })); 79 | + } else { 80 | + if(l != layouts && (l - 1)->symbol) 81 | + setlayout(&((Arg) { .v = (l - 1) })); 82 | + else 83 | + setlayout(&((Arg) { .v = &layouts[LENGTH(layouts) - 2] })); 84 | + } 85 | +} 86 | + 87 | +void 88 | destroynotify(XEvent *e) 89 | { 90 | Client *c; 91 | -- 92 | 2.7.4 93 | 94 | -------------------------------------------------------------------------------- /patches/dwm-float-border-color-6.2.diff: -------------------------------------------------------------------------------- 1 | From b8a19f1d4385e04478ec13a24b6ebababcf14139 Mon Sep 17 00:00:00 2001 2 | From: MLquest8 3 | Date: Sun, 14 Jun 2020 13:52:57 +0400 4 | Subject: [PATCH] updated for version 6.2 5 | 6 | --- 7 | config.def.h | 8 ++++---- 8 | dwm.c | 19 ++++++++++++++++--- 9 | 2 files changed, 20 insertions(+), 7 deletions(-) 10 | 11 | diff --git a/config.def.h b/config.def.h 12 | index 1c0b587..27de552 100644 13 | --- a/config.def.h 14 | +++ b/config.def.h 15 | @@ -12,10 +12,10 @@ static const char col_gray2[] = "#444444"; 16 | static const char col_gray3[] = "#bbbbbb"; 17 | static const char col_gray4[] = "#eeeeee"; 18 | static const char col_cyan[] = "#005577"; 19 | -static const char *colors[][3] = { 20 | - /* fg bg border */ 21 | - [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, 22 | - [SchemeSel] = { col_gray4, col_cyan, col_cyan }, 23 | +static const char *colors[][4] = { 24 | + /* fg bg border float */ 25 | + [SchemeNorm] = { col_gray3, col_gray1, col_gray2, col_gray2 }, 26 | + [SchemeSel] = { col_gray4, col_cyan, col_gray2, col_cyan }, 27 | }; 28 | 29 | /* tagging */ 30 | diff --git a/dwm.c b/dwm.c 31 | index 9fd0286..da735c6 100644 32 | --- a/dwm.c 33 | +++ b/dwm.c 34 | @@ -56,6 +56,7 @@ 35 | #define HEIGHT(X) ((X)->h + 2 * (X)->bw) 36 | #define TAGMASK ((1 << LENGTH(tags)) - 1) 37 | #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) 38 | +#define ColFloat 3 39 | 40 | /* enums */ 41 | enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ 42 | @@ -796,7 +797,10 @@ focus(Client *c) 43 | detachstack(c); 44 | attachstack(c); 45 | grabbuttons(c, 1); 46 | - XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); 47 | + if(c->isfloating) 48 | + XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColFloat].pixel); 49 | + else 50 | + XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); 51 | setfocus(c); 52 | } else { 53 | XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); 54 | @@ -1052,7 +1056,10 @@ manage(Window w, XWindowAttributes *wa) 55 | 56 | wc.border_width = c->bw; 57 | XConfigureWindow(dpy, w, CWBorderWidth, &wc); 58 | - XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel); 59 | + if(c->isfloating) 60 | + XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColFloat].pixel); 61 | + else 62 | + XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel); 63 | configure(c); /* propagates border_width, if size doesn't change */ 64 | updatewindowtype(c); 65 | updatesizehints(c); 66 | @@ -1063,6 +1070,8 @@ manage(Window w, XWindowAttributes *wa) 67 | c->isfloating = c->oldstate = trans != None || c->isfixed; 68 | if (c->isfloating) 69 | XRaiseWindow(dpy, c->win); 70 | + if(c->isfloating) 71 | + XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColFloat].pixel); 72 | attach(c); 73 | attachstack(c); 74 | XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, 75 | @@ -1570,7 +1579,7 @@ setup(void) 76 | /* init appearance */ 77 | scheme = ecalloc(LENGTH(colors), sizeof(Clr *)); 78 | for (i = 0; i < LENGTH(colors); i++) 79 | - scheme[i] = drw_scm_create(drw, colors[i], 3); 80 | + scheme[i] = drw_scm_create(drw, colors[i], 4); 81 | /* init bars */ 82 | updatebars(); 83 | updatestatus(); 84 | @@ -1717,6 +1726,10 @@ togglefloating(const Arg *arg) 85 | return; 86 | selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed; 87 | if (selmon->sel->isfloating) 88 | + XSetWindowBorder(dpy, selmon->sel->win, scheme[SchemeSel][ColFloat].pixel); 89 | + else 90 | + XSetWindowBorder(dpy, selmon->sel->win, scheme[SchemeSel][ColBorder].pixel); 91 | + if(selmon->sel->isfloating) 92 | resize(selmon->sel, selmon->sel->x, selmon->sel->y, 93 | selmon->sel->w, selmon->sel->h, 0); 94 | arrange(selmon); 95 | -- 96 | 2.26.2 97 | 98 | -------------------------------------------------------------------------------- /patches/dwm-focusadjacenttag-6.0.diff: -------------------------------------------------------------------------------- 1 | diff -up a/config.h b/config.h 2 | --- a/config.h 2014-06-23 18:04:29.536917000 +0200 3 | +++ b/config.h 2014-06-24 08:15:51.857173332 +0200 4 | @@ -74,6 +74,10 @@ static Key keys[] = { 5 | { MODKEY, XK_period, focusmon, {.i = +1 } }, 6 | { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, 7 | { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, 8 | + { MODKEY, XK_Left, viewtoleft, {0} }, 9 | + { MODKEY, XK_Right, viewtoright, {0} }, 10 | + { MODKEY|ShiftMask, XK_Left, tagtoleft, {0} }, 11 | + { MODKEY|ShiftMask, XK_Right, tagtoright, {0} }, 12 | TAGKEYS( XK_1, 0) 13 | TAGKEYS( XK_2, 1) 14 | TAGKEYS( XK_3, 2) 15 | diff -up a/dwm.1 b/dwm.1 16 | --- a/dwm.1 2014-06-23 18:04:29.532917821 +0200 17 | +++ b/dwm.1 2014-06-23 21:52:54.095867809 +0200 18 | @@ -71,6 +71,18 @@ Send focused window to previous screen, 19 | .B Mod1\-Shift\-. 20 | Send focused window to next screen, if any. 21 | .TP 22 | +.B Mod1\-Right 23 | +Focus tag on the right, if any. 24 | +.TP 25 | +.B Mod1\-Left 26 | +Focus tag on the left, if any. 27 | +.TP 28 | +.B Mod1\-Shift\-Right 29 | +Send focused window to tag on the right, if any. 30 | +.TP 31 | +.B Mod1\-Shift\-Left 32 | +Send focused window to tag on the left, if any. 33 | +.TP 34 | .B Mod1\-b 35 | Toggles bar on and off. 36 | .TP 37 | diff -up a/dwm.c b/dwm.c 38 | --- a/dwm.c 2014-06-23 18:04:29.532917821 +0200 39 | +++ b/dwm.c 2014-06-24 08:17:40.921714154 +0200 40 | @@ -226,6 +226,8 @@ static void sigchld(int unused); 41 | static void spawn(const Arg *arg); 42 | static void tag(const Arg *arg); 43 | static void tagmon(const Arg *arg); 44 | +static void tagtoleft(const Arg *arg); 45 | +static void tagtoright(const Arg *arg); 46 | static int textnw(const char *text, unsigned int len); 47 | static void tile(Monitor *); 48 | static void togglebar(const Arg *arg); 49 | @@ -245,6 +247,8 @@ static void updatewindowtype(Client *c); 50 | static void updatetitle(Client *c); 51 | static void updatewmhints(Client *c); 52 | static void view(const Arg *arg); 53 | +static void viewtoleft(const Arg *arg); 54 | +static void viewtoright(const Arg *arg); 55 | static Client *wintoclient(Window w); 56 | static Monitor *wintomon(Window w); 57 | static int xerror(Display *dpy, XErrorEvent *ee); 58 | @@ -1690,6 +1694,28 @@ tagmon(const Arg *arg) { 59 | sendmon(selmon->sel, dirtomon(arg->i)); 60 | } 61 | 62 | +void 63 | +tagtoleft(const Arg *arg) { 64 | + if(selmon->sel != NULL 65 | + && __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1 66 | + && selmon->tagset[selmon->seltags] > 1) { 67 | + selmon->sel->tags >>= 1; 68 | + focus(NULL); 69 | + arrange(selmon); 70 | + } 71 | +} 72 | + 73 | +void 74 | +tagtoright(const Arg *arg) { 75 | + if(selmon->sel != NULL 76 | + && __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1 77 | + && selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) { 78 | + selmon->sel->tags <<= 1; 79 | + focus(NULL); 80 | + arrange(selmon); 81 | + } 82 | +} 83 | + 84 | int 85 | textnw(const char *text, unsigned int len) { 86 | XRectangle r; 87 | @@ -2052,6 +2078,28 @@ view(const Arg *arg) { 88 | arrange(selmon); 89 | } 90 | 91 | +void 92 | +viewtoleft(const Arg *arg) { 93 | + if(__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1 94 | + && selmon->tagset[selmon->seltags] > 1) { 95 | + selmon->seltags ^= 1; /* toggle sel tagset */ 96 | + selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] >> 1; 97 | + focus(NULL); 98 | + arrange(selmon); 99 | + } 100 | +} 101 | + 102 | +void 103 | +viewtoright(const Arg *arg) { 104 | + if(__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1 105 | + && selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) { 106 | + selmon->seltags ^= 1; /* toggle sel tagset */ 107 | + selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] << 1; 108 | + focus(NULL); 109 | + arrange(selmon); 110 | + } 111 | +} 112 | + 113 | Client * 114 | wintoclient(Window w) { 115 | Client *c; 116 | -------------------------------------------------------------------------------- /patches/dwm-namedscratchpads-6.2.diff: -------------------------------------------------------------------------------- 1 | diff '--color=auto' -up dwm-6.2/config.def.h dwm-6.2-new/config.def.h 2 | --- dwm-6.2/config.def.h 2019-02-02 12:55:28.000000000 +0000 3 | +++ dwm-6.2-new/config.def.h 2020-04-26 13:51:06.713332746 +0100 4 | @@ -26,9 +26,10 @@ static const Rule rules[] = { 5 | * WM_CLASS(STRING) = instance, class 6 | * WM_NAME(STRING) = title 7 | */ 8 | - /* class instance title tags mask isfloating monitor */ 9 | - { "Gimp", NULL, NULL, 0, 1, -1 }, 10 | - { "Firefox", NULL, NULL, 1 << 8, 0, -1 }, 11 | + /* class instance title tags mask isfloating monitor scratch key */ 12 | + { "Gimp", NULL, NULL, 0, 1, -1, 0 }, 13 | + { "firefox", NULL, NULL, 1 << 8, 0, -1, 0 }, 14 | + { NULL, NULL, "scratchpad", 0, 1, -1, 's' }, 15 | }; 16 | 17 | /* layout(s) */ 18 | @@ -59,10 +60,14 @@ static char dmenumon[2] = "0"; /* compon 19 | static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; 20 | static const char *termcmd[] = { "st", NULL }; 21 | 22 | +/*First arg only serves to match against key in rules*/ 23 | +static const char *scratchpadcmd[] = {"s", "st", "-t", "scratchpad", NULL}; 24 | + 25 | static Key keys[] = { 26 | /* modifier key function argument */ 27 | { MODKEY, XK_p, spawn, {.v = dmenucmd } }, 28 | { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, 29 | + { MODKEY, XK_grave, togglescratch, {.v = scratchpadcmd } }, 30 | { MODKEY, XK_b, togglebar, {0} }, 31 | { MODKEY, XK_j, focusstack, {.i = +1 } }, 32 | { MODKEY, XK_k, focusstack, {.i = -1 } }, 33 | diff '--color=auto' -up dwm-6.2/dwm.c dwm-6.2-new/dwm.c 34 | --- dwm-6.2/dwm.c 2019-02-02 12:55:28.000000000 +0000 35 | +++ dwm-6.2-new/dwm.c 2020-04-26 13:55:56.820584361 +0100 36 | @@ -93,6 +93,7 @@ struct Client { 37 | int bw, oldbw; 38 | unsigned int tags; 39 | int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; 40 | + char scratchkey; 41 | Client *next; 42 | Client *snext; 43 | Monitor *mon; 44 | @@ -139,6 +140,7 @@ typedef struct { 45 | unsigned int tags; 46 | int isfloating; 47 | int monitor; 48 | + const char scratchkey; 49 | } Rule; 50 | 51 | /* function declarations */ 52 | @@ -206,11 +208,13 @@ static void seturgent(Client *c, int urg 53 | static void showhide(Client *c); 54 | static void sigchld(int unused); 55 | static void spawn(const Arg *arg); 56 | +static void spawnscratch(const Arg *arg); 57 | static void tag(const Arg *arg); 58 | static void tagmon(const Arg *arg); 59 | static void tile(Monitor *); 60 | static void togglebar(const Arg *arg); 61 | static void togglefloating(const Arg *arg); 62 | +static void togglescratch(const Arg *arg); 63 | static void toggletag(const Arg *arg); 64 | static void toggleview(const Arg *arg); 65 | static void unfocus(Client *c, int setfocus); 66 | @@ -287,6 +291,7 @@ applyrules(Client *c) 67 | /* rule matching */ 68 | c->isfloating = 0; 69 | c->tags = 0; 70 | + c->scratchkey = 0; 71 | XGetClassHint(dpy, c->win, &ch); 72 | class = ch.res_class ? ch.res_class : broken; 73 | instance = ch.res_name ? ch.res_name : broken; 74 | @@ -299,6 +304,7 @@ applyrules(Client *c) 75 | { 76 | c->isfloating = r->isfloating; 77 | c->tags |= r->tags; 78 | + c->scratchkey = r->scratchkey; 79 | for (m = mons; m && m->num != r->monitor; m = m->next); 80 | if (m) 81 | c->mon = m; 82 | @@ -308,6 +314,7 @@ applyrules(Client *c) 83 | XFree(ch.res_class); 84 | if (ch.res_name) 85 | XFree(ch.res_name); 86 | + 87 | c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags]; 88 | } 89 | 90 | @@ -1652,6 +1659,19 @@ spawn(const Arg *arg) 91 | } 92 | } 93 | 94 | +void spawnscratch(const Arg *arg) 95 | +{ 96 | + if (fork() == 0) { 97 | + if (dpy) 98 | + close(ConnectionNumber(dpy)); 99 | + setsid(); 100 | + execvp(((char **)arg->v)[1], ((char **)arg->v)+1); 101 | + fprintf(stderr, "dwm: execvp %s", ((char **)arg->v)[1]); 102 | + perror(" failed"); 103 | + exit(EXIT_SUCCESS); 104 | + } 105 | +} 106 | + 107 | void 108 | tag(const Arg *arg) 109 | { 110 | @@ -1720,6 +1740,28 @@ togglefloating(const Arg *arg) 111 | } 112 | 113 | void 114 | +togglescratch(const Arg *arg) 115 | +{ 116 | + Client *c; 117 | + unsigned int found = 0; 118 | + 119 | + for (c = selmon->clients; c && !(found = c->scratchkey == ((char**)arg->v)[0][0]); c = c->next); 120 | + if (found) { 121 | + c->tags = ISVISIBLE(c) ? 0 : selmon->tagset[selmon->seltags]; 122 | + focus(NULL); 123 | + arrange(selmon); 124 | + 125 | + if (ISVISIBLE(c)) { 126 | + focus(c); 127 | + restack(selmon); 128 | + } 129 | + 130 | + } else{ 131 | + spawnscratch(arg); 132 | + } 133 | +} 134 | + 135 | +void 136 | toggletag(const Arg *arg) 137 | { 138 | unsigned int newtags; 139 | -------------------------------------------------------------------------------- /patches/dwm-statuscolors-20181008-b69c870.diff: -------------------------------------------------------------------------------- 1 | From 35418d156fccb922710f6ca80a1f3972ba88b42f Mon Sep 17 00:00:00 2001 2 | From: Danny O'Brien 3 | Date: Mon, 8 Oct 2018 19:21:29 -0700 4 | Subject: [PATCH] Add colors to status message in bar. 5 | 6 | This patch matches the format used by 7 | https://dwm.suckless.org/patches/statuscolors/ -- An \x01 character 8 | switches to the normal foreground/color combo, \x02 switches to the 9 | color combo used for selected tags, \03 is set by default to black on 10 | yellow, \04 is white on red. 11 | 12 | These color settings are defined in the colors array in config.def.h. 13 | More can be added, but don't have more than 32, or you'll start hitting 14 | real ASCII. 15 | 16 | This applies cleanly on mainline dwm from commit 022d076 (Sat Jan 7 17 | 17:21:29 2017 +0100) until at least b69c870 (Sat Jun 2 17:15:42 2018 18 | +020). 19 | 20 | --- 21 | config.def.h | 13 ++++++++++--- 22 | dwm.c | 18 ++++++++++++++++-- 23 | 2 files changed, 26 insertions(+), 5 deletions(-) 24 | 25 | diff --git a/config.def.h b/config.def.h 26 | index 1c0b587..df92695 100644 27 | --- a/config.def.h 28 | +++ b/config.def.h 29 | @@ -12,10 +12,17 @@ static const char col_gray2[] = "#444444"; 30 | static const char col_gray3[] = "#bbbbbb"; 31 | static const char col_gray4[] = "#eeeeee"; 32 | static const char col_cyan[] = "#005577"; 33 | +static const char col_black[] = "#000000"; 34 | +static const char col_red[] = "#ff0000"; 35 | +static const char col_yellow[] = "#ffff00"; 36 | +static const char col_white[] = "#ffffff"; 37 | + 38 | static const char *colors[][3] = { 39 | - /* fg bg border */ 40 | - [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, 41 | - [SchemeSel] = { col_gray4, col_cyan, col_cyan }, 42 | + /* fg bg border */ 43 | + [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, 44 | + [SchemeSel] = { col_gray4, col_cyan, col_cyan }, 45 | + [SchemeWarn] = { col_black, col_yellow, col_red }, 46 | + [SchemeUrgent]= { col_white, col_red, col_red }, 47 | }; 48 | 49 | /* tagging */ 50 | diff --git a/dwm.c b/dwm.c 51 | index 4465af1..9d9d46f 100644 52 | --- a/dwm.c 53 | +++ b/dwm.c 54 | @@ -59,7 +59,7 @@ 55 | 56 | /* enums */ 57 | enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ 58 | -enum { SchemeNorm, SchemeSel }; /* color schemes */ 59 | +enum { SchemeNorm, SchemeSel, SchemeWarn, SchemeUrgent }; /* color schemes */ 60 | enum { NetSupported, NetWMName, NetWMState, NetWMCheck, 61 | NetWMFullscreen, NetActiveWindow, NetWMWindowType, 62 | NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ 63 | @@ -699,13 +699,27 @@ drawbar(Monitor *m) 64 | int boxs = drw->fonts->h / 9; 65 | int boxw = drw->fonts->h / 6 + 2; 66 | unsigned int i, occ = 0, urg = 0; 67 | + char *ts = stext; 68 | + char *tp = stext; 69 | + int tx = 0; 70 | + char ctmp; 71 | Client *c; 72 | 73 | /* draw status first so it can be overdrawn by tags later */ 74 | if (m == selmon) { /* status is only drawn on selected monitor */ 75 | drw_setscheme(drw, scheme[SchemeNorm]); 76 | sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */ 77 | - drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0); 78 | + while (1) { 79 | + if ((unsigned int)*ts > LENGTH(colors)) { ts++; continue ; } 80 | + ctmp = *ts; 81 | + *ts = '\0'; 82 | + drw_text(drw, m->ww - sw + tx, 0, sw - tx, bh, 0, tp, 0); 83 | + tx += TEXTW(tp) -lrpad; 84 | + if (ctmp == '\0') { break; } 85 | + drw_setscheme(drw, scheme[(unsigned int)(ctmp-1)]); 86 | + *ts = ctmp; 87 | + tp = ++ts; 88 | + } 89 | } 90 | 91 | for (c = m->clients; c; c = c->next) { 92 | -- 93 | 2.19.1 94 | 95 | -------------------------------------------------------------------------------- /patches/dwm-titlecolor-20210815-ed3ab6b4.diff: -------------------------------------------------------------------------------- 1 | From 45a45a0e67f3841d8c4aed2c52b57c2a7ddf2a9a Mon Sep 17 00:00:00 2001 2 | From: Jack Bird 3 | Date: Sun, 15 Aug 2021 23:15:52 +0100 4 | Subject: [PATCH] Updated title color patch for 7162335 5 | 6 | --- 7 | config.def.h | 1 + 8 | dwm.c | 4 ++-- 9 | 2 files changed, 3 insertions(+), 2 deletions(-) 10 | 11 | diff --git a/config.def.h b/config.def.h 12 | index a2ac963..5b9ae00 100644 13 | --- a/config.def.h 14 | +++ b/config.def.h 15 | @@ -16,6 +16,7 @@ static const char *colors[][3] = { 16 | /* fg bg border */ 17 | [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, 18 | [SchemeSel] = { col_gray4, col_cyan, col_cyan }, 19 | + [SchemeTitle] = { col_gray4, col_cyan, col_cyan }, 20 | }; 21 | 22 | /* tagging */ 23 | diff --git a/dwm.c b/dwm.c 24 | index 5e4d494..73d335e 100644 25 | --- a/dwm.c 26 | +++ b/dwm.c 27 | @@ -59,7 +59,7 @@ 28 | 29 | /* enums */ 30 | enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ 31 | -enum { SchemeNorm, SchemeSel }; /* color schemes */ 32 | +enum { SchemeNorm, SchemeSel, SchemeTitle }; /* color schemes */ 33 | enum { NetSupported, NetWMName, NetWMState, NetWMCheck, 34 | NetWMFullscreen, NetActiveWindow, NetWMWindowType, 35 | NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ 36 | @@ -731,7 +731,7 @@ drawbar(Monitor *m) 37 | 38 | if ((w = m->ww - tw - x) > bh) { 39 | if (m->sel) { 40 | - drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); 41 | + drw_setscheme(drw, scheme[m == selmon ? SchemeTitle : SchemeNorm]); 42 | drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); 43 | if (m->sel->isfloating) 44 | drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); 45 | -- 46 | 2.32.0 47 | 48 | -------------------------------------------------------------------------------- /patches/dwm-uselessgap-6.2.diff: -------------------------------------------------------------------------------- 1 | From 58a5ece9406ca6c90dc362617c065e4aac19417f Mon Sep 17 00:00:00 2001 2 | From: Cyril Cressent 3 | Date: Wed, 3 Jul 2019 21:33:45 -0700 4 | Subject: [PATCH] Port the uselessgap patch to 6.2 5 | 6 | --- 7 | config.def.h | 1 + 8 | dwm.c | 36 ++++++++++++++++++++++++++++++------ 9 | 2 files changed, 31 insertions(+), 6 deletions(-) 10 | 11 | diff --git a/config.def.h b/config.def.h 12 | index 1c0b587..b11471d 100644 13 | --- a/config.def.h 14 | +++ b/config.def.h 15 | @@ -2,6 +2,7 @@ 16 | 17 | /* appearance */ 18 | static const unsigned int borderpx = 1; /* border pixel of windows */ 19 | +static const unsigned int gappx = 6; /* gaps between windows */ 20 | static const unsigned int snap = 32; /* snap pixel */ 21 | static const int showbar = 1; /* 0 means no bar */ 22 | static const int topbar = 1; /* 0 means bottom bar */ 23 | diff --git a/dwm.c b/dwm.c 24 | index 4465af1..4545e05 100644 25 | --- a/dwm.c 26 | +++ b/dwm.c 27 | @@ -52,8 +52,8 @@ 28 | #define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags])) 29 | #define LENGTH(X) (sizeof X / sizeof X[0]) 30 | #define MOUSEMASK (BUTTONMASK|PointerMotionMask) 31 | -#define WIDTH(X) ((X)->w + 2 * (X)->bw) 32 | -#define HEIGHT(X) ((X)->h + 2 * (X)->bw) 33 | +#define WIDTH(X) ((X)->w + 2 * (X)->bw + gappx) 34 | +#define HEIGHT(X) ((X)->h + 2 * (X)->bw + gappx) 35 | #define TAGMASK ((1 << LENGTH(tags)) - 1) 36 | #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) 37 | 38 | @@ -1276,12 +1276,36 @@ void 39 | resizeclient(Client *c, int x, int y, int w, int h) 40 | { 41 | XWindowChanges wc; 42 | + unsigned int n; 43 | + unsigned int gapoffset; 44 | + unsigned int gapincr; 45 | + Client *nbc; 46 | 47 | - c->oldx = c->x; c->x = wc.x = x; 48 | - c->oldy = c->y; c->y = wc.y = y; 49 | - c->oldw = c->w; c->w = wc.width = w; 50 | - c->oldh = c->h; c->h = wc.height = h; 51 | wc.border_width = c->bw; 52 | + 53 | + /* Get number of clients for the selected monitor */ 54 | + for (n = 0, nbc = nexttiled(selmon->clients); nbc; nbc = nexttiled(nbc->next), n++); 55 | + 56 | + /* Do nothing if layout is floating */ 57 | + if (c->isfloating || selmon->lt[selmon->sellt]->arrange == NULL) { 58 | + gapincr = gapoffset = 0; 59 | + } else { 60 | + /* Remove border and gap if layout is monocle or only one client */ 61 | + if (selmon->lt[selmon->sellt]->arrange == monocle || n == 1) { 62 | + gapoffset = 0; 63 | + gapincr = -2 * borderpx; 64 | + wc.border_width = 0; 65 | + } else { 66 | + gapoffset = gappx; 67 | + gapincr = 2 * gappx; 68 | + } 69 | + } 70 | + 71 | + c->oldx = c->x; c->x = wc.x = x + gapoffset; 72 | + c->oldy = c->y; c->y = wc.y = y + gapoffset; 73 | + c->oldw = c->w; c->w = wc.width = w - gapincr; 74 | + c->oldh = c->h; c->h = wc.height = h - gapincr; 75 | + 76 | XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); 77 | configure(c); 78 | XSync(dpy, False); 79 | -- 80 | 2.22.0 81 | 82 | -------------------------------------------------------------------------------- /patches/dwm-viewontag-20210312-61bb8b2.diff: -------------------------------------------------------------------------------- 1 | From 03d3c172ff736cb80e12f7bb7cab4e1f250af9dd Mon Sep 17 00:00:00 2001 2 | From: Marco Fleres 3 | Date: Fri, 12 Mar 2021 22:25:53 -0300 4 | Subject: [PATCH] Modification on viewontag patch: windows will not be followed 5 | to the "all" tag 6 | 7 | --- 8 | config.def.h | 1 + 9 | dwm.c | 2 ++ 10 | 2 files changed, 3 insertions(+) 11 | 12 | diff --git a/config.def.h b/config.def.h 13 | index 1c0b587..d7dfb6d 100644 14 | --- a/config.def.h 15 | +++ b/config.def.h 16 | @@ -5,6 +5,7 @@ static const unsigned int borderpx = 1; /* border pixel of windows */ 17 | static const unsigned int snap = 32; /* snap pixel */ 18 | static const int showbar = 1; /* 0 means no bar */ 19 | static const int topbar = 1; /* 0 means bottom bar */ 20 | +static const Bool viewontag = True; /* Switch view on tag switch */ 21 | static const char *fonts[] = { "monospace:size=10" }; 22 | static const char dmenufont[] = "monospace:size=10"; 23 | static const char col_gray1[] = "#222222"; 24 | diff --git a/dwm.c b/dwm.c 25 | index 664c527..8ca2f98 100644 26 | --- a/dwm.c 27 | +++ b/dwm.c 28 | @@ -1660,6 +1660,8 @@ tag(const Arg *arg) 29 | selmon->sel->tags = arg->ui & TAGMASK; 30 | focus(NULL); 31 | arrange(selmon); 32 | + if(viewontag && ((arg->ui & TAGMASK) != TAGMASK)) 33 | + view(arg); 34 | } 35 | } 36 | 37 | -- 38 | 2.30.1 39 | 40 | -------------------------------------------------------------------------------- /st-0.8.4/FAQ: -------------------------------------------------------------------------------- 1 | ## Why does st not handle utmp entries? 2 | 3 | Use the excellent tool of [utmp](https://git.suckless.org/utmp/) for this task. 4 | 5 | 6 | ## Some _random program_ complains that st is unknown/not recognised/unsupported/whatever! 7 | 8 | It means that st doesn’t have any terminfo entry on your system. Chances are 9 | you did not `make install`. If you just want to test it without installing it, 10 | you can manually run `tic -sx st.info`. 11 | 12 | 13 | ## Nothing works, and nothing is said about an unknown terminal! 14 | 15 | * Some programs just assume they’re running in xterm i.e. they don’t rely on 16 | terminfo. What you see is the current state of the “xterm compliance”. 17 | * Some programs don’t complain about the lacking st description and default to 18 | another terminal. In that case see the question about terminfo. 19 | 20 | 21 | ## How do I scroll back up? 22 | 23 | * Using a terminal multiplexer. 24 | * `st -e tmux` using C-b [ 25 | * `st -e screen` using C-a ESC 26 | * Using the excellent tool of [scroll](https://git.suckless.org/scroll/). 27 | * Using the scrollback [patch](https://st.suckless.org/patches/scrollback/). 28 | 29 | 30 | ## I would like to have utmp and/or scroll functionality by default 31 | 32 | You can add the absolute patch of both programs in your config.h 33 | file. You only have to modify the value of utmp and scroll variables. 34 | 35 | 36 | ## Why doesn't the Del key work in some programs? 37 | 38 | Taken from the terminfo manpage: 39 | 40 | If the terminal has a keypad that transmits codes when the keys 41 | are pressed, this information can be given. Note that it is not 42 | possible to handle terminals where the keypad only works in 43 | local (this applies, for example, to the unshifted HP 2621 keys). 44 | If the keypad can be set to transmit or not transmit, give these 45 | codes as smkx and rmkx. Otherwise the keypad is assumed to 46 | always transmit. 47 | 48 | In the st case smkx=E[?1hE= and rmkx=E[?1lE>, so it is mandatory that 49 | applications which want to test against keypad keys send these 50 | sequences. 51 | 52 | But buggy applications (like bash and irssi, for example) don't do this. A fast 53 | solution for them is to use the following command: 54 | 55 | $ printf '\033[?1h\033=' >/dev/tty 56 | 57 | or 58 | $ tput smkx 59 | 60 | In the case of bash, readline is used. Readline has a different note in its 61 | manpage about this issue: 62 | 63 | enable-keypad (Off) 64 | When set to On, readline will try to enable the 65 | application keypad when it is called. Some systems 66 | need this to enable arrow keys. 67 | 68 | Adding this option to your .inputrc will fix the keypad problem for all 69 | applications using readline. 70 | 71 | If you are using zsh, then read the zsh FAQ 72 | : 73 | 74 | It should be noted that the O / [ confusion can occur with other keys 75 | such as Home and End. Some systems let you query the key sequences 76 | sent by these keys from the system's terminal database, terminfo. 77 | Unfortunately, the key sequences given there typically apply to the 78 | mode that is not the one zsh uses by default (it's the "application" 79 | mode rather than the "raw" mode). Explaining the use of terminfo is 80 | outside of the scope of this FAQ, but if you wish to use the key 81 | sequences given there you can tell the line editor to turn on 82 | "application" mode when it starts and turn it off when it stops: 83 | 84 | function zle-line-init () { echoti smkx } 85 | function zle-line-finish () { echoti rmkx } 86 | zle -N zle-line-init 87 | zle -N zle-line-finish 88 | 89 | Putting these lines into your .zshrc will fix the problems. 90 | 91 | 92 | ## How can I use meta in 8bit mode? 93 | 94 | St supports meta in 8bit mode, but the default terminfo entry doesn't 95 | use this capability. If you want it, you have to use the 'st-meta' value 96 | in TERM. 97 | 98 | 99 | ## I cannot compile st in OpenBSD 100 | 101 | OpenBSD lacks librt, despite it being mandatory in POSIX 102 | . 103 | If you want to compile st for OpenBSD you have to remove -lrt from config.mk, and 104 | st will compile without any loss of functionality, because all the functions are 105 | included in libc on this platform. 106 | 107 | 108 | ## The Backspace Case 109 | 110 | St is emulating the Linux way of handling backspace being delete and delete being 111 | backspace. 112 | 113 | This is an issue that was discussed in suckless mailing list 114 | . Here is why some old grumpy 115 | terminal users wants its backspace to be how he feels it: 116 | 117 | Well, I am going to comment why I want to change the behaviour 118 | of this key. When ASCII was defined in 1968, communication 119 | with computers was done using punched cards, or hardcopy 120 | terminals (basically a typewriter machine connected with the 121 | computer using a serial port). ASCII defines DELETE as 7F, 122 | because, in punched-card terms, it means all the holes of the 123 | card punched; it is thus a kind of 'physical delete'. In the 124 | same way, the BACKSPACE key was a non-destructive backspace, 125 | as on a typewriter. So, if you wanted to delete a character, 126 | you had to BACKSPACE and then DELETE. Another use of BACKSPACE 127 | was to type accented characters, for example 'a BACKSPACE `'. 128 | The VT100 had no BACKSPACE key; it was generated using the 129 | CONTROL key as another control character (CONTROL key sets to 130 | 0 b7 b6 b5, so it converts H (code 0x48) into BACKSPACE (code 131 | 0x08)), but it had a DELETE key in a similar position where 132 | the BACKSPACE key is located today on common PC keyboards. 133 | All the terminal emulators emulated the difference between 134 | these keys correctly: the backspace key generated a BACKSPACE 135 | (^H) and delete key generated a DELETE (^?). 136 | 137 | But a problem arose when Linus Torvalds wrote Linux. Unlike 138 | earlier terminals, the Linux virtual terminal (the terminal 139 | emulator integrated in the kernel) returned a DELETE when 140 | backspace was pressed, due to the VT100 having a DELETE key in 141 | the same position. This created a lot of problems (see [1] 142 | and [2]). Since Linux has become the king, a lot of terminal 143 | emulators today generate a DELETE when the backspace key is 144 | pressed in order to avoid problems with Linux. The result is 145 | that the only way of generating a BACKSPACE on these systems 146 | is by using CONTROL + H. (I also think that emacs had an 147 | important point here because the CONTROL + H prefix is used 148 | in emacs in some commands (help commands).) 149 | 150 | From point of view of the kernel, you can change the key 151 | for deleting a previous character with stty erase. When you 152 | connect a real terminal into a machine you describe the type 153 | of terminal, so getty configures the correct value of stty 154 | erase for this terminal. In the case of terminal emulators, 155 | however, you don't have any getty that can set the correct 156 | value of stty erase, so you always get the default value. 157 | For this reason, it is necessary to add 'stty erase ^H' to your 158 | profile if you have changed the value of the backspace key. 159 | Of course, another solution is for st itself to modify the 160 | value of stty erase. I usually have the inverse problem: 161 | when I connect to non-Unix machines, I have to press CONTROL + 162 | h to get a BACKSPACE. The inverse problem occurs when a user 163 | connects to my Unix machines from a different system with a 164 | correct backspace key. 165 | 166 | [1] http://www.ibb.net/~anne/keyboard.html 167 | [2] http://www.tldp.org/HOWTO/Keyboard-and-Console-HOWTO-5.html 168 | 169 | 170 | ## But I really want the old grumpy behaviour of my terminal 171 | 172 | Apply [1]. 173 | 174 | [1] https://st.suckless.org/patches/delkey 175 | 176 | 177 | ## Why do images not work in st using the w3m image hack? 178 | 179 | w3mimg uses a hack that draws an image on top of the terminal emulator Drawable 180 | window. The hack relies on the terminal to use a single buffer to draw its 181 | contents directly. 182 | 183 | st uses double-buffered drawing so the image is quickly replaced and may show a 184 | short flicker effect. 185 | 186 | Below is a patch example to change st double-buffering to a single Drawable 187 | buffer. 188 | 189 | diff --git a/x.c b/x.c 190 | --- a/x.c 191 | +++ b/x.c 192 | @@ -732,10 +732,6 @@ xresize(int col, int row) 193 | win.tw = col * win.cw; 194 | win.th = row * win.ch; 195 | 196 | - XFreePixmap(xw.dpy, xw.buf); 197 | - xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, 198 | - DefaultDepth(xw.dpy, xw.scr)); 199 | - XftDrawChange(xw.draw, xw.buf); 200 | xclear(0, 0, win.w, win.h); 201 | 202 | /* resize to new width */ 203 | @@ -1148,8 +1144,7 @@ xinit(int cols, int rows) 204 | gcvalues.graphics_exposures = False; 205 | dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures, 206 | &gcvalues); 207 | - xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, 208 | - DefaultDepth(xw.dpy, xw.scr)); 209 | + xw.buf = xw.win; 210 | XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel); 211 | XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h); 212 | 213 | @@ -1632,8 +1627,6 @@ xdrawline(Line line, int x1, int y1, int x2) 214 | void 215 | xfinishdraw(void) 216 | { 217 | - XCopyArea(xw.dpy, xw.buf, xw.win, dc.gc, 0, 0, win.w, 218 | - win.h, 0, 0); 219 | XSetForeground(xw.dpy, dc.gc, 220 | dc.col[IS_SET(MODE_REVERSE)? 221 | defaultfg : defaultbg].pixel); 222 | 223 | 224 | ## BadLength X error in Xft when trying to render emoji 225 | 226 | Xft makes st crash when rendering color emojis with the following error: 227 | 228 | "X Error of failed request: BadLength (poly request too large or internal Xlib length error)" 229 | Major opcode of failed request: 139 (RENDER) 230 | Minor opcode of failed request: 20 (RenderAddGlyphs) 231 | Serial number of failed request: 1595 232 | Current serial number in output stream: 1818" 233 | 234 | This is a known bug in Xft (not st) which happens on some platforms and 235 | combination of particular fonts and fontconfig settings. 236 | 237 | See also: 238 | https://gitlab.freedesktop.org/xorg/lib/libxft/issues/6 239 | https://bugs.freedesktop.org/show_bug.cgi?id=107534 240 | https://bugzilla.redhat.com/show_bug.cgi?id=1498269 241 | 242 | The solution is to remove color emoji fonts or disable this in the fontconfig 243 | XML configuration. As an ugly workaround (which may work only on newer 244 | fontconfig versions (FC_COLOR)), the following code can be used to mask color 245 | fonts: 246 | 247 | FcPatternAddBool(fcpattern, FC_COLOR, FcFalse); 248 | 249 | Please don't bother reporting this bug to st, but notify the upstream Xft 250 | developers about fixing this bug. 251 | -------------------------------------------------------------------------------- /st-0.8.4/LEGACY: -------------------------------------------------------------------------------- 1 | A STATEMENT ON LEGACY SUPPORT 2 | 3 | In the terminal world there is much cruft that comes from old and unsup‐ 4 | ported terminals that inherit incompatible modes and escape sequences 5 | which noone is able to know, except when he/she comes from that time and 6 | developed a graphical vt100 emulator at that time. 7 | 8 | One goal of st is to only support what is really needed. When you en‐ 9 | counter a sequence which you really need, implement it. But while you 10 | are at it, do not add the other cruft you might encounter while sneek‐ 11 | ing at other terminal emulators. History has bloated them and there is 12 | no real evidence that most of the sequences are used today. 13 | 14 | 15 | Christoph Lohmann <20h@r-36.net> 16 | 2012-09-13T07:00:36.081271045+02:00 17 | 18 | -------------------------------------------------------------------------------- /st-0.8.4/LICENSE: -------------------------------------------------------------------------------- 1 | MIT/X Consortium License 2 | 3 | © 2014-2020 Hiltjo Posthuma 4 | © 2018 Devin J. Pohly 5 | © 2014-2017 Quentin Rameau 6 | © 2009-2012 Aurélien APTEL 7 | © 2008-2017 Anselm R Garbe 8 | © 2012-2017 Roberto E. Vargas Caballero 9 | © 2012-2016 Christoph Lohmann <20h at r-36 dot net> 10 | © 2013 Eon S. Jeon 11 | © 2013 Alexander Sedov 12 | © 2013 Mark Edgar 13 | © 2013-2014 Eric Pruitt 14 | © 2013 Michael Forney 15 | © 2013-2014 Markus Teich 16 | © 2014-2015 Laslo Hunhold 17 | 18 | Permission is hereby granted, free of charge, to any person obtaining a 19 | copy of this software and associated documentation files (the "Software"), 20 | to deal in the Software without restriction, including without limitation 21 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 22 | and/or sell copies of the Software, and to permit persons to whom the 23 | Software is furnished to do so, subject to the following conditions: 24 | 25 | The above copyright notice and this permission notice shall be included in 26 | all copies or substantial portions of the Software. 27 | 28 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 29 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 30 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 31 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 32 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 33 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 34 | DEALINGS IN THE SOFTWARE. 35 | -------------------------------------------------------------------------------- /st-0.8.4/Makefile: -------------------------------------------------------------------------------- 1 | # st - simple terminal 2 | # See LICENSE file for copyright and license details. 3 | .POSIX: 4 | 5 | include config.mk 6 | 7 | SRC = st.c x.c 8 | OBJ = $(SRC:.c=.o) 9 | 10 | all: options st 11 | 12 | options: 13 | @echo st build options: 14 | @echo "CFLAGS = $(STCFLAGS)" 15 | @echo "LDFLAGS = $(STLDFLAGS)" 16 | @echo "CC = $(CC)" 17 | 18 | config.h: 19 | cp config.def.h config.h 20 | 21 | .c.o: 22 | $(CC) $(STCFLAGS) -c $< 23 | 24 | st.o: config.h st.h win.h 25 | x.o: arg.h config.h st.h win.h 26 | 27 | $(OBJ): config.h config.mk 28 | 29 | st: $(OBJ) 30 | $(CC) -o $@ $(OBJ) $(STLDFLAGS) 31 | 32 | clean: 33 | rm -f st $(OBJ) st-$(VERSION).tar.gz 34 | 35 | dist: clean 36 | mkdir -p st-$(VERSION) 37 | cp -R FAQ LEGACY TODO LICENSE Makefile README config.mk\ 38 | config.def.h st.info st.1 arg.h st.h win.h $(SRC)\ 39 | st-$(VERSION) 40 | tar -cf - st-$(VERSION) | gzip > st-$(VERSION).tar.gz 41 | rm -rf st-$(VERSION) 42 | 43 | install: st 44 | mkdir -p $(DESTDIR)$(PREFIX)/bin 45 | cp -f st $(DESTDIR)$(PREFIX)/bin 46 | chmod 755 $(DESTDIR)$(PREFIX)/bin/st 47 | mkdir -p $(DESTDIR)$(MANPREFIX)/man1 48 | sed "s/VERSION/$(VERSION)/g" < st.1 > $(DESTDIR)$(MANPREFIX)/man1/st.1 49 | chmod 644 $(DESTDIR)$(MANPREFIX)/man1/st.1 50 | tic -sx st.info 51 | @echo Please see the README file regarding the terminfo entry of st. 52 | 53 | uninstall: 54 | rm -f $(DESTDIR)$(PREFIX)/bin/st 55 | rm -f $(DESTDIR)$(MANPREFIX)/man1/st.1 56 | 57 | .PHONY: all options clean dist install uninstall 58 | -------------------------------------------------------------------------------- /st-0.8.4/README: -------------------------------------------------------------------------------- 1 | st - simple terminal 2 | -------------------- 3 | st is a simple terminal emulator for X which sucks less. 4 | 5 | 6 | Requirements 7 | ------------ 8 | In order to build st you need the Xlib header files. 9 | 10 | 11 | Installation 12 | ------------ 13 | Edit config.mk to match your local setup (st is installed into 14 | the /usr/local namespace by default). 15 | 16 | Afterwards enter the following command to build and install st (if 17 | necessary as root): 18 | 19 | make clean install 20 | 21 | 22 | Running st 23 | ---------- 24 | If you did not install st with make clean install, you must compile 25 | the st terminfo entry with the following command: 26 | 27 | tic -sx st.info 28 | 29 | See the man page for additional details. 30 | 31 | Credits 32 | ------- 33 | Based on Aurélien APTEL bt source code. 34 | 35 | -------------------------------------------------------------------------------- /st-0.8.4/TODO: -------------------------------------------------------------------------------- 1 | vt emulation 2 | ------------ 3 | 4 | * double-height support 5 | 6 | code & interface 7 | ---------------- 8 | 9 | * add a simple way to do multiplexing 10 | 11 | drawing 12 | ------- 13 | * add diacritics support to xdraws() 14 | * switch to a suckless font drawing library 15 | * make the font cache simpler 16 | * add better support for brightening of the upper colors 17 | 18 | bugs 19 | ---- 20 | 21 | * fix shift up/down (shift selection in emacs) 22 | * remove DEC test sequence when appropriate 23 | 24 | misc 25 | ---- 26 | 27 | $ grep -nE 'XXX|TODO' st.c 28 | 29 | -------------------------------------------------------------------------------- /st-0.8.4/arg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copy me if you can. 3 | * by 20h 4 | */ 5 | 6 | #ifndef ARG_H__ 7 | #define ARG_H__ 8 | 9 | extern char *argv0; 10 | 11 | /* use main(int argc, char *argv[]) */ 12 | #define ARGBEGIN for (argv0 = *argv, argv++, argc--;\ 13 | argv[0] && argv[0][0] == '-'\ 14 | && argv[0][1];\ 15 | argc--, argv++) {\ 16 | char argc_;\ 17 | char **argv_;\ 18 | int brk_;\ 19 | if (argv[0][1] == '-' && argv[0][2] == '\0') {\ 20 | argv++;\ 21 | argc--;\ 22 | break;\ 23 | }\ 24 | int i_;\ 25 | for (i_ = 1, brk_ = 0, argv_ = argv;\ 26 | argv[0][i_] && !brk_;\ 27 | i_++) {\ 28 | if (argv_ != argv)\ 29 | break;\ 30 | argc_ = argv[0][i_];\ 31 | switch (argc_) 32 | 33 | #define ARGEND }\ 34 | } 35 | 36 | #define ARGC() argc_ 37 | 38 | #define EARGF(x) ((argv[0][i_+1] == '\0' && argv[1] == NULL)?\ 39 | ((x), abort(), (char *)0) :\ 40 | (brk_ = 1, (argv[0][i_+1] != '\0')?\ 41 | (&argv[0][i_+1]) :\ 42 | (argc--, argv++, argv[0]))) 43 | 44 | #define ARGF() ((argv[0][i_+1] == '\0' && argv[1] == NULL)?\ 45 | (char *)0 :\ 46 | (brk_ = 1, (argv[0][i_+1] != '\0')?\ 47 | (&argv[0][i_+1]) :\ 48 | (argc--, argv++, argv[0]))) 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /st-0.8.4/config.mk: -------------------------------------------------------------------------------- 1 | # st version 2 | VERSION = 0.8.4 3 | 4 | # Customize below to fit your system 5 | 6 | # paths 7 | PREFIX = /usr/local 8 | MANPREFIX = $(PREFIX)/share/man 9 | 10 | X11INC = /usr/X11R6/include 11 | X11LIB = /usr/X11R6/lib 12 | 13 | PKG_CONFIG = pkg-config 14 | 15 | # includes and libs 16 | INCS = -I$(X11INC) \ 17 | `$(PKG_CONFIG) --cflags fontconfig` \ 18 | `$(PKG_CONFIG) --cflags freetype2` 19 | LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft \ 20 | `$(PKG_CONFIG) --libs fontconfig` \ 21 | `$(PKG_CONFIG) --libs freetype2` 22 | 23 | # flags 24 | STCPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600 25 | STCFLAGS = $(INCS) $(STCPPFLAGS) $(CPPFLAGS) $(CFLAGS) 26 | STLDFLAGS = $(LIBS) $(LDFLAGS) 27 | 28 | # OpenBSD: 29 | #CPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600 -D_BSD_SOURCE 30 | #LIBS = -L$(X11LIB) -lm -lX11 -lutil -lXft \ 31 | # `$(PKG_CONFIG) --libs fontconfig` \ 32 | # `$(PKG_CONFIG) --libs freetype2` 33 | 34 | # compiler and linker 35 | # CC = c99 36 | -------------------------------------------------------------------------------- /st-0.8.4/patches/st-anygeometry-0.8.1.diff: -------------------------------------------------------------------------------- 1 | From 6a5a862569912e34febe2dbd5244062013840204 Mon Sep 17 00:00:00 2001 2 | From: =?UTF-8?q?Jos=C3=A9=20Miguel=20S=C3=A1nchez=20Garc=C3=ADa?= 3 | 4 | Date: Thu, 13 Aug 2020 11:02:01 +0000 5 | Subject: [PATCH] add -G to set pixel-based geometry 6 | 7 | --- 8 | config.def.h | 13 +++++++++++++ 9 | x.c | 36 ++++++++++++++++++++++++++++++++---- 10 | 2 files changed, 45 insertions(+), 4 deletions(-) 11 | 12 | diff --git a/config.def.h b/config.def.h 13 | index 6f05dce..bea316a 100644 14 | --- a/config.def.h 15 | +++ b/config.def.h 16 | @@ -141,6 +141,12 @@ static unsigned int defaultrcs = 257; 17 | */ 18 | static unsigned int cursorshape = 2; 19 | 20 | +/* 21 | + * Whether to use pixel geometry or cell geometry 22 | + */ 23 | + 24 | +static Geometry geometry = CellGeometry; 25 | + 26 | /* 27 | * Default columns and rows numbers 28 | */ 29 | @@ -148,6 +154,13 @@ static unsigned int cursorshape = 2; 30 | static unsigned int cols = 80; 31 | static unsigned int rows = 24; 32 | 33 | +/* 34 | + * Default width and height (including borders!) 35 | + */ 36 | + 37 | +static unsigned int width = 564; 38 | +static unsigned int height = 364; 39 | + 40 | /* 41 | * Default colour and shape of the mouse cursor 42 | */ 43 | diff --git a/x.c b/x.c 44 | index 210f184..29e35d0 100644 45 | --- a/x.c 46 | +++ b/x.c 47 | @@ -45,6 +45,11 @@ typedef struct { 48 | signed char appcursor; /* application cursor */ 49 | } Key; 50 | 51 | +typedef enum { 52 | + PixelGeometry, 53 | + CellGeometry 54 | +} Geometry; 55 | + 56 | /* X modifiers */ 57 | #define XK_ANY_MOD UINT_MAX 58 | #define XK_NO_MOD 0 59 | @@ -1096,7 +1101,7 @@ xicdestroy(XIC xim, XPointer client, XPointer call) 60 | } 61 | 62 | void 63 | -xinit(int cols, int rows) 64 | +xinit(int w, int h) 65 | { 66 | XGCValues gcvalues; 67 | Cursor cursor; 68 | @@ -1121,8 +1126,16 @@ xinit(int cols, int rows) 69 | xloadcols(); 70 | 71 | /* adjust fixed window geometry */ 72 | - win.w = 2 * borderpx + cols * win.cw; 73 | - win.h = 2 * borderpx + rows * win.ch; 74 | + switch (geometry) { 75 | + case CellGeometry: 76 | + win.w = 2 * borderpx + w * win.cw; 77 | + win.h = 2 * borderpx + h * win.ch; 78 | + break; 79 | + case PixelGeometry: 80 | + win.w = w; 81 | + win.h = h; 82 | + break; 83 | + } 84 | if (xw.gm & XNegative) 85 | xw.l += DisplayWidth(xw.dpy, xw.scr) - win.w - 2; 86 | if (xw.gm & YNegative) 87 | @@ -2001,6 +2014,12 @@ main(int argc, char *argv[]) 88 | case 'g': 89 | xw.gm = XParseGeometry(EARGF(usage()), 90 | &xw.l, &xw.t, &cols, &rows); 91 | + geometry = CellGeometry; 92 | + break; 93 | + case 'G': 94 | + xw.gm = XParseGeometry(EARGF(usage()), 95 | + &xw.l, &xw.t, &width, &height); 96 | + geometry = PixelGeometry; 97 | break; 98 | case 'i': 99 | xw.isfixed = 1; 100 | @@ -2037,10 +2056,19 @@ run: 101 | 102 | setlocale(LC_CTYPE, ""); 103 | XSetLocaleModifiers(""); 104 | + switch (geometry) { 105 | + case CellGeometry: 106 | + xinit(cols, rows); 107 | + break; 108 | + case PixelGeometry: 109 | + xinit(width, height); 110 | + cols = (win.w - 2 * borderpx) / win.cw; 111 | + rows = (win.h - 2 * borderpx) / win.ch; 112 | + break; 113 | + } 114 | cols = MAX(cols, 1); 115 | rows = MAX(rows, 1); 116 | tnew(cols, rows); 117 | - xinit(cols, rows); 118 | xsetenv(); 119 | selinit(); 120 | run(); 121 | -- 122 | 2.28.0 123 | 124 | -------------------------------------------------------------------------------- /st-0.8.4/patches/st-blinking_cursor-20200531-a2a7044.diff: -------------------------------------------------------------------------------- 1 | From bff176133618854676bbdc74c0099f184d3da365 Mon Sep 17 00:00:00 2001 2 | From: Steve Ward 3 | Date: Sun, 31 May 2020 22:48:25 -0400 4 | Subject: [PATCH] Allow blinking cursor 5 | 6 | --- 7 | config.def.h | 19 +++++++++++++------ 8 | x.c | 42 ++++++++++++++++++++++++++++++++---------- 9 | 2 files changed, 45 insertions(+), 16 deletions(-) 10 | 11 | diff --git a/config.def.h b/config.def.h 12 | index 6f05dce..3dbe915 100644 13 | --- a/config.def.h 14 | +++ b/config.def.h 15 | @@ -133,13 +133,20 @@ static unsigned int defaultcs = 256; 16 | static unsigned int defaultrcs = 257; 17 | 18 | /* 19 | - * Default shape of cursor 20 | - * 2: Block ("█") 21 | - * 4: Underline ("_") 22 | - * 6: Bar ("|") 23 | - * 7: Snowman ("☃") 24 | + * https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h4-Functions-using-CSI-_-ordered-by-the-final-character-lparen-s-rparen:CSI-Ps-SP-q.1D81 25 | + * Default style of cursor 26 | + * 0: Blinking block 27 | + * 1: Blinking block (default) 28 | + * 2: Steady block ("█") 29 | + * 3: Blinking underline 30 | + * 4: Steady underline ("_") 31 | + * 5: Blinking bar 32 | + * 6: Steady bar ("|") 33 | + * 7: Blinking st cursor 34 | + * 8: Steady st cursor 35 | */ 36 | -static unsigned int cursorshape = 2; 37 | +static unsigned int cursorstyle = 1; 38 | +static Rune stcursor = 0x2603; /* snowman (U+2603) */ 39 | 40 | /* 41 | * Default columns and rows numbers 42 | diff --git a/x.c b/x.c 43 | index 210f184..bd80a5e 100644 44 | --- a/x.c 45 | +++ b/x.c 46 | @@ -253,6 +253,7 @@ static char *opt_name = NULL; 47 | static char *opt_title = NULL; 48 | 49 | static int oldbutton = 3; /* button event on startup: 3 = release */ 50 | +static int cursorblinks = 0; 51 | 52 | void 53 | clipcopy(const Arg *dummy) 54 | @@ -1526,16 +1527,19 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) 55 | /* draw the new one */ 56 | if (IS_SET(MODE_FOCUSED)) { 57 | switch (win.cursor) { 58 | - case 7: /* st extension */ 59 | - g.u = 0x2603; /* snowman (U+2603) */ 60 | + case 0: /* Blinking block */ 61 | + case 1: /* Blinking block (default) */ 62 | + if (IS_SET(MODE_BLINK)) 63 | + break; 64 | /* FALLTHROUGH */ 65 | - case 0: /* Blinking Block */ 66 | - case 1: /* Blinking Block (Default) */ 67 | - case 2: /* Steady Block */ 68 | + case 2: /* Steady block */ 69 | xdrawglyph(g, cx, cy); 70 | break; 71 | - case 3: /* Blinking Underline */ 72 | - case 4: /* Steady Underline */ 73 | + case 3: /* Blinking underline */ 74 | + if (IS_SET(MODE_BLINK)) 75 | + break; 76 | + /* FALLTHROUGH */ 77 | + case 4: /* Steady underline */ 78 | XftDrawRect(xw.draw, &drawcol, 79 | borderpx + cx * win.cw, 80 | borderpx + (cy + 1) * win.ch - \ 81 | @@ -1543,12 +1547,23 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) 82 | win.cw, cursorthickness); 83 | break; 84 | case 5: /* Blinking bar */ 85 | + if (IS_SET(MODE_BLINK)) 86 | + break; 87 | + /* FALLTHROUGH */ 88 | case 6: /* Steady bar */ 89 | XftDrawRect(xw.draw, &drawcol, 90 | borderpx + cx * win.cw, 91 | borderpx + cy * win.ch, 92 | cursorthickness, win.ch); 93 | break; 94 | + case 7: /* Blinking st cursor */ 95 | + if (IS_SET(MODE_BLINK)) 96 | + break; 97 | + /* FALLTHROUGH */ 98 | + case 8: /* Steady st cursor */ 99 | + g.u = stcursor; 100 | + xdrawglyph(g, cx, cy); 101 | + break; 102 | } 103 | } else { 104 | XftDrawRect(xw.draw, &drawcol, 105 | @@ -1690,9 +1705,12 @@ xsetmode(int set, unsigned int flags) 106 | int 107 | xsetcursor(int cursor) 108 | { 109 | - if (!BETWEEN(cursor, 0, 7)) /* 7: st extension */ 110 | + if (!BETWEEN(cursor, 0, 8)) /* 7-8: st extensions */ 111 | return 1; 112 | win.cursor = cursor; 113 | + cursorblinks = win.cursor == 0 || win.cursor == 1 || 114 | + win.cursor == 3 || win.cursor == 5 || 115 | + win.cursor == 7; 116 | return 0; 117 | } 118 | 119 | @@ -1936,6 +1954,10 @@ run(void) 120 | if (FD_ISSET(ttyfd, &rfd) || xev) { 121 | if (!drawing) { 122 | trigger = now; 123 | + if (IS_SET(MODE_BLINK)) { 124 | + win.mode ^= MODE_BLINK; 125 | + } 126 | + lastblink = now; 127 | drawing = 1; 128 | } 129 | timeout = (maxlatency - TIMEDIFF(now, trigger)) \ 130 | @@ -1946,7 +1968,7 @@ run(void) 131 | 132 | /* idle detected or maxlatency exhausted -> draw */ 133 | timeout = -1; 134 | - if (blinktimeout && tattrset(ATTR_BLINK)) { 135 | + if (blinktimeout && (cursorblinks || tattrset(ATTR_BLINK))) { 136 | timeout = blinktimeout - TIMEDIFF(now, lastblink); 137 | if (timeout <= 0) { 138 | if (-timeout > blinktimeout) /* start visible */ 139 | @@ -1982,7 +2004,7 @@ main(int argc, char *argv[]) 140 | { 141 | xw.l = xw.t = 0; 142 | xw.isfixed = False; 143 | - xsetcursor(cursorshape); 144 | + xsetcursor(cursorstyle); 145 | 146 | ARGBEGIN { 147 | case 'a': 148 | -- 149 | 2.20.1 150 | 151 | -------------------------------------------------------------------------------- /st-0.8.4/patches/st-scrollback-20210507-4536f46.diff: -------------------------------------------------------------------------------- 1 | diff --git a/config.def.h b/config.def.h 2 | index 6f05dce..93cbcc0 100644 3 | --- a/config.def.h 4 | +++ b/config.def.h 5 | @@ -199,6 +199,8 @@ static Shortcut shortcuts[] = { 6 | { TERMMOD, XK_Y, selpaste, {.i = 0} }, 7 | { ShiftMask, XK_Insert, selpaste, {.i = 0} }, 8 | { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, 9 | + { ShiftMask, XK_Page_Up, kscrollup, {.i = -1} }, 10 | + { ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} }, 11 | }; 12 | 13 | /* 14 | diff --git a/st.c b/st.c 15 | index ebdf360..817cc47 100644 16 | --- a/st.c 17 | +++ b/st.c 18 | @@ -35,6 +35,7 @@ 19 | #define ESC_ARG_SIZ 16 20 | #define STR_BUF_SIZ ESC_BUF_SIZ 21 | #define STR_ARG_SIZ ESC_ARG_SIZ 22 | +#define HISTSIZE 2000 23 | 24 | /* macros */ 25 | #define IS_SET(flag) ((term.mode & (flag)) != 0) 26 | @@ -42,6 +43,9 @@ 27 | #define ISCONTROLC1(c) (BETWEEN(c, 0x80, 0x9f)) 28 | #define ISCONTROL(c) (ISCONTROLC0(c) || ISCONTROLC1(c)) 29 | #define ISDELIM(u) (u && wcschr(worddelimiters, u)) 30 | +#define TLINE(y) ((y) < term.scr ? term.hist[((y) + term.histi - \ 31 | + term.scr + HISTSIZE + 1) % HISTSIZE] : \ 32 | + term.line[(y) - term.scr]) 33 | 34 | enum term_mode { 35 | MODE_WRAP = 1 << 0, 36 | @@ -115,6 +119,9 @@ typedef struct { 37 | int col; /* nb col */ 38 | Line *line; /* screen */ 39 | Line *alt; /* alternate screen */ 40 | + Line hist[HISTSIZE]; /* history buffer */ 41 | + int histi; /* history index */ 42 | + int scr; /* scroll back */ 43 | int *dirty; /* dirtyness of lines */ 44 | TCursor c; /* cursor */ 45 | int ocx; /* old cursor col */ 46 | @@ -184,8 +191,8 @@ static void tnewline(int); 47 | static void tputtab(int); 48 | static void tputc(Rune); 49 | static void treset(void); 50 | -static void tscrollup(int, int); 51 | -static void tscrolldown(int, int); 52 | +static void tscrollup(int, int, int); 53 | +static void tscrolldown(int, int, int); 54 | static void tsetattr(const int *, int); 55 | static void tsetchar(Rune, const Glyph *, int, int); 56 | static void tsetdirt(int, int); 57 | @@ -416,10 +423,10 @@ tlinelen(int y) 58 | { 59 | int i = term.col; 60 | 61 | - if (term.line[y][i - 1].mode & ATTR_WRAP) 62 | + if (TLINE(y)[i - 1].mode & ATTR_WRAP) 63 | return i; 64 | 65 | - while (i > 0 && term.line[y][i - 1].u == ' ') 66 | + while (i > 0 && TLINE(y)[i - 1].u == ' ') 67 | --i; 68 | 69 | return i; 70 | @@ -528,7 +535,7 @@ selsnap(int *x, int *y, int direction) 71 | * Snap around if the word wraps around at the end or 72 | * beginning of a line. 73 | */ 74 | - prevgp = &term.line[*y][*x]; 75 | + prevgp = &TLINE(*y)[*x]; 76 | prevdelim = ISDELIM(prevgp->u); 77 | for (;;) { 78 | newx = *x + direction; 79 | @@ -543,14 +550,14 @@ selsnap(int *x, int *y, int direction) 80 | yt = *y, xt = *x; 81 | else 82 | yt = newy, xt = newx; 83 | - if (!(term.line[yt][xt].mode & ATTR_WRAP)) 84 | + if (!(TLINE(yt)[xt].mode & ATTR_WRAP)) 85 | break; 86 | } 87 | 88 | if (newx >= tlinelen(newy)) 89 | break; 90 | 91 | - gp = &term.line[newy][newx]; 92 | + gp = &TLINE(newy)[newx]; 93 | delim = ISDELIM(gp->u); 94 | if (!(gp->mode & ATTR_WDUMMY) && (delim != prevdelim 95 | || (delim && gp->u != prevgp->u))) 96 | @@ -571,14 +578,14 @@ selsnap(int *x, int *y, int direction) 97 | *x = (direction < 0) ? 0 : term.col - 1; 98 | if (direction < 0) { 99 | for (; *y > 0; *y += direction) { 100 | - if (!(term.line[*y-1][term.col-1].mode 101 | + if (!(TLINE(*y-1)[term.col-1].mode 102 | & ATTR_WRAP)) { 103 | break; 104 | } 105 | } 106 | } else if (direction > 0) { 107 | for (; *y < term.row-1; *y += direction) { 108 | - if (!(term.line[*y][term.col-1].mode 109 | + if (!(TLINE(*y)[term.col-1].mode 110 | & ATTR_WRAP)) { 111 | break; 112 | } 113 | @@ -609,13 +616,13 @@ getsel(void) 114 | } 115 | 116 | if (sel.type == SEL_RECTANGULAR) { 117 | - gp = &term.line[y][sel.nb.x]; 118 | + gp = &TLINE(y)[sel.nb.x]; 119 | lastx = sel.ne.x; 120 | } else { 121 | - gp = &term.line[y][sel.nb.y == y ? sel.nb.x : 0]; 122 | + gp = &TLINE(y)[sel.nb.y == y ? sel.nb.x : 0]; 123 | lastx = (sel.ne.y == y) ? sel.ne.x : term.col-1; 124 | } 125 | - last = &term.line[y][MIN(lastx, linelen-1)]; 126 | + last = &TLINE(y)[MIN(lastx, linelen-1)]; 127 | while (last >= gp && last->u == ' ') 128 | --last; 129 | 130 | @@ -850,6 +857,9 @@ void 131 | ttywrite(const char *s, size_t n, int may_echo) 132 | { 133 | const char *next; 134 | + Arg arg = (Arg) { .i = term.scr }; 135 | + 136 | + kscrolldown(&arg); 137 | 138 | if (may_echo && IS_SET(MODE_ECHO)) 139 | twrite(s, n, 1); 140 | @@ -1061,13 +1071,53 @@ tswapscreen(void) 141 | } 142 | 143 | void 144 | -tscrolldown(int orig, int n) 145 | +kscrolldown(const Arg* a) 146 | +{ 147 | + int n = a->i; 148 | + 149 | + if (n < 0) 150 | + n = term.row + n; 151 | + 152 | + if (n > term.scr) 153 | + n = term.scr; 154 | + 155 | + if (term.scr > 0) { 156 | + term.scr -= n; 157 | + selscroll(0, -n); 158 | + tfulldirt(); 159 | + } 160 | +} 161 | + 162 | +void 163 | +kscrollup(const Arg* a) 164 | +{ 165 | + int n = a->i; 166 | + 167 | + if (n < 0) 168 | + n = term.row + n; 169 | + 170 | + if (term.scr <= HISTSIZE-n) { 171 | + term.scr += n; 172 | + selscroll(0, n); 173 | + tfulldirt(); 174 | + } 175 | +} 176 | + 177 | +void 178 | +tscrolldown(int orig, int n, int copyhist) 179 | { 180 | int i; 181 | Line temp; 182 | 183 | LIMIT(n, 0, term.bot-orig+1); 184 | 185 | + if (copyhist) { 186 | + term.histi = (term.histi - 1 + HISTSIZE) % HISTSIZE; 187 | + temp = term.hist[term.histi]; 188 | + term.hist[term.histi] = term.line[term.bot]; 189 | + term.line[term.bot] = temp; 190 | + } 191 | + 192 | tsetdirt(orig, term.bot-n); 193 | tclearregion(0, term.bot-n+1, term.col-1, term.bot); 194 | 195 | @@ -1077,17 +1127,28 @@ tscrolldown(int orig, int n) 196 | term.line[i-n] = temp; 197 | } 198 | 199 | - selscroll(orig, n); 200 | + if (term.scr == 0) 201 | + selscroll(orig, n); 202 | } 203 | 204 | void 205 | -tscrollup(int orig, int n) 206 | +tscrollup(int orig, int n, int copyhist) 207 | { 208 | int i; 209 | Line temp; 210 | 211 | LIMIT(n, 0, term.bot-orig+1); 212 | 213 | + if (copyhist) { 214 | + term.histi = (term.histi + 1) % HISTSIZE; 215 | + temp = term.hist[term.histi]; 216 | + term.hist[term.histi] = term.line[orig]; 217 | + term.line[orig] = temp; 218 | + } 219 | + 220 | + if (term.scr > 0 && term.scr < HISTSIZE) 221 | + term.scr = MIN(term.scr + n, HISTSIZE-1); 222 | + 223 | tclearregion(0, orig, term.col-1, orig+n-1); 224 | tsetdirt(orig+n, term.bot); 225 | 226 | @@ -1097,7 +1158,8 @@ tscrollup(int orig, int n) 227 | term.line[i+n] = temp; 228 | } 229 | 230 | - selscroll(orig, -n); 231 | + if (term.scr == 0) 232 | + selscroll(orig, -n); 233 | } 234 | 235 | void 236 | @@ -1126,7 +1188,7 @@ tnewline(int first_col) 237 | int y = term.c.y; 238 | 239 | if (y == term.bot) { 240 | - tscrollup(term.top, 1); 241 | + tscrollup(term.top, 1, 1); 242 | } else { 243 | y++; 244 | } 245 | @@ -1291,14 +1353,14 @@ void 246 | tinsertblankline(int n) 247 | { 248 | if (BETWEEN(term.c.y, term.top, term.bot)) 249 | - tscrolldown(term.c.y, n); 250 | + tscrolldown(term.c.y, n, 0); 251 | } 252 | 253 | void 254 | tdeleteline(int n) 255 | { 256 | if (BETWEEN(term.c.y, term.top, term.bot)) 257 | - tscrollup(term.c.y, n); 258 | + tscrollup(term.c.y, n, 0); 259 | } 260 | 261 | int32_t 262 | @@ -1735,11 +1797,11 @@ csihandle(void) 263 | break; 264 | case 'S': /* SU -- Scroll line up */ 265 | DEFAULT(csiescseq.arg[0], 1); 266 | - tscrollup(term.top, csiescseq.arg[0]); 267 | + tscrollup(term.top, csiescseq.arg[0], 0); 268 | break; 269 | case 'T': /* SD -- Scroll line down */ 270 | DEFAULT(csiescseq.arg[0], 1); 271 | - tscrolldown(term.top, csiescseq.arg[0]); 272 | + tscrolldown(term.top, csiescseq.arg[0], 0); 273 | break; 274 | case 'L': /* IL -- Insert blank lines */ 275 | DEFAULT(csiescseq.arg[0], 1); 276 | @@ -2251,7 +2313,7 @@ eschandle(uchar ascii) 277 | return 0; 278 | case 'D': /* IND -- Linefeed */ 279 | if (term.c.y == term.bot) { 280 | - tscrollup(term.top, 1); 281 | + tscrollup(term.top, 1, 1); 282 | } else { 283 | tmoveto(term.c.x, term.c.y+1); 284 | } 285 | @@ -2264,7 +2326,7 @@ eschandle(uchar ascii) 286 | break; 287 | case 'M': /* RI -- Reverse index */ 288 | if (term.c.y == term.top) { 289 | - tscrolldown(term.top, 1); 290 | + tscrolldown(term.top, 1, 1); 291 | } else { 292 | tmoveto(term.c.x, term.c.y-1); 293 | } 294 | @@ -2474,7 +2536,7 @@ twrite(const char *buf, int buflen, int show_ctrl) 295 | void 296 | tresize(int col, int row) 297 | { 298 | - int i; 299 | + int i, j; 300 | int minrow = MIN(row, term.row); 301 | int mincol = MIN(col, term.col); 302 | int *bp; 303 | @@ -2511,6 +2573,14 @@ tresize(int col, int row) 304 | term.dirty = xrealloc(term.dirty, row * sizeof(*term.dirty)); 305 | term.tabs = xrealloc(term.tabs, col * sizeof(*term.tabs)); 306 | 307 | + for (i = 0; i < HISTSIZE; i++) { 308 | + term.hist[i] = xrealloc(term.hist[i], col * sizeof(Glyph)); 309 | + for (j = mincol; j < col; j++) { 310 | + term.hist[i][j] = term.c.attr; 311 | + term.hist[i][j].u = ' '; 312 | + } 313 | + } 314 | + 315 | /* resize each row to new width, zero-pad if needed */ 316 | for (i = 0; i < minrow; i++) { 317 | term.line[i] = xrealloc(term.line[i], col * sizeof(Glyph)); 318 | @@ -2569,7 +2639,7 @@ drawregion(int x1, int y1, int x2, int y2) 319 | continue; 320 | 321 | term.dirty[y] = 0; 322 | - xdrawline(term.line[y], x1, y, x2); 323 | + xdrawline(TLINE(y), x1, y, x2); 324 | } 325 | } 326 | 327 | @@ -2590,8 +2660,9 @@ draw(void) 328 | cx--; 329 | 330 | drawregion(0, 0, term.col, term.row); 331 | - xdrawcursor(cx, term.c.y, term.line[term.c.y][cx], 332 | - term.ocx, term.ocy, term.line[term.ocy][term.ocx]); 333 | + if (term.scr == 0) 334 | + xdrawcursor(cx, term.c.y, term.line[term.c.y][cx], 335 | + term.ocx, term.ocy, term.line[term.ocy][term.ocx]); 336 | term.ocx = cx; 337 | term.ocy = term.c.y; 338 | xfinishdraw(); 339 | diff --git a/st.h b/st.h 340 | index fa2eddf..adda2db 100644 341 | --- a/st.h 342 | +++ b/st.h 343 | @@ -81,6 +81,8 @@ void die(const char *, ...); 344 | void redraw(void); 345 | void draw(void); 346 | 347 | +void kscrolldown(const Arg *); 348 | +void kscrollup(const Arg *); 349 | void printscreen(const Arg *); 350 | void printsel(const Arg *); 351 | void sendbreak(const Arg *); 352 | -------------------------------------------------------------------------------- /st-0.8.4/patches/st-scrollback-mouse-20191024-a2c479c.diff: -------------------------------------------------------------------------------- 1 | diff --git a/config.def.h b/config.def.h 2 | index ec1b576..4b3bf15 100644 3 | --- a/config.def.h 4 | +++ b/config.def.h 5 | @@ -163,6 +163,8 @@ static uint forcemousemod = ShiftMask; 6 | */ 7 | static MouseShortcut mshortcuts[] = { 8 | /* mask button function argument release */ 9 | + { ShiftMask, Button4, kscrollup, {.i = 1} }, 10 | + { ShiftMask, Button5, kscrolldown, {.i = 1} }, 11 | { XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 }, 12 | { XK_ANY_MOD, Button4, ttysend, {.s = "\031"} }, 13 | { XK_ANY_MOD, Button5, ttysend, {.s = "\005"} }, 14 | -------------------------------------------------------------------------------- /st-0.8.4/patches/st-scrollback-mouse-altscreen-20200416-5703aa0.diff: -------------------------------------------------------------------------------- 1 | diff --git a/config.def.h b/config.def.h 2 | index 4b3bf15..1986316 100644 3 | --- a/config.def.h 4 | +++ b/config.def.h 5 | @@ -163,8 +163,8 @@ static uint forcemousemod = ShiftMask; 6 | */ 7 | static MouseShortcut mshortcuts[] = { 8 | /* mask button function argument release */ 9 | - { ShiftMask, Button4, kscrollup, {.i = 1} }, 10 | - { ShiftMask, Button5, kscrolldown, {.i = 1} }, 11 | + { XK_ANY_MOD, Button4, kscrollup, {.i = 1}, 0, /* !alt */ -1 }, 12 | + { XK_ANY_MOD, Button5, kscrolldown, {.i = 1}, 0, /* !alt */ -1 }, 13 | { XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 }, 14 | { XK_ANY_MOD, Button4, ttysend, {.s = "\031"} }, 15 | { XK_ANY_MOD, Button5, ttysend, {.s = "\005"} }, 16 | diff --git a/st.c b/st.c 17 | index f8b6f67..dd4cb31 100644 18 | --- st.c 19 | +++ st.c 20 | @@ -1045,6 +1045,11 @@ tnew(int col, int row) 21 | treset(); 22 | } 23 | 24 | +int tisaltscr(void) 25 | +{ 26 | + return IS_SET(MODE_ALTSCREEN); 27 | +} 28 | + 29 | void 30 | tswapscreen(void) 31 | { 32 | diff --git a/st.h b/st.h 33 | index 1332cf1..f9ad815 100644 34 | --- st.h 35 | +++ st.h 36 | @@ -89,6 +89,7 @@ void sendbreak(const Arg *); 37 | void toggleprinter(const Arg *); 38 | 39 | int tattrset(int); 40 | +int tisaltscr(void); 41 | void tnew(int, int); 42 | void tresize(int, int); 43 | void tsetdirtattr(int); 44 | diff --git a/x.c b/x.c 45 | index e5f1737..b8fbd7b 100644 46 | --- x.c 47 | +++ x.c 48 | @@ -34,6 +34,7 @@ typedef struct { 49 | void (*func)(const Arg *); 50 | const Arg arg; 51 | uint release; 52 | + int altscrn; /* 0: don't care, -1: not alt screen, 1: alt screen */ 53 | } MouseShortcut; 54 | 55 | typedef struct { 56 | @@ -446,6 +447,7 @@ mouseaction(XEvent *e, uint release) 57 | for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) { 58 | if (ms->release == release && 59 | ms->button == e->xbutton.button && 60 | + (!ms->altscrn || (ms->altscrn == (tisaltscr() ? 1 : -1))) && 61 | (match(ms->mod, state) || /* exact or forced */ 62 | match(ms->mod, state & ~forcemousemod))) { 63 | ms->func(&(ms->arg)); 64 | -------------------------------------------------------------------------------- /st-0.8.4/patches/st-scrollback-mouse-increment-0.8.2.diff: -------------------------------------------------------------------------------- 1 | From 63e717e51dcd2f59c7a3aa75b659926aa92e08f3 Mon Sep 17 00:00:00 2001 2 | From: Jacob Louis Prosser 3 | Date: Mon, 5 Aug 2019 18:20:25 +1000 4 | Subject: [st] [patch] Exposed variable to easily change mouse scroll increment. 5 | 6 | --- 7 | config.def.h | 5 +++-- 8 | 1 file changed, 3 insertions(+), 2 deletions(-) 9 | 10 | diff --git a/config.def.h b/config.def.h 11 | index ad20c4c..47e4b66 100644 12 | --- a/config.def.h 13 | +++ b/config.def.h 14 | @@ -154,6 +154,7 @@ static unsigned int defaultattr = 11; 15 | * Internal mouse shortcuts. 16 | * Beware that overloading Button1 will disable the selection. 17 | */ 18 | +const unsigned int mousescrollincrement = 1; 19 | static MouseShortcut mshortcuts[] = { 20 | /* button mask string */ 21 | { Button4, XK_NO_MOD, "\031" }, 22 | @@ -162,8 +163,8 @@ static MouseShortcut mshortcuts[] = { 23 | 24 | MouseKey mkeys[] = { 25 | /* button mask function argument */ 26 | - { Button4, ShiftMask, kscrollup, {.i = 1} }, 27 | - { Button5, ShiftMask, kscrolldown, {.i = 1} }, 28 | + { Button4, ShiftMask, kscrollup, {.i = mousescrollincrement} }, 29 | + { Button5, ShiftMask, kscrolldown, {.i = mousescrollincrement} }, 30 | }; 31 | 32 | /* Internal keyboard shortcuts. */ 33 | -- 34 | 2.22.0 35 | -------------------------------------------------------------------------------- /st-0.8.4/patches/st-universcroll-0.8.4.diff: -------------------------------------------------------------------------------- 1 | From 9726b1e58352126252412e101432e64d46fc51ca Mon Sep 17 00:00:00 2001 2 | From: Dennis Lee 3 | Date: Sun, 28 Jun 2020 23:01:03 -0700 4 | Subject: [PATCH] universcroll: mouse wheel only scroll in all modes 5 | 6 | Scroll normally via scroll(1), without Shift, when outside of 7 | `MODE_ALTSCREEN`. Inside an alt screen, continue to scroll normally 8 | without Shift; in this mode, your scrolling is automatically translated 9 | into ^Y and ^E. It just werks! 10 | 11 | Based on the existing mouse-altscreen patch 12 | https://st.suckless.org/patches/scrollback/ 13 | adapted for st(1) 0.8.4 and scroll(1). 14 | --- 15 | config.def.h | 10 +++++----- 16 | st.c | 5 +++++ 17 | st.h | 1 + 18 | x.c | 2 ++ 19 | 4 files changed, 13 insertions(+), 5 deletions(-) 20 | 21 | diff --git a/config.def.h b/config.def.h 22 | index 6f05dce..62e87da 100644 23 | --- a/config.def.h 24 | +++ b/config.def.h 25 | @@ -173,11 +173,11 @@ static uint forcemousemod = ShiftMask; 26 | * Beware that overloading Button1 will disable the selection. 27 | */ 28 | static MouseShortcut mshortcuts[] = { 29 | - /* mask button function argument release */ 30 | - { XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 }, 31 | - { ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} }, 32 | + /* mask button function argument release alt */ 33 | + { XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 }, 34 | + { XK_ANY_MOD, Button4, ttysend, {.s = "\033[5;2~"}, 0, -1 }, 35 | { XK_ANY_MOD, Button4, ttysend, {.s = "\031"} }, 36 | - { ShiftMask, Button5, ttysend, {.s = "\033[6;2~"} }, 37 | + { XK_ANY_MOD, Button5, ttysend, {.s = "\033[6;2~"}, 0, -1 }, 38 | { XK_ANY_MOD, Button5, ttysend, {.s = "\005"} }, 39 | }; 40 | 41 | diff --git a/st.c b/st.c 42 | index 76b7e0d..1f65453 100644 43 | --- a/st.c 44 | +++ b/st.c 45 | @@ -1047,6 +1047,11 @@ tnew(int col, int row) 46 | treset(); 47 | } 48 | 49 | +int tisaltscr(void) 50 | +{ 51 | + return IS_SET(MODE_ALTSCREEN); 52 | +} 53 | + 54 | void 55 | tswapscreen(void) 56 | { 57 | diff --git a/st.h b/st.h 58 | index 3d351b6..39cc054 100644 59 | --- a/st.h 60 | +++ b/st.h 61 | @@ -87,6 +87,7 @@ void sendbreak(const Arg *); 62 | void toggleprinter(const Arg *); 63 | 64 | int tattrset(int); 65 | +int tisaltscr(void); 66 | void tnew(int, int); 67 | void tresize(int, int); 68 | void tsetdirtattr(int); 69 | diff --git a/x.c b/x.c 70 | index 210f184..210dde9 100644 71 | --- a/x.c 72 | +++ b/x.c 73 | @@ -34,6 +34,7 @@ typedef struct { 74 | void (*func)(const Arg *); 75 | const Arg arg; 76 | uint release; 77 | + int altscrn; /* 0: don't care, -1: not alt screen, 1: alt screen */ 78 | } MouseShortcut; 79 | 80 | typedef struct { 81 | @@ -446,6 +447,7 @@ mouseaction(XEvent *e, uint release) 82 | for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) { 83 | if (ms->release == release && 84 | ms->button == e->xbutton.button && 85 | + (!ms->altscrn || (ms->altscrn == (tisaltscr() ? 1 : -1))) && 86 | (match(ms->mod, state) || /* exact or forced */ 87 | match(ms->mod, state & ~forcemousemod))) { 88 | ms->func(&(ms->arg)); 89 | -- 90 | 2.27.0 91 | -------------------------------------------------------------------------------- /st-0.8.4/patches/st-w3m-0.8.3.diff: -------------------------------------------------------------------------------- 1 | From 69cffc587b54b0a9cd81adb87abad8e526d5b25b Mon Sep 17 00:00:00 2001 2 | From: "Avi Halachmi (:avih)" 3 | Date: Thu, 4 Jun 2020 17:35:08 +0300 4 | Subject: [PATCH] support w3m images 5 | 6 | w3m images are a hack which renders on top of the terminal's drawable, 7 | which didn't work in st because when using double buffering, the front 8 | buffer (on which w3m draws its images) is ignored, and st draws only 9 | on the back buffer, which is then copied to the front buffer. 10 | 11 | There's a patch to make it work at the FAQ already, but that patch 12 | canceles double-buffering, which can have negative side effects on 13 | some cases such as flickering. 14 | 15 | This patch achieves the same goal but instead of canceling the double 16 | buffer it first copies the front buffer to the back buffer. 17 | 18 | This has the same issues as the FAQ patch in that the cursor line is 19 | deleted at the image (because st renders always full lines), but 20 | otherwise it's simpler and does keeps double buffering. 21 | --- 22 | x.c | 2 ++ 23 | 1 file changed, 2 insertions(+) 24 | 25 | diff --git a/x.c b/x.c 26 | index e5f1737..b6ae162 100644 27 | --- a/x.c 28 | +++ b/x.c 29 | @@ -1594,6 +1594,8 @@ xsettitle(char *p) 30 | int 31 | xstartdraw(void) 32 | { 33 | + if (IS_SET(MODE_VISIBLE)) 34 | + XCopyArea(xw.dpy, xw.win, xw.buf, dc.gc, 0, 0, win.w, win.h, 0, 0); 35 | return IS_SET(MODE_VISIBLE); 36 | } 37 | 38 | 39 | base-commit: 43a395ae91f7d67ce694e65edeaa7bbc720dd027 40 | -- 41 | 2.17.1 42 | 43 | -------------------------------------------------------------------------------- /st-0.8.4/st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdpedersen1/void-suckless/e01b4cf76ec5fd12be8d9343140410cef355f425/st-0.8.4/st -------------------------------------------------------------------------------- /st-0.8.4/st-anygeometry-0.8.1.diff: -------------------------------------------------------------------------------- 1 | From 6a5a862569912e34febe2dbd5244062013840204 Mon Sep 17 00:00:00 2001 2 | From: =?UTF-8?q?Jos=C3=A9=20Miguel=20S=C3=A1nchez=20Garc=C3=ADa?= 3 | 4 | Date: Thu, 13 Aug 2020 11:02:01 +0000 5 | Subject: [PATCH] add -G to set pixel-based geometry 6 | 7 | --- 8 | config.def.h | 13 +++++++++++++ 9 | x.c | 36 ++++++++++++++++++++++++++++++++---- 10 | 2 files changed, 45 insertions(+), 4 deletions(-) 11 | 12 | diff --git a/config.def.h b/config.def.h 13 | index 6f05dce..bea316a 100644 14 | --- a/config.def.h 15 | +++ b/config.def.h 16 | @@ -141,6 +141,12 @@ static unsigned int defaultrcs = 257; 17 | */ 18 | static unsigned int cursorshape = 2; 19 | 20 | +/* 21 | + * Whether to use pixel geometry or cell geometry 22 | + */ 23 | + 24 | +static Geometry geometry = CellGeometry; 25 | + 26 | /* 27 | * Default columns and rows numbers 28 | */ 29 | @@ -148,6 +154,13 @@ static unsigned int cursorshape = 2; 30 | static unsigned int cols = 80; 31 | static unsigned int rows = 24; 32 | 33 | +/* 34 | + * Default width and height (including borders!) 35 | + */ 36 | + 37 | +static unsigned int width = 564; 38 | +static unsigned int height = 364; 39 | + 40 | /* 41 | * Default colour and shape of the mouse cursor 42 | */ 43 | diff --git a/x.c b/x.c 44 | index 210f184..29e35d0 100644 45 | --- a/x.c 46 | +++ b/x.c 47 | @@ -45,6 +45,11 @@ typedef struct { 48 | signed char appcursor; /* application cursor */ 49 | } Key; 50 | 51 | +typedef enum { 52 | + PixelGeometry, 53 | + CellGeometry 54 | +} Geometry; 55 | + 56 | /* X modifiers */ 57 | #define XK_ANY_MOD UINT_MAX 58 | #define XK_NO_MOD 0 59 | @@ -1096,7 +1101,7 @@ xicdestroy(XIC xim, XPointer client, XPointer call) 60 | } 61 | 62 | void 63 | -xinit(int cols, int rows) 64 | +xinit(int w, int h) 65 | { 66 | XGCValues gcvalues; 67 | Cursor cursor; 68 | @@ -1121,8 +1126,16 @@ xinit(int cols, int rows) 69 | xloadcols(); 70 | 71 | /* adjust fixed window geometry */ 72 | - win.w = 2 * borderpx + cols * win.cw; 73 | - win.h = 2 * borderpx + rows * win.ch; 74 | + switch (geometry) { 75 | + case CellGeometry: 76 | + win.w = 2 * borderpx + w * win.cw; 77 | + win.h = 2 * borderpx + h * win.ch; 78 | + break; 79 | + case PixelGeometry: 80 | + win.w = w; 81 | + win.h = h; 82 | + break; 83 | + } 84 | if (xw.gm & XNegative) 85 | xw.l += DisplayWidth(xw.dpy, xw.scr) - win.w - 2; 86 | if (xw.gm & YNegative) 87 | @@ -2001,6 +2014,12 @@ main(int argc, char *argv[]) 88 | case 'g': 89 | xw.gm = XParseGeometry(EARGF(usage()), 90 | &xw.l, &xw.t, &cols, &rows); 91 | + geometry = CellGeometry; 92 | + break; 93 | + case 'G': 94 | + xw.gm = XParseGeometry(EARGF(usage()), 95 | + &xw.l, &xw.t, &width, &height); 96 | + geometry = PixelGeometry; 97 | break; 98 | case 'i': 99 | xw.isfixed = 1; 100 | @@ -2037,10 +2056,19 @@ run: 101 | 102 | setlocale(LC_CTYPE, ""); 103 | XSetLocaleModifiers(""); 104 | + switch (geometry) { 105 | + case CellGeometry: 106 | + xinit(cols, rows); 107 | + break; 108 | + case PixelGeometry: 109 | + xinit(width, height); 110 | + cols = (win.w - 2 * borderpx) / win.cw; 111 | + rows = (win.h - 2 * borderpx) / win.ch; 112 | + break; 113 | + } 114 | cols = MAX(cols, 1); 115 | rows = MAX(rows, 1); 116 | tnew(cols, rows); 117 | - xinit(cols, rows); 118 | xsetenv(); 119 | selinit(); 120 | run(); 121 | -- 122 | 2.28.0 123 | 124 | -------------------------------------------------------------------------------- /st-0.8.4/st.1: -------------------------------------------------------------------------------- 1 | .TH ST 1 st\-VERSION 2 | .SH NAME 3 | st \- simple terminal 4 | .SH SYNOPSIS 5 | .B st 6 | .RB [ \-aiv ] 7 | .RB [ \-c 8 | .IR class ] 9 | .RB [ \-f 10 | .IR font ] 11 | .RB [ \-g 12 | .IR geometry ] 13 | .RB [ \-n 14 | .IR name ] 15 | .RB [ \-o 16 | .IR iofile ] 17 | .RB [ \-T 18 | .IR title ] 19 | .RB [ \-t 20 | .IR title ] 21 | .RB [ \-l 22 | .IR line ] 23 | .RB [ \-w 24 | .IR windowid ] 25 | .RB [[ \-e ] 26 | .IR command 27 | .RI [ arguments ...]] 28 | .PP 29 | .B st 30 | .RB [ \-aiv ] 31 | .RB [ \-c 32 | .IR class ] 33 | .RB [ \-f 34 | .IR font ] 35 | .RB [ \-g 36 | .IR geometry ] 37 | .RB [ \-n 38 | .IR name ] 39 | .RB [ \-o 40 | .IR iofile ] 41 | .RB [ \-T 42 | .IR title ] 43 | .RB [ \-t 44 | .IR title ] 45 | .RB [ \-w 46 | .IR windowid ] 47 | .RB \-l 48 | .IR line 49 | .RI [ stty_args ...] 50 | .SH DESCRIPTION 51 | .B st 52 | is a simple terminal emulator. 53 | .SH OPTIONS 54 | .TP 55 | .B \-a 56 | disable alternate screens in terminal 57 | .TP 58 | .BI \-c " class" 59 | defines the window class (default $TERM). 60 | .TP 61 | .BI \-f " font" 62 | defines the 63 | .I font 64 | to use when st is run. 65 | .TP 66 | .BI \-g " geometry" 67 | defines the X11 geometry string. 68 | The form is [=][{xX}][{+-}{+-}]. See 69 | .BR XParseGeometry (3) 70 | for further details. 71 | .TP 72 | .B \-i 73 | will fixate the position given with the -g option. 74 | .TP 75 | .BI \-n " name" 76 | defines the window instance name (default $TERM). 77 | .TP 78 | .BI \-o " iofile" 79 | writes all the I/O to 80 | .I iofile. 81 | This feature is useful when recording st sessions. A value of "-" means 82 | standard output. 83 | .TP 84 | .BI \-T " title" 85 | defines the window title (default 'st'). 86 | .TP 87 | .BI \-t " title" 88 | defines the window title (default 'st'). 89 | .TP 90 | .BI \-w " windowid" 91 | embeds st within the window identified by 92 | .I windowid 93 | .TP 94 | .BI \-l " line" 95 | use a tty 96 | .I line 97 | instead of a pseudo terminal. 98 | .I line 99 | should be a (pseudo-)serial device (e.g. /dev/ttyS0 on Linux for serial port 100 | 0). 101 | When this flag is given 102 | remaining arguments are used as flags for 103 | .BR stty(1). 104 | By default st initializes the serial line to 8 bits, no parity, 1 stop bit 105 | and a 38400 baud rate. The speed is set by appending it as last argument 106 | (e.g. 'st -l /dev/ttyS0 115200'). Arguments before the last one are 107 | .BR stty(1) 108 | flags. If you want to set odd parity on 115200 baud use for example 'st -l 109 | /dev/ttyS0 parenb parodd 115200'. Set the number of bits by using for 110 | example 'st -l /dev/ttyS0 cs7 115200'. See 111 | .BR stty(1) 112 | for more arguments and cases. 113 | .TP 114 | .B \-v 115 | prints version information to stderr, then exits. 116 | .TP 117 | .BI \-e " command " [ " arguments " "... ]" 118 | st executes 119 | .I command 120 | instead of the shell. If this is used it 121 | .B must be the last option 122 | on the command line, as in xterm / rxvt. 123 | This option is only intended for compatibility, 124 | and all the remaining arguments are used as a command 125 | even without it. 126 | .SH SHORTCUTS 127 | .TP 128 | .B Break 129 | Send a break in the serial line. 130 | Break key is obtained in PC keyboards 131 | pressing at the same time control and pause. 132 | .TP 133 | .B Ctrl-Print Screen 134 | Toggle if st should print to the 135 | .I iofile. 136 | .TP 137 | .B Shift-Print Screen 138 | Print the full screen to the 139 | .I iofile. 140 | .TP 141 | .B Print Screen 142 | Print the selection to the 143 | .I iofile. 144 | .TP 145 | .B Ctrl-Shift-Page Up 146 | Increase font size. 147 | .TP 148 | .B Ctrl-Shift-Page Down 149 | Decrease font size. 150 | .TP 151 | .B Ctrl-Shift-Home 152 | Reset to default font size. 153 | .TP 154 | .B Ctrl-Shift-y 155 | Paste from primary selection (middle mouse button). 156 | .TP 157 | .B Ctrl-Shift-c 158 | Copy the selected text to the clipboard selection. 159 | .TP 160 | .B Ctrl-Shift-v 161 | Paste from the clipboard selection. 162 | .SH CUSTOMIZATION 163 | .B st 164 | can be customized by creating a custom config.h and (re)compiling the source 165 | code. This keeps it fast, secure and simple. 166 | .SH AUTHORS 167 | See the LICENSE file for the authors. 168 | .SH LICENSE 169 | See the LICENSE file for the terms of redistribution. 170 | .SH SEE ALSO 171 | .BR tabbed (1), 172 | .BR utmp (1), 173 | .BR stty (1), 174 | .BR scroll (1) 175 | .SH BUGS 176 | See the TODO file in the distribution. 177 | 178 | -------------------------------------------------------------------------------- /st-0.8.4/st.h: -------------------------------------------------------------------------------- 1 | /* See LICENSE for license details. */ 2 | 3 | #include 4 | #include 5 | 6 | /* macros */ 7 | #define MIN(a, b) ((a) < (b) ? (a) : (b)) 8 | #define MAX(a, b) ((a) < (b) ? (b) : (a)) 9 | #define LEN(a) (sizeof(a) / sizeof(a)[0]) 10 | #define BETWEEN(x, a, b) ((a) <= (x) && (x) <= (b)) 11 | #define DIVCEIL(n, d) (((n) + ((d) - 1)) / (d)) 12 | #define DEFAULT(a, b) (a) = (a) ? (a) : (b) 13 | #define LIMIT(x, a, b) (x) = (x) < (a) ? (a) : (x) > (b) ? (b) : (x) 14 | #define ATTRCMP(a, b) ((a).mode != (b).mode || (a).fg != (b).fg || \ 15 | (a).bg != (b).bg) 16 | #define TIMEDIFF(t1, t2) ((t1.tv_sec-t2.tv_sec)*1000 + \ 17 | (t1.tv_nsec-t2.tv_nsec)/1E6) 18 | #define MODBIT(x, set, bit) ((set) ? ((x) |= (bit)) : ((x) &= ~(bit))) 19 | 20 | #define TRUECOLOR(r,g,b) (1 << 24 | (r) << 16 | (g) << 8 | (b)) 21 | #define IS_TRUECOL(x) (1 << 24 & (x)) 22 | 23 | enum glyph_attribute { 24 | ATTR_NULL = 0, 25 | ATTR_BOLD = 1 << 0, 26 | ATTR_FAINT = 1 << 1, 27 | ATTR_ITALIC = 1 << 2, 28 | ATTR_UNDERLINE = 1 << 3, 29 | ATTR_BLINK = 1 << 4, 30 | ATTR_REVERSE = 1 << 5, 31 | ATTR_INVISIBLE = 1 << 6, 32 | ATTR_STRUCK = 1 << 7, 33 | ATTR_WRAP = 1 << 8, 34 | ATTR_WIDE = 1 << 9, 35 | ATTR_WDUMMY = 1 << 10, 36 | ATTR_BOLD_FAINT = ATTR_BOLD | ATTR_FAINT, 37 | }; 38 | 39 | enum selection_mode { 40 | SEL_IDLE = 0, 41 | SEL_EMPTY = 1, 42 | SEL_READY = 2 43 | }; 44 | 45 | enum selection_type { 46 | SEL_REGULAR = 1, 47 | SEL_RECTANGULAR = 2 48 | }; 49 | 50 | enum selection_snap { 51 | SNAP_WORD = 1, 52 | SNAP_LINE = 2 53 | }; 54 | 55 | typedef unsigned char uchar; 56 | typedef unsigned int uint; 57 | typedef unsigned long ulong; 58 | typedef unsigned short ushort; 59 | 60 | typedef uint_least32_t Rune; 61 | 62 | #define Glyph Glyph_ 63 | typedef struct { 64 | Rune u; /* character code */ 65 | ushort mode; /* attribute flags */ 66 | uint32_t fg; /* foreground */ 67 | uint32_t bg; /* background */ 68 | } Glyph; 69 | 70 | typedef Glyph *Line; 71 | 72 | typedef union { 73 | int i; 74 | uint ui; 75 | float f; 76 | const void *v; 77 | const char *s; 78 | } Arg; 79 | 80 | void die(const char *, ...); 81 | void redraw(void); 82 | void draw(void); 83 | 84 | void kscrolldown(const Arg *); 85 | void kscrollup(const Arg *); 86 | void printscreen(const Arg *); 87 | void printsel(const Arg *); 88 | void sendbreak(const Arg *); 89 | void toggleprinter(const Arg *); 90 | 91 | int tattrset(int); 92 | int tisaltscr(void); 93 | void tnew(int, int); 94 | void tresize(int, int); 95 | void tsetdirtattr(int); 96 | void ttyhangup(void); 97 | int ttynew(char *, char *, char *, char **); 98 | size_t ttyread(void); 99 | void ttyresize(int, int); 100 | void ttywrite(const char *, size_t, int); 101 | 102 | void resettitle(void); 103 | 104 | void selclear(void); 105 | void selinit(void); 106 | void selstart(int, int, int); 107 | void selextend(int, int, int, int); 108 | int selected(int, int); 109 | char *getsel(void); 110 | 111 | size_t utf8encode(Rune, char *); 112 | 113 | void *xmalloc(size_t); 114 | void *xrealloc(void *, size_t); 115 | char *xstrdup(char *); 116 | 117 | /* config.h globals */ 118 | extern char *utmp; 119 | extern char *scroll; 120 | extern char *stty_args; 121 | extern char *vtiden; 122 | extern wchar_t *worddelimiters; 123 | extern int allowaltscreen; 124 | extern int allowwindowops; 125 | extern char *termname; 126 | extern unsigned int tabspaces; 127 | extern unsigned int defaultfg; 128 | extern unsigned int defaultbg; 129 | -------------------------------------------------------------------------------- /st-0.8.4/st.info: -------------------------------------------------------------------------------- 1 | st-mono| simpleterm monocolor, 2 | acsc=+C\,D-A.B0E``aaffgghFiGjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, 3 | am, 4 | bce, 5 | bel=^G, 6 | blink=\E[5m, 7 | bold=\E[1m, 8 | cbt=\E[Z, 9 | cvvis=\E[?25h, 10 | civis=\E[?25l, 11 | clear=\E[H\E[2J, 12 | cnorm=\E[?12l\E[?25h, 13 | colors#2, 14 | cols#80, 15 | cr=^M, 16 | csr=\E[%i%p1%d;%p2%dr, 17 | cub=\E[%p1%dD, 18 | cub1=^H, 19 | cud1=^J, 20 | cud=\E[%p1%dB, 21 | cuf1=\E[C, 22 | cuf=\E[%p1%dC, 23 | cup=\E[%i%p1%d;%p2%dH, 24 | cuu1=\E[A, 25 | cuu=\E[%p1%dA, 26 | dch=\E[%p1%dP, 27 | dch1=\E[P, 28 | dim=\E[2m, 29 | dl=\E[%p1%dM, 30 | dl1=\E[M, 31 | ech=\E[%p1%dX, 32 | ed=\E[J, 33 | el=\E[K, 34 | el1=\E[1K, 35 | enacs=\E)0, 36 | flash=\E[?5h$<80/>\E[?5l, 37 | fsl=^G, 38 | home=\E[H, 39 | hpa=\E[%i%p1%dG, 40 | hs, 41 | ht=^I, 42 | hts=\EH, 43 | ich=\E[%p1%d@, 44 | il1=\E[L, 45 | il=\E[%p1%dL, 46 | ind=^J, 47 | indn=\E[%p1%dS, 48 | invis=\E[8m, 49 | is2=\E[4l\E>\E[?1034l, 50 | it#8, 51 | kel=\E[1;2F, 52 | ked=\E[1;5F, 53 | ka1=\E[1~, 54 | ka3=\E[5~, 55 | kc1=\E[4~, 56 | kc3=\E[6~, 57 | kbs=\177, 58 | kcbt=\E[Z, 59 | kb2=\EOu, 60 | kcub1=\EOD, 61 | kcud1=\EOB, 62 | kcuf1=\EOC, 63 | kcuu1=\EOA, 64 | kDC=\E[3;2~, 65 | kent=\EOM, 66 | kEND=\E[1;2F, 67 | kIC=\E[2;2~, 68 | kNXT=\E[6;2~, 69 | kPRV=\E[5;2~, 70 | kHOM=\E[1;2H, 71 | kLFT=\E[1;2D, 72 | kRIT=\E[1;2C, 73 | kind=\E[1;2B, 74 | kri=\E[1;2A, 75 | kclr=\E[3;5~, 76 | kdl1=\E[3;2~, 77 | kdch1=\E[3~, 78 | kich1=\E[2~, 79 | kend=\E[4~, 80 | kf1=\EOP, 81 | kf2=\EOQ, 82 | kf3=\EOR, 83 | kf4=\EOS, 84 | kf5=\E[15~, 85 | kf6=\E[17~, 86 | kf7=\E[18~, 87 | kf8=\E[19~, 88 | kf9=\E[20~, 89 | kf10=\E[21~, 90 | kf11=\E[23~, 91 | kf12=\E[24~, 92 | kf13=\E[1;2P, 93 | kf14=\E[1;2Q, 94 | kf15=\E[1;2R, 95 | kf16=\E[1;2S, 96 | kf17=\E[15;2~, 97 | kf18=\E[17;2~, 98 | kf19=\E[18;2~, 99 | kf20=\E[19;2~, 100 | kf21=\E[20;2~, 101 | kf22=\E[21;2~, 102 | kf23=\E[23;2~, 103 | kf24=\E[24;2~, 104 | kf25=\E[1;5P, 105 | kf26=\E[1;5Q, 106 | kf27=\E[1;5R, 107 | kf28=\E[1;5S, 108 | kf29=\E[15;5~, 109 | kf30=\E[17;5~, 110 | kf31=\E[18;5~, 111 | kf32=\E[19;5~, 112 | kf33=\E[20;5~, 113 | kf34=\E[21;5~, 114 | kf35=\E[23;5~, 115 | kf36=\E[24;5~, 116 | kf37=\E[1;6P, 117 | kf38=\E[1;6Q, 118 | kf39=\E[1;6R, 119 | kf40=\E[1;6S, 120 | kf41=\E[15;6~, 121 | kf42=\E[17;6~, 122 | kf43=\E[18;6~, 123 | kf44=\E[19;6~, 124 | kf45=\E[20;6~, 125 | kf46=\E[21;6~, 126 | kf47=\E[23;6~, 127 | kf48=\E[24;6~, 128 | kf49=\E[1;3P, 129 | kf50=\E[1;3Q, 130 | kf51=\E[1;3R, 131 | kf52=\E[1;3S, 132 | kf53=\E[15;3~, 133 | kf54=\E[17;3~, 134 | kf55=\E[18;3~, 135 | kf56=\E[19;3~, 136 | kf57=\E[20;3~, 137 | kf58=\E[21;3~, 138 | kf59=\E[23;3~, 139 | kf60=\E[24;3~, 140 | kf61=\E[1;4P, 141 | kf62=\E[1;4Q, 142 | kf63=\E[1;4R, 143 | khome=\E[1~, 144 | kil1=\E[2;5~, 145 | krmir=\E[2;2~, 146 | knp=\E[6~, 147 | kmous=\E[M, 148 | kpp=\E[5~, 149 | lines#24, 150 | mir, 151 | msgr, 152 | npc, 153 | op=\E[39;49m, 154 | pairs#64, 155 | mc0=\E[i, 156 | mc4=\E[4i, 157 | mc5=\E[5i, 158 | rc=\E8, 159 | rev=\E[7m, 160 | ri=\EM, 161 | rin=\E[%p1%dT, 162 | ritm=\E[23m, 163 | rmacs=\E(B, 164 | rmcup=\E[?1049l, 165 | rmir=\E[4l, 166 | rmkx=\E[?1l\E>, 167 | rmso=\E[27m, 168 | rmul=\E[24m, 169 | rs1=\Ec, 170 | rs2=\E[4l\E>\E[?1034l, 171 | sc=\E7, 172 | sitm=\E[3m, 173 | sgr0=\E[0m, 174 | smacs=\E(0, 175 | smcup=\E[?1049h, 176 | smir=\E[4h, 177 | smkx=\E[?1h\E=, 178 | smso=\E[7m, 179 | smul=\E[4m, 180 | tbc=\E[3g, 181 | tsl=\E]0;, 182 | xenl, 183 | vpa=\E[%i%p1%dd, 184 | # XTerm extensions 185 | rmxx=\E[29m, 186 | smxx=\E[9m, 187 | # disabled rep for now: causes some issues with older ncurses versions. 188 | # rep=%p1%c\E[%p2%{1}%-%db, 189 | # tmux extensions, see TERMINFO EXTENSIONS in tmux(1) 190 | Tc, 191 | Ms=\E]52;%p1%s;%p2%s\007, 192 | Se=\E[2 q, 193 | Ss=\E[%p1%d q, 194 | 195 | st| simpleterm, 196 | use=st-mono, 197 | colors#8, 198 | setab=\E[4%p1%dm, 199 | setaf=\E[3%p1%dm, 200 | setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, 201 | setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, 202 | sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m, 203 | 204 | st-256color| simpleterm with 256 colors, 205 | use=st, 206 | ccc, 207 | colors#256, 208 | oc=\E]104\007, 209 | pairs#32767, 210 | # Nicked from xterm-256color 211 | initc=\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\, 212 | setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m, 213 | setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m, 214 | 215 | st-meta| simpleterm with meta key, 216 | use=st, 217 | km, 218 | rmm=\E[?1034l, 219 | smm=\E[?1034h, 220 | rs2=\E[4l\E>\E[?1034h, 221 | is2=\E[4l\E>\E[?1034h, 222 | 223 | st-meta-256color| simpleterm with meta key and 256 colors, 224 | use=st-256color, 225 | km, 226 | rmm=\E[?1034l, 227 | smm=\E[?1034h, 228 | rs2=\E[4l\E>\E[?1034h, 229 | is2=\E[4l\E>\E[?1034h, 230 | 231 | st-bs| simpleterm with backspace as backspace, 232 | use=st, 233 | kbs=\010, 234 | kdch1=\177, 235 | 236 | st-bs-256color| simpleterm with backspace as backspace and 256colors, 237 | use=st-256color, 238 | kbs=\010, 239 | kdch1=\177, 240 | -------------------------------------------------------------------------------- /st-0.8.4/st.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdpedersen1/void-suckless/e01b4cf76ec5fd12be8d9343140410cef355f425/st-0.8.4/st.o -------------------------------------------------------------------------------- /st-0.8.4/win.h: -------------------------------------------------------------------------------- 1 | /* See LICENSE for license details. */ 2 | 3 | enum win_mode { 4 | MODE_VISIBLE = 1 << 0, 5 | MODE_FOCUSED = 1 << 1, 6 | MODE_APPKEYPAD = 1 << 2, 7 | MODE_MOUSEBTN = 1 << 3, 8 | MODE_MOUSEMOTION = 1 << 4, 9 | MODE_REVERSE = 1 << 5, 10 | MODE_KBDLOCK = 1 << 6, 11 | MODE_HIDE = 1 << 7, 12 | MODE_APPCURSOR = 1 << 8, 13 | MODE_MOUSESGR = 1 << 9, 14 | MODE_8BIT = 1 << 10, 15 | MODE_BLINK = 1 << 11, 16 | MODE_FBLINK = 1 << 12, 17 | MODE_FOCUS = 1 << 13, 18 | MODE_MOUSEX10 = 1 << 14, 19 | MODE_MOUSEMANY = 1 << 15, 20 | MODE_BRCKTPASTE = 1 << 16, 21 | MODE_NUMLOCK = 1 << 17, 22 | MODE_MOUSE = MODE_MOUSEBTN|MODE_MOUSEMOTION|MODE_MOUSEX10\ 23 | |MODE_MOUSEMANY, 24 | }; 25 | 26 | void xbell(void); 27 | void xclipcopy(void); 28 | void xdrawcursor(int, int, Glyph, int, int, Glyph); 29 | void xdrawline(Line, int, int, int); 30 | void xfinishdraw(void); 31 | void xloadcols(void); 32 | int xsetcolorname(int, const char *); 33 | void xsettitle(char *); 34 | int xsetcursor(int); 35 | void xsetmode(int, unsigned int); 36 | void xsetpointermotion(int); 37 | void xsetsel(char *); 38 | int xstartdraw(void); 39 | void xximspot(int, int); 40 | -------------------------------------------------------------------------------- /st-0.8.4/x.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdpedersen1/void-suckless/e01b4cf76ec5fd12be8d9343140410cef355f425/st-0.8.4/x.o --------------------------------------------------------------------------------