diff --git a/.bashrc b/.bashrc index 72d210d..57c60f1 100644 --- a/.bashrc +++ b/.bashrc @@ -3,7 +3,7 @@ if [[ $- != *i* ]] ; then fi alias ls="ls -a --color" -alias comp="doas rm -rf config.h && make && doas make install" +alias comp="make && doas make install" alias edit="sh /home/andrew/.config/suckless/dwm/scripts/edit-suckless.sh" alias update_world="doas emerge --ask --update --newuse --deep @world" alias env="sh /home/andrew/dotfiles/env.sh" diff --git a/.config/suckless/dwm-bak/Makefile b/.config/suckless/dwm-bak/Makefile new file mode 100644 index 0000000..ffa69b4 --- /dev/null +++ b/.config/suckless/dwm-bak/Makefile @@ -0,0 +1,45 @@ +# dwm - dynamic window manager +# See LICENSE file for copyright and license details. + +include config.mk + +SRC = drw.c dwm.c util.c +OBJ = ${SRC:.c=.o} + +all: dwm + +.c.o: + ${CC} -c ${CFLAGS} $< + +${OBJ}: config.h config.mk + +config.h: + cp config.def.h $@ + +dwm: ${OBJ} + ${CC} -o $@ ${OBJ} ${LDFLAGS} + +clean: + rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz + +dist: clean + mkdir -p dwm-${VERSION} + cp -R LICENSE Makefile README config.def.h config.mk\ + dwm.1 drw.h util.h ${SRC} dwm.png transient.c dwm-${VERSION} + tar -cf dwm-${VERSION}.tar dwm-${VERSION} + gzip dwm-${VERSION}.tar + rm -rf dwm-${VERSION} + +install: all + mkdir -p ${DESTDIR}${PREFIX}/bin + cp -f dwm ${DESTDIR}${PREFIX}/bin + chmod 755 ${DESTDIR}${PREFIX}/bin/dwm + mkdir -p ${DESTDIR}${MANPREFIX}/man1 + sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1 + chmod 644 ${DESTDIR}${MANPREFIX}/man1/dwm.1 + +uninstall: + rm -f ${DESTDIR}${PREFIX}/bin/dwm\ + ${DESTDIR}${MANPREFIX}/man1/dwm.1 + +.PHONY: all clean dist install uninstall diff --git a/.config/suckless/dwm-bak/Wallpapers/fog_forest_1.png b/.config/suckless/dwm-bak/Wallpapers/fog_forest_1.png new file mode 100644 index 0000000..7704dbc Binary files /dev/null and b/.config/suckless/dwm-bak/Wallpapers/fog_forest_1.png differ diff --git a/.config/suckless/dwm-bak/Wallpapers/fog_forest_2.png b/.config/suckless/dwm-bak/Wallpapers/fog_forest_2.png new file mode 100644 index 0000000..6cf9a8f Binary files /dev/null and b/.config/suckless/dwm-bak/Wallpapers/fog_forest_2.png differ diff --git a/.config/suckless/dwm-bak/Wallpapers/fog_forest_alt_1.png b/.config/suckless/dwm-bak/Wallpapers/fog_forest_alt_1.png new file mode 100644 index 0000000..4910dee Binary files /dev/null and b/.config/suckless/dwm-bak/Wallpapers/fog_forest_alt_1.png differ diff --git a/.config/suckless/dwm-bak/Wallpapers/fog_forest_alt_2.png b/.config/suckless/dwm-bak/Wallpapers/fog_forest_alt_2.png new file mode 100644 index 0000000..ca4dfd5 Binary files /dev/null and b/.config/suckless/dwm-bak/Wallpapers/fog_forest_alt_2.png differ diff --git a/.config/suckless/dwm-bak/Wallpapers/fog_forest_portrait_1.png b/.config/suckless/dwm-bak/Wallpapers/fog_forest_portrait_1.png new file mode 100644 index 0000000..48b2b8c Binary files /dev/null and b/.config/suckless/dwm-bak/Wallpapers/fog_forest_portrait_1.png differ diff --git a/.config/suckless/dwm-bak/Wallpapers/fog_forest_portrait_2.png b/.config/suckless/dwm-bak/Wallpapers/fog_forest_portrait_2.png new file mode 100644 index 0000000..a5bc149 Binary files /dev/null and b/.config/suckless/dwm-bak/Wallpapers/fog_forest_portrait_2.png differ diff --git a/.config/suckless/dwm-bak/Wallpapers/foggy_valley_1.png b/.config/suckless/dwm-bak/Wallpapers/foggy_valley_1.png new file mode 100644 index 0000000..a484bc1 Binary files /dev/null and b/.config/suckless/dwm-bak/Wallpapers/foggy_valley_1.png differ diff --git a/.config/suckless/dwm-bak/Wallpapers/foggy_valley_2.png b/.config/suckless/dwm-bak/Wallpapers/foggy_valley_2.png new file mode 100644 index 0000000..e4a61be Binary files /dev/null and b/.config/suckless/dwm-bak/Wallpapers/foggy_valley_2.png differ diff --git a/.config/suckless/dwm-bak/Wallpapers/green_forest_1.png b/.config/suckless/dwm-bak/Wallpapers/green_forest_1.png new file mode 100644 index 0000000..962b7f1 Binary files /dev/null and b/.config/suckless/dwm-bak/Wallpapers/green_forest_1.png differ diff --git a/.config/suckless/dwm-bak/Wallpapers/green_forest_2.png b/.config/suckless/dwm-bak/Wallpapers/green_forest_2.png new file mode 100644 index 0000000..9cde094 Binary files /dev/null and b/.config/suckless/dwm-bak/Wallpapers/green_forest_2.png differ diff --git a/.config/suckless/dwm-bak/Wallpapers/mist_forest_1.png b/.config/suckless/dwm-bak/Wallpapers/mist_forest_1.png new file mode 100644 index 0000000..eb0c104 Binary files /dev/null and b/.config/suckless/dwm-bak/Wallpapers/mist_forest_1.png differ diff --git a/.config/suckless/dwm-bak/Wallpapers/mist_forest_2.png b/.config/suckless/dwm-bak/Wallpapers/mist_forest_2.png new file mode 100644 index 0000000..79fcfa0 Binary files /dev/null and b/.config/suckless/dwm-bak/Wallpapers/mist_forest_2.png differ diff --git a/.config/suckless/dwm-bak/Wallpapers/mojave_minimal.png b/.config/suckless/dwm-bak/Wallpapers/mojave_minimal.png new file mode 100644 index 0000000..b9fe461 Binary files /dev/null and b/.config/suckless/dwm-bak/Wallpapers/mojave_minimal.png differ diff --git a/.config/suckless/dwm-bak/Wallpapers/ocean_front_1.png b/.config/suckless/dwm-bak/Wallpapers/ocean_front_1.png new file mode 100644 index 0000000..251d772 Binary files /dev/null and b/.config/suckless/dwm-bak/Wallpapers/ocean_front_1.png differ diff --git a/.config/suckless/dwm-bak/Wallpapers/ocean_front_2.png b/.config/suckless/dwm-bak/Wallpapers/ocean_front_2.png new file mode 100644 index 0000000..f339c85 Binary files /dev/null and b/.config/suckless/dwm-bak/Wallpapers/ocean_front_2.png differ diff --git a/.config/suckless/dwm-bak/Wallpapers/polyscape_1.png b/.config/suckless/dwm-bak/Wallpapers/polyscape_1.png new file mode 100644 index 0000000..06a02e7 Binary files /dev/null and b/.config/suckless/dwm-bak/Wallpapers/polyscape_1.png differ diff --git a/.config/suckless/dwm-bak/Wallpapers/polyscape_2.png b/.config/suckless/dwm-bak/Wallpapers/polyscape_2.png new file mode 100644 index 0000000..58dfaf4 Binary files /dev/null and b/.config/suckless/dwm-bak/Wallpapers/polyscape_2.png differ diff --git a/.config/suckless/dwm-bak/Wallpapers/polyscape_pillars_1.png b/.config/suckless/dwm-bak/Wallpapers/polyscape_pillars_1.png new file mode 100644 index 0000000..0daef21 Binary files /dev/null and b/.config/suckless/dwm-bak/Wallpapers/polyscape_pillars_1.png differ diff --git a/.config/suckless/dwm-bak/Wallpapers/polyscape_pillars_2.png b/.config/suckless/dwm-bak/Wallpapers/polyscape_pillars_2.png new file mode 100644 index 0000000..7cff4ba Binary files /dev/null and b/.config/suckless/dwm-bak/Wallpapers/polyscape_pillars_2.png differ diff --git a/.config/suckless/dwm-bak/Wallpapers/rock_1.png b/.config/suckless/dwm-bak/Wallpapers/rock_1.png new file mode 100644 index 0000000..8c02861 Binary files /dev/null and b/.config/suckless/dwm-bak/Wallpapers/rock_1.png differ diff --git a/.config/suckless/dwm-bak/Wallpapers/rock_2.png b/.config/suckless/dwm-bak/Wallpapers/rock_2.png new file mode 100644 index 0000000..5ac0445 Binary files /dev/null and b/.config/suckless/dwm-bak/Wallpapers/rock_2.png differ diff --git a/.config/suckless/dwm-bak/Wallpapers/rocky_beach_1.png b/.config/suckless/dwm-bak/Wallpapers/rocky_beach_1.png new file mode 100644 index 0000000..bb72f2a Binary files /dev/null and b/.config/suckless/dwm-bak/Wallpapers/rocky_beach_1.png differ diff --git a/.config/suckless/dwm-bak/Wallpapers/rocky_beach_2.png b/.config/suckless/dwm-bak/Wallpapers/rocky_beach_2.png new file mode 100644 index 0000000..64117d3 Binary files /dev/null and b/.config/suckless/dwm-bak/Wallpapers/rocky_beach_2.png differ diff --git a/.config/suckless/dwm-bak/Wallpapers/waterfall_1.png b/.config/suckless/dwm-bak/Wallpapers/waterfall_1.png new file mode 100644 index 0000000..d681b69 Binary files /dev/null and b/.config/suckless/dwm-bak/Wallpapers/waterfall_1.png differ diff --git a/.config/suckless/dwm-bak/Wallpapers/waterfall_2.png b/.config/suckless/dwm-bak/Wallpapers/waterfall_2.png new file mode 100644 index 0000000..87db77d Binary files /dev/null and b/.config/suckless/dwm-bak/Wallpapers/waterfall_2.png differ diff --git a/.config/suckless/dwm/config.def.h b/.config/suckless/dwm-bak/config.def.h similarity index 100% rename from .config/suckless/dwm/config.def.h rename to .config/suckless/dwm-bak/config.def.h diff --git a/.config/suckless/dwm/config.def.h.orig b/.config/suckless/dwm-bak/config.h similarity index 90% rename from .config/suckless/dwm/config.def.h.orig rename to .config/suckless/dwm-bak/config.h index 4e1ecd2..49d4108 100644 --- a/.config/suckless/dwm/config.def.h.orig +++ b/.config/suckless/dwm-bak/config.h @@ -7,7 +7,6 @@ static const int topbar = 1; static const char *barlayout = "t|s"; static const char *fonts[] = { "CaskaydiaCove NFM style:SemiBold:size=11" }; -static const char dmenufont[] = { "CaskaydiaCove NFM style:SemiBold:size=12" }; static const char *colors[][3] = { [SchemeNorm] = { foreground, background, aqua }, [SchemeSel] = { dark_gray, yellow, green }, @@ -17,7 +16,7 @@ static const char *tags[] = { "1", "2", "3", "4" }; static const Rule rules[] = { /* class instance title tags mask isfloating monitor */ { "PrismLauncher", "prismlauncher", NULL, 1 << 2, 0, -1 }, - { "firefox-esr", "Navigator", NULL, 1 << 1, 0, -1 }, + { "mercury-default", "Navigator", NULL, 1 << 1, 0, -1 }, { "steam", "steamwebhelper", NULL, 1 << 2, 0, -1 }, { "st-256color", "st-256color", NULL, 1, 0, -1 }, }; @@ -39,16 +38,15 @@ static const Layout layouts[] = { { "[]=", tile } }; #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } static char dmenumon[2] = "0"; -static const char *dmenucmd[] = { "dmenu_run", "-g", "6", "-l", "3", "-m", dmenumon, "-fn", dmenufont, "-nb", background, "-nf", foreground, "-sb", blue, "-sf", dark_gray, NULL }; +static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, NULL }; static const char *termcmd[] = { "st", NULL }; -static const char *browser[] = { "firefox-bin", NULL }; #include "movestack.c" #include "X11/XF86keysym.h" static const Key keys[] = { { MODKEY, XK_Return, spawn, {.v = termcmd } }, { MODKEY, XK_space, spawn, {.v = dmenucmd } }, - { MODKEY, XK_f, spawn, {.v = browser } }, + { MODKEY, XK_f, spawn, SHCMD("cd /home/andrew/mercury-browser/ && ./MERCURY_PORTABLE") }, { MODKEY, XK_h, focusstack, {.i = +1 } }, { MODKEY, XK_l, focusstack, {.i = -1 } }, { MODKEY, XK_j, setmfact, {.f = -0.05} }, @@ -63,6 +61,7 @@ static const Key keys[] = { { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, + { MODKEY, XK_comma, spawn, SHCMD("sh /home/andrew/.config/suckless/dwm/scripts/change_layout.sh") }, { 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("pactl set-sink-volume @DEFAULT_SINK@ +2%") }, { 0, XF86XK_AudioLowerVolume, spawn, SHCMD("pactl set-sink-volume @DEFAULT_SINK@ -2%") }, diff --git a/.config/suckless/dwm-bak/config.mk b/.config/suckless/dwm-bak/config.mk new file mode 100644 index 0000000..8efca9a --- /dev/null +++ b/.config/suckless/dwm-bak/config.mk @@ -0,0 +1,39 @@ +# dwm version +VERSION = 6.5 + +# Customize below to fit your system + +# paths +PREFIX = /usr/local +MANPREFIX = ${PREFIX}/share/man + +X11INC = /usr/X11R6/include +X11LIB = /usr/X11R6/lib + +# Xinerama, comment if you don't want it +XINERAMALIBS = -lXinerama +XINERAMAFLAGS = -DXINERAMA + +# freetype +FREETYPELIBS = -lfontconfig -lXft +FREETYPEINC = /usr/include/freetype2 +# OpenBSD (uncomment) +#FREETYPEINC = ${X11INC}/freetype2 +#MANPREFIX = ${PREFIX}/man + +# includes and libs +INCS = -I${X11INC} -I${FREETYPEINC} +LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} + +# flags +CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} +#CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS} +CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS} +LDFLAGS = ${LIBS} + +# Solaris +#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\" +#LDFLAGS = ${LIBS} + +# compiler and linker +CC = cc diff --git a/.config/suckless/dwm-bak/drw.c b/.config/suckless/dwm-bak/drw.c new file mode 100644 index 0000000..a58a2b4 --- /dev/null +++ b/.config/suckless/dwm-bak/drw.c @@ -0,0 +1,450 @@ +/* See LICENSE file for copyright and license details. */ +#include +#include +#include +#include +#include + +#include "drw.h" +#include "util.h" + +#define UTF_INVALID 0xFFFD +#define UTF_SIZ 4 + +static const unsigned char utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0}; +static const unsigned char utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8}; +static const long utfmin[UTF_SIZ + 1] = { 0, 0, 0x80, 0x800, 0x10000}; +static const long utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF}; + +static long +utf8decodebyte(const char c, size_t *i) +{ + for (*i = 0; *i < (UTF_SIZ + 1); ++(*i)) + if (((unsigned char)c & utfmask[*i]) == utfbyte[*i]) + return (unsigned char)c & ~utfmask[*i]; + return 0; +} + +static size_t +utf8validate(long *u, size_t i) +{ + if (!BETWEEN(*u, utfmin[i], utfmax[i]) || BETWEEN(*u, 0xD800, 0xDFFF)) + *u = UTF_INVALID; + for (i = 1; *u > utfmax[i]; ++i) + ; + return i; +} + +static size_t +utf8decode(const char *c, long *u, size_t clen) +{ + size_t i, j, len, type; + long udecoded; + + *u = UTF_INVALID; + if (!clen) + return 0; + udecoded = utf8decodebyte(c[0], &len); + if (!BETWEEN(len, 1, UTF_SIZ)) + return 1; + for (i = 1, j = 1; i < clen && j < len; ++i, ++j) { + udecoded = (udecoded << 6) | utf8decodebyte(c[i], &type); + if (type) + return j; + } + if (j < len) + return 0; + *u = udecoded; + utf8validate(u, len); + + return len; +} + +Drw * +drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h) +{ + Drw *drw = ecalloc(1, sizeof(Drw)); + + drw->dpy = dpy; + drw->screen = screen; + drw->root = root; + drw->w = w; + drw->h = h; + drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen)); + drw->gc = XCreateGC(dpy, root, 0, NULL); + XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter); + + return drw; +} + +void +drw_resize(Drw *drw, unsigned int w, unsigned int h) +{ + if (!drw) + return; + + drw->w = w; + drw->h = h; + if (drw->drawable) + XFreePixmap(drw->dpy, drw->drawable); + drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen)); +} + +void +drw_free(Drw *drw) +{ + XFreePixmap(drw->dpy, drw->drawable); + XFreeGC(drw->dpy, drw->gc); + drw_fontset_free(drw->fonts); + free(drw); +} + +/* This function is an implementation detail. Library users should use + * drw_fontset_create instead. + */ +static Fnt * +xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern) +{ + Fnt *font; + XftFont *xfont = NULL; + FcPattern *pattern = NULL; + + if (fontname) { + /* Using the pattern found at font->xfont->pattern does not yield the + * same substitution results as using the pattern returned by + * FcNameParse; using the latter results in the desired fallback + * behaviour whereas the former just results in missing-character + * rectangles being drawn, at least with some fonts. */ + if (!(xfont = XftFontOpenName(drw->dpy, drw->screen, fontname))) { + fprintf(stderr, "error, cannot load font from name: '%s'\n", fontname); + return NULL; + } + if (!(pattern = FcNameParse((FcChar8 *) fontname))) { + fprintf(stderr, "error, cannot parse font name to pattern: '%s'\n", fontname); + XftFontClose(drw->dpy, xfont); + return NULL; + } + } else if (fontpattern) { + if (!(xfont = XftFontOpenPattern(drw->dpy, fontpattern))) { + fprintf(stderr, "error, cannot load font from pattern.\n"); + return NULL; + } + } else { + die("no font specified."); + } + + font = ecalloc(1, sizeof(Fnt)); + font->xfont = xfont; + font->pattern = pattern; + font->h = xfont->ascent + xfont->descent; + font->dpy = drw->dpy; + + return font; +} + +static void +xfont_free(Fnt *font) +{ + if (!font) + return; + if (font->pattern) + FcPatternDestroy(font->pattern); + XftFontClose(font->dpy, font->xfont); + free(font); +} + +Fnt* +drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount) +{ + Fnt *cur, *ret = NULL; + size_t i; + + if (!drw || !fonts) + return NULL; + + for (i = 1; i <= fontcount; i++) { + if ((cur = xfont_create(drw, fonts[fontcount - i], NULL))) { + cur->next = ret; + ret = cur; + } + } + return (drw->fonts = ret); +} + +void +drw_fontset_free(Fnt *font) +{ + if (font) { + drw_fontset_free(font->next); + xfont_free(font); + } +} + +void +drw_clr_create(Drw *drw, Clr *dest, const char *clrname) +{ + if (!drw || !dest || !clrname) + return; + + if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen), + DefaultColormap(drw->dpy, drw->screen), + clrname, dest)) + die("error, cannot allocate color '%s'", clrname); +} + +/* Wrapper to create color schemes. The caller has to call free(3) on the + * returned color scheme when done using it. */ +Clr * +drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount) +{ + size_t i; + Clr *ret; + + /* need at least two colors for a scheme */ + if (!drw || !clrnames || clrcount < 2 || !(ret = ecalloc(clrcount, sizeof(XftColor)))) + return NULL; + + for (i = 0; i < clrcount; i++) + drw_clr_create(drw, &ret[i], clrnames[i]); + return ret; +} + +void +drw_setfontset(Drw *drw, Fnt *set) +{ + if (drw) + drw->fonts = set; +} + +void +drw_setscheme(Drw *drw, Clr *scm) +{ + if (drw) + drw->scheme = scm; +} + +void +drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert) +{ + if (!drw || !drw->scheme) + return; + XSetForeground(drw->dpy, drw->gc, invert ? drw->scheme[ColBg].pixel : drw->scheme[ColFg].pixel); + if (filled) + XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h); + else + XDrawRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w - 1, h - 1); +} + +int +drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert) +{ + int i, ty, ellipsis_x = 0; + unsigned int tmpw, ew, ellipsis_w = 0, ellipsis_len; + XftDraw *d = NULL; + Fnt *usedfont, *curfont, *nextfont; + int utf8strlen, utf8charlen, render = x || y || w || h; + long utf8codepoint = 0; + const char *utf8str; + FcCharSet *fccharset; + FcPattern *fcpattern; + FcPattern *match; + XftResult result; + int charexists = 0, overflow = 0; + /* keep track of a couple codepoints for which we have no match. */ + enum { nomatches_len = 64 }; + static struct { long codepoint[nomatches_len]; unsigned int idx; } nomatches; + static unsigned int ellipsis_width = 0; + + if (!drw || (render && (!drw->scheme || !w)) || !text || !drw->fonts) + return 0; + + if (!render) { + w = invert ? invert : ~invert; + } else { + XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel); + XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h); + d = XftDrawCreate(drw->dpy, drw->drawable, + DefaultVisual(drw->dpy, drw->screen), + DefaultColormap(drw->dpy, drw->screen)); + x += lpad; + w -= lpad; + } + + usedfont = drw->fonts; + if (!ellipsis_width && render) + ellipsis_width = drw_fontset_getwidth(drw, "..."); + while (1) { + ew = ellipsis_len = utf8strlen = 0; + utf8str = text; + nextfont = NULL; + while (*text) { + utf8charlen = utf8decode(text, &utf8codepoint, UTF_SIZ); + for (curfont = drw->fonts; curfont; curfont = curfont->next) { + charexists = charexists || XftCharExists(drw->dpy, curfont->xfont, utf8codepoint); + if (charexists) { + drw_font_getexts(curfont, text, utf8charlen, &tmpw, NULL); + if (ew + ellipsis_width <= w) { + /* keep track where the ellipsis still fits */ + ellipsis_x = x + ew; + ellipsis_w = w - ew; + ellipsis_len = utf8strlen; + } + + if (ew + tmpw > w) { + overflow = 1; + /* called from drw_fontset_getwidth_clamp(): + * it wants the width AFTER the overflow + */ + if (!render) + x += tmpw; + else + utf8strlen = ellipsis_len; + } else if (curfont == usedfont) { + utf8strlen += utf8charlen; + text += utf8charlen; + ew += tmpw; + } else { + nextfont = curfont; + } + break; + } + } + + if (overflow || !charexists || nextfont) + break; + else + charexists = 0; + } + + if (utf8strlen) { + if (render) { + ty = y + (h - usedfont->h) / 2 + usedfont->xfont->ascent; + XftDrawStringUtf8(d, &drw->scheme[invert ? ColBg : ColFg], + usedfont->xfont, x, ty, (XftChar8 *)utf8str, utf8strlen); + } + x += ew; + w -= ew; + } + if (render && overflow) + drw_text(drw, ellipsis_x, y, ellipsis_w, h, 0, "...", invert); + + if (!*text || overflow) { + break; + } else if (nextfont) { + charexists = 0; + usedfont = nextfont; + } else { + /* Regardless of whether or not a fallback font is found, the + * character must be drawn. */ + charexists = 1; + + for (i = 0; i < nomatches_len; ++i) { + /* avoid calling XftFontMatch if we know we won't find a match */ + if (utf8codepoint == nomatches.codepoint[i]) + goto no_match; + } + + fccharset = FcCharSetCreate(); + FcCharSetAddChar(fccharset, utf8codepoint); + + if (!drw->fonts->pattern) { + /* Refer to the comment in xfont_create for more information. */ + die("the first font in the cache must be loaded from a font string."); + } + + fcpattern = FcPatternDuplicate(drw->fonts->pattern); + FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset); + FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue); + + FcConfigSubstitute(NULL, fcpattern, FcMatchPattern); + FcDefaultSubstitute(fcpattern); + match = XftFontMatch(drw->dpy, drw->screen, fcpattern, &result); + + FcCharSetDestroy(fccharset); + FcPatternDestroy(fcpattern); + + if (match) { + usedfont = xfont_create(drw, NULL, match); + if (usedfont && XftCharExists(drw->dpy, usedfont->xfont, utf8codepoint)) { + for (curfont = drw->fonts; curfont->next; curfont = curfont->next) + ; /* NOP */ + curfont->next = usedfont; + } else { + xfont_free(usedfont); + nomatches.codepoint[++nomatches.idx % nomatches_len] = utf8codepoint; +no_match: + usedfont = drw->fonts; + } + } + } + } + if (d) + XftDrawDestroy(d); + + return x + (render ? w : 0); +} + +void +drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h) +{ + if (!drw) + return; + + XCopyArea(drw->dpy, drw->drawable, win, drw->gc, x, y, w, h, x, y); + XSync(drw->dpy, False); +} + +unsigned int +drw_fontset_getwidth(Drw *drw, const char *text) +{ + if (!drw || !drw->fonts || !text) + return 0; + return drw_text(drw, 0, 0, 0, 0, 0, text, 0); +} + +unsigned int +drw_fontset_getwidth_clamp(Drw *drw, const char *text, unsigned int n) +{ + unsigned int tmp = 0; + if (drw && drw->fonts && text && n) + tmp = drw_text(drw, 0, 0, 0, 0, 0, text, n); + return MIN(n, tmp); +} + +void +drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h) +{ + XGlyphInfo ext; + + if (!font || !text) + return; + + XftTextExtentsUtf8(font->dpy, font->xfont, (XftChar8 *)text, len, &ext); + if (w) + *w = ext.xOff; + if (h) + *h = font->h; +} + +Cur * +drw_cur_create(Drw *drw, int shape) +{ + Cur *cur; + + if (!drw || !(cur = ecalloc(1, sizeof(Cur)))) + return NULL; + + cur->cursor = XCreateFontCursor(drw->dpy, shape); + + return cur; +} + +void +drw_cur_free(Drw *drw, Cur *cursor) +{ + if (!cursor) + return; + + XFreeCursor(drw->dpy, cursor->cursor); + free(cursor); +} diff --git a/.config/suckless/dwm-bak/drw.h b/.config/suckless/dwm-bak/drw.h new file mode 100644 index 0000000..6471431 --- /dev/null +++ b/.config/suckless/dwm-bak/drw.h @@ -0,0 +1,58 @@ +/* See LICENSE file for copyright and license details. */ + +typedef struct { + Cursor cursor; +} Cur; + +typedef struct Fnt { + Display *dpy; + unsigned int h; + XftFont *xfont; + FcPattern *pattern; + struct Fnt *next; +} Fnt; + +enum { ColFg, ColBg, ColBorder }; /* Clr scheme index */ +typedef XftColor Clr; + +typedef struct { + unsigned int w, h; + Display *dpy; + int screen; + Window root; + Drawable drawable; + GC gc; + Clr *scheme; + Fnt *fonts; +} Drw; + +/* Drawable abstraction */ +Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h); +void drw_resize(Drw *drw, unsigned int w, unsigned int h); +void drw_free(Drw *drw); + +/* Fnt abstraction */ +Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount); +void drw_fontset_free(Fnt* set); +unsigned int drw_fontset_getwidth(Drw *drw, const char *text); +unsigned int drw_fontset_getwidth_clamp(Drw *drw, const char *text, unsigned int n); +void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h); + +/* Colorscheme abstraction */ +void drw_clr_create(Drw *drw, Clr *dest, const char *clrname); +Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount); + +/* Cursor abstraction */ +Cur *drw_cur_create(Drw *drw, int shape); +void drw_cur_free(Drw *drw, Cur *cursor); + +/* Drawing context manipulation */ +void drw_setfontset(Drw *drw, Fnt *set); +void drw_setscheme(Drw *drw, Clr *scm); + +/* Drawing functions */ +void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert); +int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert); + +/* Map functions */ +void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h); diff --git a/.config/suckless/dwm-bak/drw.o b/.config/suckless/dwm-bak/drw.o new file mode 100644 index 0000000..03da366 Binary files /dev/null and b/.config/suckless/dwm-bak/drw.o differ diff --git a/.config/suckless/dwm-bak/dwm b/.config/suckless/dwm-bak/dwm new file mode 100755 index 0000000..c5da7d7 Binary files /dev/null and b/.config/suckless/dwm-bak/dwm differ diff --git a/.config/suckless/dwm/dwm.1 b/.config/suckless/dwm-bak/dwm.1 similarity index 100% rename from .config/suckless/dwm/dwm.1 rename to .config/suckless/dwm-bak/dwm.1 diff --git a/.config/suckless/dwm/dwm.c.orig b/.config/suckless/dwm-bak/dwm.c similarity index 99% rename from .config/suckless/dwm/dwm.c.orig rename to .config/suckless/dwm-bak/dwm.c index def24b1..6458bfe 100644 --- a/.config/suckless/dwm/dwm.c.orig +++ b/.config/suckless/dwm-bak/dwm.c @@ -1546,12 +1546,6 @@ setup(void) /* clean up any zombies (inherited from .xinitrc etc) immediately */ while (waitpid(-1, NULL, WNOHANG) > 0); - // signal(SIGHUP, sighup); - // signal(SIGTERM, sigterm); - // - // signal(SIGHUP, sighup); - // signal(SIGTERM, sigterm); - /* init screen */ screen = DefaultScreen(dpy); sw = DisplayWidth(dpy, screen); diff --git a/.config/suckless/dwm-bak/dwm.o b/.config/suckless/dwm-bak/dwm.o new file mode 100644 index 0000000..534d5c7 Binary files /dev/null and b/.config/suckless/dwm-bak/dwm.o differ diff --git a/.config/suckless/dwm/movestack.c b/.config/suckless/dwm-bak/movestack.c similarity index 100% rename from .config/suckless/dwm/movestack.c rename to .config/suckless/dwm-bak/movestack.c diff --git a/.config/suckless/dwm/patches/dwm-barconfig-20220906-c2b748e.diff b/.config/suckless/dwm-bak/patches/dwm-barconfig-20220906-c2b748e.diff similarity index 100% rename from .config/suckless/dwm/patches/dwm-barconfig-20220906-c2b748e.diff rename to .config/suckless/dwm-bak/patches/dwm-barconfig-20220906-c2b748e.diff diff --git a/.config/suckless/dwm/patches/dwm-fullgaps-6.4.diff b/.config/suckless/dwm-bak/patches/dwm-fullgaps-6.4.diff similarity index 100% rename from .config/suckless/dwm/patches/dwm-fullgaps-6.4.diff rename to .config/suckless/dwm-bak/patches/dwm-fullgaps-6.4.diff diff --git a/.config/suckless/dwm/patches/dwm-movestack-20211115-a786211.diff b/.config/suckless/dwm-bak/patches/dwm-movestack-20211115-a786211.diff similarity index 100% rename from .config/suckless/dwm/patches/dwm-movestack-20211115-a786211.diff rename to .config/suckless/dwm-bak/patches/dwm-movestack-20211115-a786211.diff diff --git a/.config/suckless/dwm/patches/dwm-restartsig-20180523-6.2.diff b/.config/suckless/dwm-bak/patches/dwm-restartsig-20180523-6.2.diff similarity index 100% rename from .config/suckless/dwm/patches/dwm-restartsig-20180523-6.2.diff rename to .config/suckless/dwm-bak/patches/dwm-restartsig-20180523-6.2.diff diff --git a/.config/suckless/dwm-bak/scripts/change_layout.sh b/.config/suckless/dwm-bak/scripts/change_layout.sh new file mode 100755 index 0000000..63738e9 --- /dev/null +++ b/.config/suckless/dwm-bak/scripts/change_layout.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +variant=$(setxkbmap -query | awk '/variant:/ { print $2 }') + +if [[ "$variant" == "colemak_dh" ]]; then + setxkbmap us + layout="qwe" +else + setxkbmap us -variant colemak_dh + layout="cdh" +fi diff --git a/.config/suckless/dwm-bak/scripts/edit-suckless.sh b/.config/suckless/dwm-bak/scripts/edit-suckless.sh new file mode 100755 index 0000000..4a456c5 --- /dev/null +++ b/.config/suckless/dwm-bak/scripts/edit-suckless.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +set -e + +REBUILD=false + +# Parse flags +while getopts ":f" opt; do + case $opt in + f) + REBUILD=true + ;; + \?) + echo "Invalid option: -$OPTARG" >&2 + exit 1 + ;; + esac +done + +shift $((OPTIND - 1)) +APP="$1" +APP_DIR="/home/andrew/dotfiles/.config/suckless/$APP" +CONFIG_FILE="$APP_DIR/config.def.h" + +if [[ -z "$APP" ]]; then + echo "Usage: + edit-suckless.sh [ option ] < suckless-app >" + echo "Options: + -f [ force rebuild even if no changes were made ]" + exit 1 +fi + +if [[ ! -f "$CONFIG_FILE" ]]; then + echo "Config file not found: $CONFIG_FILE" + exit 1 +fi + +OLD_DIR="$(pwd)" +cd "$APP_DIR" || { + echo "Failed to cd into $APP_DIR" + exit 1 +} + +# Hash before edit +BEFORE_HASH=$(sha256sum config.def.h | cut -d ' ' -f1) + +# Edit file +nvim config.def.h + +# Hash after edit +AFTER_HASH=$(sha256sum config.def.h | cut -d ' ' -f1) + +if [[ "$BEFORE_HASH" != "$AFTER_HASH" || "$REBUILD" == true ]]; then + echo "Rebuilding $APP..." + doas rm -f config.h + make + doas make install + pkill dwm +else + echo "No changes detected. Skipping rebuild." +fi + +cd "$OLD_DIR" diff --git a/.config/suckless/dwm-bak/scripts/shuffle_wallpapers.sh b/.config/suckless/dwm-bak/scripts/shuffle_wallpapers.sh new file mode 100755 index 0000000..4f893ec --- /dev/null +++ b/.config/suckless/dwm-bak/scripts/shuffle_wallpapers.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +while true; do + xwallpaper --zoom "$(find /home/andrew/.config/suckless/dwm/Wallpapers -type f | shuf -n1)" + + date +%s > /tmp/last_wallpaper_time # Save current timestamp + sleep 600 # Pause for 10 minutes - default 600 seconds +done diff --git a/.config/suckless/dwm/themes/catppuccin.h b/.config/suckless/dwm-bak/themes/catppuccin.h similarity index 100% rename from .config/suckless/dwm/themes/catppuccin.h rename to .config/suckless/dwm-bak/themes/catppuccin.h diff --git a/.config/suckless/dwm/themes/everforest.h b/.config/suckless/dwm-bak/themes/everforest.h similarity index 100% rename from .config/suckless/dwm/themes/everforest.h rename to .config/suckless/dwm-bak/themes/everforest.h diff --git a/.config/suckless/dwm-bak/transient.c b/.config/suckless/dwm-bak/transient.c new file mode 100644 index 0000000..040adb5 --- /dev/null +++ b/.config/suckless/dwm-bak/transient.c @@ -0,0 +1,42 @@ +/* cc transient.c -o transient -lX11 */ + +#include +#include +#include +#include + +int main(void) { + Display *d; + Window r, f, t = None; + XSizeHints h; + XEvent e; + + d = XOpenDisplay(NULL); + if (!d) + exit(1); + r = DefaultRootWindow(d); + + f = XCreateSimpleWindow(d, r, 100, 100, 400, 400, 0, 0, 0); + h.min_width = h.max_width = h.min_height = h.max_height = 400; + h.flags = PMinSize | PMaxSize; + XSetWMNormalHints(d, f, &h); + XStoreName(d, f, "floating"); + XMapWindow(d, f); + + XSelectInput(d, f, ExposureMask); + while (1) { + XNextEvent(d, &e); + + if (t == None) { + sleep(5); + t = XCreateSimpleWindow(d, r, 50, 50, 100, 100, 0, 0, 0); + XSetTransientForHint(d, t, f); + XStoreName(d, t, "transient"); + XMapWindow(d, t); + XSelectInput(d, t, ExposureMask); + } + } + + XCloseDisplay(d); + exit(0); +} diff --git a/.config/suckless/dwm-bak/util.c b/.config/suckless/dwm-bak/util.c new file mode 100644 index 0000000..96b82c9 --- /dev/null +++ b/.config/suckless/dwm-bak/util.c @@ -0,0 +1,36 @@ +/* See LICENSE file for copyright and license details. */ +#include +#include +#include +#include + +#include "util.h" + +void +die(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + + if (fmt[0] && fmt[strlen(fmt)-1] == ':') { + fputc(' ', stderr); + perror(NULL); + } else { + fputc('\n', stderr); + } + + exit(1); +} + +void * +ecalloc(size_t nmemb, size_t size) +{ + void *p; + + if (!(p = calloc(nmemb, size))) + die("calloc:"); + return p; +} diff --git a/.config/suckless/dwm-bak/util.h b/.config/suckless/dwm-bak/util.h new file mode 100644 index 0000000..f633b51 --- /dev/null +++ b/.config/suckless/dwm-bak/util.h @@ -0,0 +1,8 @@ +/* See LICENSE file for copyright and license details. */ + +#define MAX(A, B) ((A) > (B) ? (A) : (B)) +#define MIN(A, B) ((A) < (B) ? (A) : (B)) +#define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B)) + +void die(const char *fmt, ...); +void *ecalloc(size_t nmemb, size_t size); diff --git a/.config/suckless/dwm-bak/util.o b/.config/suckless/dwm-bak/util.o new file mode 100644 index 0000000..c40fa42 Binary files /dev/null and b/.config/suckless/dwm-bak/util.o differ diff --git a/.config/suckless/dwm/Makefile b/.config/suckless/dwm/Makefile index ffa69b4..ea12a06 100644 --- a/.config/suckless/dwm/Makefile +++ b/.config/suckless/dwm/Makefile @@ -34,9 +34,6 @@ install: all mkdir -p ${DESTDIR}${PREFIX}/bin cp -f dwm ${DESTDIR}${PREFIX}/bin chmod 755 ${DESTDIR}${PREFIX}/bin/dwm - mkdir -p ${DESTDIR}${MANPREFIX}/man1 - sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1 - chmod 644 ${DESTDIR}${MANPREFIX}/man1/dwm.1 uninstall: rm -f ${DESTDIR}${PREFIX}/bin/dwm\ diff --git a/.config/suckless/dwm/config.def.h.rej b/.config/suckless/dwm/config.def.h.rej deleted file mode 100644 index c00633e..0000000 --- a/.config/suckless/dwm/config.def.h.rej +++ /dev/null @@ -1,10 +0,0 @@ ---- config.def.h -+++ config.def.h -@@ -94,6 +94,7 @@ static Key keys[] = { - TAGKEYS( XK_8, 7) - TAGKEYS( XK_9, 8) - { MODKEY|ShiftMask, XK_q, quit, {0} }, -+ { MODKEY|ControlMask|ShiftMask, XK_q, quit, {1} }, - }; - - /* button definitions */ diff --git a/.config/suckless/dwm/config.h b/.config/suckless/dwm/config.h index 49d4108..fd422e5 100644 --- a/.config/suckless/dwm/config.h +++ b/.config/suckless/dwm/config.h @@ -1,4 +1,3 @@ -#include "/home/andrew/.config/suckless/dwm/themes/everforest.h" static const unsigned int borderpx = 3; static const unsigned int gappx = 10; static const unsigned int snap = 32; @@ -8,8 +7,8 @@ static const char *barlayout = "t|s"; static const char *fonts[] = { "CaskaydiaCove NFM style:SemiBold:size=11" }; static const char *colors[][3] = { - [SchemeNorm] = { foreground, background, aqua }, - [SchemeSel] = { dark_gray, yellow, green }, + [SchemeNorm] = { "#D3C6AA", "#272E33", "#83C092" }, + [SchemeSel] = { "#374145", "#DBBC7F", "#A7C080" }, }; static const char *tags[] = { "1", "2", "3", "4" }; @@ -41,7 +40,6 @@ static char dmenumon[2] = "0"; static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, NULL }; static const char *termcmd[] = { "st", NULL }; -#include "movestack.c" #include "X11/XF86keysym.h" static const Key keys[] = { { MODKEY, XK_Return, spawn, {.v = termcmd } }, @@ -54,8 +52,6 @@ static const Key keys[] = { { MODKEY, XK_i, incnmaster, {.i = +1 } }, { MODKEY, XK_d, incnmaster, {.i = -1 } }, { MODKEY, XK_q, killclient, {0} }, - { MODKEY|ShiftMask, XK_j, movestack, {.i = +1 } }, - { MODKEY|ShiftMask, XK_k, movestack, {.i = -1 } }, { MODKEY|ShiftMask, XK_Return, zoom, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, diff --git a/.config/suckless/dwm/config.mk b/.config/suckless/dwm/config.mk index 8efca9a..32f666a 100644 --- a/.config/suckless/dwm/config.mk +++ b/.config/suckless/dwm/config.mk @@ -1,11 +1,7 @@ -# dwm version VERSION = 6.5 -# Customize below to fit your system - # paths PREFIX = /usr/local -MANPREFIX = ${PREFIX}/share/man X11INC = /usr/X11R6/include X11LIB = /usr/X11R6/lib @@ -17,9 +13,6 @@ XINERAMAFLAGS = -DXINERAMA # freetype FREETYPELIBS = -lfontconfig -lXft FREETYPEINC = /usr/include/freetype2 -# OpenBSD (uncomment) -#FREETYPEINC = ${X11INC}/freetype2 -#MANPREFIX = ${PREFIX}/man # includes and libs INCS = -I${X11INC} -I${FREETYPEINC} @@ -31,9 +24,6 @@ CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VE CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS} LDFLAGS = ${LIBS} -# Solaris -#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\" -#LDFLAGS = ${LIBS} # compiler and linker -CC = cc +CC = gcc diff --git a/.config/suckless/dwm/dwm b/.config/suckless/dwm/dwm index c5da7d7..7389ec6 100755 Binary files a/.config/suckless/dwm/dwm and b/.config/suckless/dwm/dwm differ diff --git a/.config/suckless/dwm/dwm.1.orig b/.config/suckless/dwm/dwm.1.orig deleted file mode 100644 index 86e73f9..0000000 --- a/.config/suckless/dwm/dwm.1.orig +++ /dev/null @@ -1,199 +0,0 @@ -.TH DWM 1 dwm\-VERSION -.SH NAME -dwm \- dynamic window manager -.SH SYNOPSIS -.B dwm -.RB [ \-v ] -.SH DESCRIPTION -dwm is a dynamic window manager for X. It manages windows in tiled, monocle -and floating layouts. Either layout can be applied dynamically, optimising the -environment for the application in use and the task performed. -.P -In tiled layouts windows are managed in a master and stacking area. The master -area on the left contains one window by default, and the stacking area on the -right contains all other windows. The number of master area windows can be -adjusted from zero to an arbitrary number. In monocle layout all windows are -maximised to the screen size. In floating layout windows can be resized and -moved freely. Dialog windows are always managed floating, regardless of the -layout applied. -.P -Windows are grouped by tags. Each window can be tagged with one or multiple -tags. Selecting certain tags displays all windows with these tags. -.P -Each screen contains a small status bar which displays all available tags, the -layout, the title of the focused window, and the text read from the root window -name property, if the screen is focused. A floating window is indicated with an -empty square and a maximised floating window is indicated with a filled square -before the windows title. The selected tags are indicated with a different -color. The tags of the focused window are indicated with a filled square in the -top left corner. The tags which are applied to one or more windows are -indicated with an empty square in the top left corner. -.P -dwm draws a small border around windows to indicate the focus state. -.P -On start, dwm can start additional programs that may be specified in two special -shell scripts (see the FILES section below), autostart_blocking.sh and -autostart.sh. The former is executed first and dwm will wait for its -termination before starting. The latter is executed in the background before -dwm enters its handler loop. -.P -Either of these files may be omitted. -.SH OPTIONS -.TP -.B \-v -prints version information to stderr, then exits. -.SH USAGE -.SS Status bar -.TP -.B X root window name -is read and displayed in the status text area. It can be set with the -.BR xsetroot (1) -command. -.TP -.B Button1 -click on a tag label to display all windows with that tag, click on the layout -label toggles between tiled and floating layout. -.TP -.B Button3 -click on a tag label adds/removes all windows with that tag to/from the view. -.TP -.B Mod1\-Button1 -click on a tag label applies that tag to the focused window. -.TP -.B Mod1\-Button3 -click on a tag label adds/removes that tag to/from the focused window. -.SS Keyboard commands -.TP -.B Mod1\-Shift\-Return -Start -.BR st(1). -.TP -.B Mod1\-p -Spawn -.BR dmenu(1) -for launching other programs. -.TP -.B Mod1\-, -Focus previous screen, if any. -.TP -.B Mod1\-. -Focus next screen, if any. -.TP -.B Mod1\-Shift\-, -Send focused window to previous screen, if any. -.TP -.B Mod1\-Shift\-. -Send focused window to next screen, if any. -.TP -.B Mod1\-b -Toggles bar on and off. -.TP -.B Mod1\-t -Sets tiled layout. -.TP -.B Mod1\-f -Sets floating layout. -.TP -.B Mod1\-m -Sets monocle layout. -.TP -.B Mod1\-space -Toggles between current and previous layout. -.TP -.B Mod1\-j -Focus next window. -.TP -.B Mod1\-k -Focus previous window. -.TP -.B Mod1\-i -Increase number of windows in master area. -.TP -.B Mod1\-d -Decrease number of windows in master area. -.TP -.B Mod1\-l -Increase master area size. -.TP -.B Mod1\-h -Decrease master area size. -.TP -.B Mod1\-Return -Zooms/cycles focused window to/from master area (tiled layouts only). -.TP -.B Mod1\-Shift\-c -Close focused window. -.TP -.B Mod1\-Shift\-space -Toggle focused window between tiled and floating state. -.TP -.B Mod1\-Tab -Toggles to the previously selected tags. -.TP -.B Mod1\-Shift\-[1..n] -Apply nth tag to focused window. -.TP -.B Mod1\-Shift\-0 -Apply all tags to focused window. -.TP -.B Mod1\-Control\-Shift\-[1..n] -Add/remove nth tag to/from focused window. -.TP -.B Mod1\-[1..n] -View all windows with nth tag. -.TP -.B Mod1\-0 -View all windows with any tag. -.TP -.B Mod1\-Control\-[1..n] -Add/remove all windows with nth tag to/from the view. -.TP -.B Mod1\-Shift\-q -Quit dwm. -.SS Mouse commands -.TP -.B Mod1\-Button1 -Move focused window while dragging. Tiled windows will be toggled to the floating state. -.TP -.B Mod1\-Button2 -Toggles focused window between floating and tiled state. -.TP -.B Mod1\-Button3 -Resize focused window while dragging. Tiled windows will be toggled to the floating state. -.SH FILES -The files containing programs to be started along with dwm are searched for in -the following directories: -.IP "1. $XDG_DATA_HOME/dwm" -.IP "2. $HOME/.local/share/dwm" -.IP "3. $HOME/.dwm" -.P -The first existing directory is scanned for any of the autostart files below. -.TP 15 -autostart.sh -This file is started as a shell background process before dwm enters its handler -loop. -.TP 15 -autostart_blocking.sh -This file is started before any autostart.sh; dwm waits for its termination. -.SH CUSTOMIZATION -dwm is customized by creating a custom config.h and (re)compiling the source -code. This keeps it fast, secure and simple. -.SH SEE ALSO -.BR dmenu (1), -.BR st (1) -.SH ISSUES -Java applications which use the XToolkit/XAWT backend may draw grey windows -only. The XToolkit/XAWT backend breaks ICCCM-compliance in recent JDK 1.5 and early -JDK 1.6 versions, because it assumes a reparenting window manager. Possible workarounds -are using JDK 1.4 (which doesn't contain the XToolkit/XAWT backend) or setting the -environment variable -.BR AWT_TOOLKIT=MToolkit -(to use the older Motif backend instead) or running -.B xprop -root -f _NET_WM_NAME 32a -set _NET_WM_NAME LG3D -or -.B wmname LG3D -(to pretend that a non-reparenting window manager is running that the -XToolkit/XAWT backend can recognize) or when using OpenJDK setting the environment variable -.BR _JAVA_AWT_WM_NONREPARENTING=1 . -.SH BUGS -Send all bug reports with a patch to hackers@suckless.org. diff --git a/.config/suckless/dwm/dwm.c b/.config/suckless/dwm/dwm.c index 6458bfe..b8accb0 100644 --- a/.config/suckless/dwm/dwm.c +++ b/.config/suckless/dwm/dwm.c @@ -1637,20 +1637,6 @@ showhide(Client *c) } } -void -sighup(int unused) -{ - Arg a = {.i = 1}; - quit(&a); -} - -void -sigterm(int unused) -{ - Arg a = {.i = 0}; - quit(&a); -} - void spawn(const Arg *arg) { @@ -2145,7 +2131,7 @@ main(int argc, char *argv[]) { if (argc == 2 && !strcmp("-v", argv[1])) die("dwm-"VERSION); - else if (argc != 1) + if (argc != 1) die("usage: dwm [-v]"); if (!setlocale(LC_CTYPE, "") || !XSupportsLocale()) fputs("warning: no locale support\n", stderr); @@ -2153,10 +2139,6 @@ main(int argc, char *argv[]) die("dwm: cannot open display"); checkotherwm(); setup(); -#ifdef __OpenBSD__ - if (pledge("stdio rpath proc exec", NULL) == -1) - die("pledge"); -#endif /* __OpenBSD__ */ scan(); run(); cleanup(); diff --git a/.config/suckless/dwm/dwm.c.rej b/.config/suckless/dwm/dwm.c.rej deleted file mode 100644 index 121f48b..0000000 --- a/.config/suckless/dwm/dwm.c.rej +++ /dev/null @@ -1,27 +0,0 @@ ---- dwm.c -+++ dwm.c -@@ -205,6 +205,8 @@ static void setup(void); - static void seturgent(Client *c, int urg); - static void showhide(Client *c); - static void sigchld(int unused); -+static void sighup(int unused); -+static void sigterm(int unused); - static void spawn(const Arg *arg); - static void tag(const Arg *arg); - static void tagmon(const Arg *arg); -@@ -1249,6 +1252,7 @@ propertynotify(XEvent *e) - void - quit(const Arg *arg) - { -+ if(arg->i) restart = 1; - running = 0; - } - -@@ -2157,6 +2178,7 @@ main(int argc, char *argv[]) - setup(); - scan(); - run(); -+ if(restart) execvp(argv[0], argv); - cleanup(); - XCloseDisplay(dpy); - return EXIT_SUCCESS; diff --git a/.config/suckless/dwm/dwm.o b/.config/suckless/dwm/dwm.o index 534d5c7..8d7fd71 100644 Binary files a/.config/suckless/dwm/dwm.o and b/.config/suckless/dwm/dwm.o differ diff --git a/.config/suckless/dwm/dwm.png b/.config/suckless/dwm/dwm.png deleted file mode 100644 index b1f9ba7..0000000 Binary files a/.config/suckless/dwm/dwm.png and /dev/null differ diff --git a/.config/suckless/dwm/scripts/edit-suckless.sh b/.config/suckless/dwm/scripts/edit-suckless.sh index 4a456c5..82a5a72 100755 --- a/.config/suckless/dwm/scripts/edit-suckless.sh +++ b/.config/suckless/dwm/scripts/edit-suckless.sh @@ -20,7 +20,7 @@ done shift $((OPTIND - 1)) APP="$1" APP_DIR="/home/andrew/dotfiles/.config/suckless/$APP" -CONFIG_FILE="$APP_DIR/config.def.h" +CONFIG_FILE="$APP_DIR/config.h" if [[ -z "$APP" ]]; then echo "Usage: @@ -42,19 +42,18 @@ cd "$APP_DIR" || { } # Hash before edit -BEFORE_HASH=$(sha256sum config.def.h | cut -d ' ' -f1) +BEFORE_HASH=$(sha256sum config.h | cut -d ' ' -f1) # Edit file -nvim config.def.h +nvim config.h # Hash after edit -AFTER_HASH=$(sha256sum config.def.h | cut -d ' ' -f1) +AFTER_HASH=$(sha256sum config.h | cut -d ' ' -f1) if [[ "$BEFORE_HASH" != "$AFTER_HASH" || "$REBUILD" == true ]]; then echo "Rebuilding $APP..." - doas rm -f config.h make - doas make install + doas make clean install pkill dwm else echo "No changes detected. Skipping rebuild." diff --git a/.config/suckless/dwm/scripts/shuffle_wallpapers.sh b/.config/suckless/dwm/scripts/shuffle_wallpapers.sh index 4f893ec..2cadbd0 100755 --- a/.config/suckless/dwm/scripts/shuffle_wallpapers.sh +++ b/.config/suckless/dwm/scripts/shuffle_wallpapers.sh @@ -1,7 +1,6 @@ #!/usr/bin/env bash while true; do xwallpaper --zoom "$(find /home/andrew/.config/suckless/dwm/Wallpapers -type f | shuf -n1)" - date +%s > /tmp/last_wallpaper_time # Save current timestamp sleep 600 # Pause for 10 minutes - default 600 seconds done diff --git a/.config/suckless/slstatus/Makefile b/.config/suckless/slstatus/Makefile index 001cf35..13472f1 100644 --- a/.config/suckless/slstatus/Makefile +++ b/.config/suckless/slstatus/Makefile @@ -1,5 +1,3 @@ -# See LICENSE file for copyright and license details -# slstatus - suckless status monitor .POSIX: include config.mk @@ -38,10 +36,6 @@ install: all mkdir -p "$(DESTDIR)$(PREFIX)/bin" cp -f slstatus "$(DESTDIR)$(PREFIX)/bin" chmod 755 "$(DESTDIR)$(PREFIX)/bin/slstatus" - mkdir -p "$(DESTDIR)$(MANPREFIX)/man1" - cp -f slstatus.1 "$(DESTDIR)$(MANPREFIX)/man1" - chmod 644 "$(DESTDIR)$(MANPREFIX)/man1/slstatus.1" uninstall: rm -f "$(DESTDIR)$(PREFIX)/bin/slstatus" - rm -f "$(DESTDIR)$(MANPREFIX)/man1/slstatus.1" diff --git a/.config/suckless/slstatus/config.def.h b/.config/suckless/slstatus/config.def.h deleted file mode 100644 index d4aba54..0000000 --- a/.config/suckless/slstatus/config.def.h +++ /dev/null @@ -1,11 +0,0 @@ -const unsigned short interval = 1000; -static const char unknown_str[] = "n/a"; -#define MAXLEN 2048 - -static const struct arg args[] = { - { run_command, "VOL: %s • ", "wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{printf \"%d%%\", $2 * 100}'" }, - { run_command, "Next Wallpaper: %s • ", "sh /home/andrew/.config/suckless/slstatus/scripts/wallpaper-countdown.sh" }, - { run_command, "Age: %s Days • ", "sh -c 'echo $(( ( $(date +%s) - $(stat -c %W /) ) / 86400 ))'" }, - { run_command, "Layout: %s • ", "sh /home/andrew/.config/suckless/slstatus/scripts/get_layout.sh" }, - { run_command, "Up: %s ", "uptime -p | cut -d ' ' -f2-" }, -}; diff --git a/.config/suckless/slstatus/config.mk b/.config/suckless/slstatus/config.mk index 4bf317a..35b3f05 100644 --- a/.config/suckless/slstatus/config.mk +++ b/.config/suckless/slstatus/config.mk @@ -1,5 +1,5 @@ VERSION = 1.0 -MANPREFIX = /usr/local/share/man +PREFIX = /usr/local CPPFLAGS = $(shell pkg-config --cflags x11) -D_DEFAULT_SOURCE -DVERSION=\"${VERSION}\" LDFLAGS = $(shell pkg-config --libs-only-L x11) -s diff --git a/env.sh b/env.sh index 369c540..a319210 100755 --- a/env.sh +++ b/env.sh @@ -58,5 +58,5 @@ fc-cache -f echo -e "${GREEN}Rebuilding Suckless Software${RESET}" for x in "${CONFIG}suckless"/*/; do [[ -d "${x}" ]] || continue - cd "${x}" && doas rm -rf config.h && make && doas make install + cd "${x}" && make && doas make install done