From f69e3599e1006bbdd71c05343dce7190cd04decb Mon Sep 17 00:00:00 2001 From: xomf Date: Wed, 22 May 2024 19:34:08 -0400 Subject: [PATCH] im literally a genius :3 --- build.sh | 12 ++++++++++++ src/modules/battery.c | 1 + 2 files changed, 13 insertions(+) create mode 100644 build.sh diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..641002a --- /dev/null +++ b/build.sh @@ -0,0 +1,12 @@ +#!/usr/bin/bash + +set -xe +mkdir -p modules + +CCARGS="-Isrc/include -Wall -pedantic" + +cc -o dim src/main.c src/plug.c $CCARGS -lX11 -ldl +cc -o modules/clocky.dim src/modules/clock.c -rdynamic -shared -fPIC $CCARGS +cc -o modules/battery.dim src/modules/battery.c -rdynamic -shared -fPIC $CCARGS + + diff --git a/src/modules/battery.c b/src/modules/battery.c index 4ba38d3..fff6651 100644 --- a/src/modules/battery.c +++ b/src/modules/battery.c @@ -33,6 +33,7 @@ void plug_init(void) { void plug_reload(void) { /* Unused */ } void plug_poll(char* buf, size_t len) { + if (!fp) return; int perc = 0; fseek(fp, 0, SEEK_SET); fscanf(fp, "%d", &perc);