From 5f17537ca9538c8f2214be62c46823163fd8b5e5 Mon Sep 17 00:00:00 2001 From: auric Date: Mon, 8 Sep 2025 20:51:09 -0500 Subject: unk --- dwm/config.h | 8 ++++---- dwm/dwm | Bin 76624 -> 76624 bytes dwm/dwm.o | Bin 67680 -> 67656 bytes slock/config.h | 12 ++++++++++++ slock/explicit_bzero.o | Bin 0 -> 1464 bytes slock/slock | Bin 0 -> 34944 bytes slock/slock.c | 2 +- slock/slock.o | Bin 0 -> 28296 bytes 8 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 slock/config.h create mode 100644 slock/explicit_bzero.o create mode 100755 slock/slock create mode 100644 slock/slock.o diff --git a/dwm/config.h b/dwm/config.h index 497dc66..c89c80d 100644 --- a/dwm/config.h +++ b/dwm/config.h @@ -6,8 +6,8 @@ static const unsigned int gappx = 3; /* gaps between windows */ static const unsigned int snap = 32; /* snap pixel */ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ -static const char *fonts[] = { "monospace:size=10" }; -static const char dmenufont[] = "monospace:size=10"; +static const char *fonts[] = { "Monaco:size=12" }; +static const char dmenufont[] = "Monaco:size=12"; static const char col_gray1[] = "#000000"; static const char col_gray2[] = "#555555"; static const char col_gray3[] = "#dddddd"; @@ -71,9 +71,9 @@ static const char *screenshotcmd[] = { "flameshot", "gui", NULL }; static const char *mediaplaypause[] = { "playerctl", "play-pause", NULL }; static const char *medianext[] = { "playerctl", "next", NULL }; static const char *mediaprev[] = { "playerctl", "previous", NULL }; -static const char *calendarcmd[] = { "/bin/sh", "-c", "st -e sh -c 'cal -3 | less -+F'", NULL }; +static const char *calendarcmd[] = { "/bin/sh", "-c", "st -e sh -c 'cal -3 | less'", NULL }; static const char *dunstlogcmd[] = { "/bin/sh", "-c", "st -e sh -c 'less -+F \"$HOME/.cache/dunst/dunst.log\"'", NULL }; -static const char *powermenucmd[] = { "/bin/sh", "-c", "printf 'lock\\nreboot\\nshutdown' | dmenu | xargs -r -I{} sh -c 'case \"{}\" in lock) slock ;; reboot) loginctl reboot ;; shutdown) loginctl poweroff ;; esac'", NULL }; +static const char *powermenucmd[] = { "/bin/sh", "-c", "printf '%s\n' lock reboot shutdown | dmenu | xargs -r -I{} sh -c 'case \"{}\" in lock) slock ;; reboot) loginctl reboot ;; shutdown) loginctl poweroff ;; esac'", NULL }; static const Key keys[] = { /* modifier key function argument */ diff --git a/dwm/dwm b/dwm/dwm index 750cdc5..cb75edd 100755 Binary files a/dwm/dwm and b/dwm/dwm differ diff --git a/dwm/dwm.o b/dwm/dwm.o index efa1a13..34b5734 100644 Binary files a/dwm/dwm.o and b/dwm/dwm.o differ diff --git a/slock/config.h b/slock/config.h new file mode 100644 index 0000000..9855e21 --- /dev/null +++ b/slock/config.h @@ -0,0 +1,12 @@ +/* user and group to drop privileges to */ +static const char *user = "nobody"; +static const char *group = "nogroup"; + +static const char *colorname[NUMCOLS] = { + [INIT] = "black", /* after initialization */ + [INPUT] = "#005577", /* during input */ + [FAILED] = "#CC3333", /* wrong password */ +}; + +/* treat a cleared input like a wrong password (color) */ +static const int failonclear = 1; diff --git a/slock/explicit_bzero.o b/slock/explicit_bzero.o new file mode 100644 index 0000000..192474c Binary files /dev/null and b/slock/explicit_bzero.o differ diff --git a/slock/slock b/slock/slock new file mode 100755 index 0000000..0d85d2f Binary files /dev/null and b/slock/slock differ diff --git a/slock/slock.c b/slock/slock.c index 962cc1d..297e076 100644 --- a/slock/slock.c +++ b/slock/slock.c @@ -180,7 +180,7 @@ blurbackground(Display *dpy, struct lock *lock) if (!img) return; imlib_context_set_image(img); - imlib_image_blur(20); + imlib_image_blur(75); lock->bgmap = XCreatePixmap(dpy, lock->root, w, h, DefaultDepth(dpy, lock->screen)); diff --git a/slock/slock.o b/slock/slock.o new file mode 100644 index 0000000..f28cbdd Binary files /dev/null and b/slock/slock.o differ -- cgit v1.2.3 From 1e78a122dc52f1c791fdcb7733a53d70f3929970 Mon Sep 17 00:00:00 2001 From: auric <104602845+ihateamongus@users.noreply.github.com> Date: Mon, 8 Sep 2025 20:51:30 -0500 Subject: Add color staggering demo --- tools/Makefile | 14 +++++--- tools/colorstagger.c | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+), 5 deletions(-) create mode 100644 tools/colorstagger.c diff --git a/tools/Makefile b/tools/Makefile index ae33902..e42f8bf 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,16 +1,20 @@ +.RECIPEPREFIX = > CC = cc CFLAGS = -std=c99 -Wall -Wextra -pedantic -Os LDFLAGS = PREFIX ?= /usr/local -all: exofetch +all: exofetch colorstagger exofetch: exofetch.c - $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) +>$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) + +colorstagger: colorstagger.c +>$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) -lX11 clean: - rm -f exofetch +>rm -f exofetch colorstagger install: exofetch - mkdir -p $(DESTDIR)$(PREFIX)/bin - cp -f exofetch $(DESTDIR)$(PREFIX)/bin +>mkdir -p $(DESTDIR)$(PREFIX)/bin +>cp -f exofetch $(DESTDIR)$(PREFIX)/bin diff --git a/tools/colorstagger.c b/tools/colorstagger.c new file mode 100644 index 0000000..3e68faf --- /dev/null +++ b/tools/colorstagger.c @@ -0,0 +1,97 @@ +#define _XOPEN_SOURCE 500 +#include +#include +#include +#include +#include + +typedef struct { unsigned char r, g, b; } Color; + +static Color +parse(const char *hex) +{ + Color c = {0}; + if (hex[0] == '#') + hex++; + if (strlen(hex) >= 6) { + char buf[3] = {0}; + buf[0] = hex[0]; buf[1] = hex[1]; c.r = strtol(buf, NULL, 16); + buf[0] = hex[2]; buf[1] = hex[3]; c.g = strtol(buf, NULL, 16); + buf[0] = hex[4]; buf[1] = hex[5]; c.b = strtol(buf, NULL, 16); + } + return c; +} + +static unsigned long +pack(Color c) +{ + return ((unsigned long)c.r << 16) | + ((unsigned long)c.g << 8) | + ((unsigned long)c.b); +} + +static Color +mix(Color a, Color b, double t) +{ + Color c; + c.r = a.r + (b.r - a.r) * t; + c.g = a.g + (b.g - a.g) * t; + c.b = a.b + (b.b - a.b) * t; + return c; +} + +int +main(void) +{ + char *colors[] = {"#ff5555", "#f1fa8c", "#50fa7b", "#8be9fd", "#bd93f9"}; + const int ncolors = sizeof(colors) / sizeof(colors[0]); + + Display *d = XOpenDisplay(NULL); + if (!d) { + fprintf(stderr, "cannot open display\n"); + return 1; + } + int s = DefaultScreen(d); + int width = 600, height = 100; + Window w = XCreateSimpleWindow(d, RootWindow(d, s), 10, 10, width, height, + 1, BlackPixel(d, s), WhitePixel(d, s)); + XSelectInput(d, w, KeyPressMask); + XMapWindow(d, w); + GC gc = XCreateGC(d, w, 0, NULL); + + int grad = 60, solid = 60; + int running = 1; + while (running) { + while (XPending(d)) { + XEvent e; + XNextEvent(d, &e); + if (e.type == KeyPress) + running = 0; + } + + int x = 0; + for (int i = 0; i < ncolors; i++) { + Color a = parse(colors[i]); + Color b = parse(colors[(i + 1) % ncolors]); + for (int k = 0; k < grad; k++) { + double t = k / (double)(grad - 1); + Color c = mix(a, b, t); + XSetForeground(d, gc, pack(c)); + XDrawLine(d, w, gc, x + k, 0, x + k, height); + } + x += grad; + XSetForeground(d, gc, pack(b)); + XFillRectangle(d, w, gc, x, 0, solid, height); + x += solid; + } + XFlush(d); + usleep(500000); + char *tmp = colors[0]; + memmove(colors, colors + 1, (ncolors - 1) * sizeof(char *)); + colors[ncolors - 1] = tmp; + XClearWindow(d, w); + } + + XCloseDisplay(d); + return 0; +} -- cgit v1.2.3