Re: [hackers] [slstatus] Update LICENSE || drkhsh
On Mon, 19 Dec 2022 02:44:40 +0100 (CET) g...@suckless.org wrote: Dear Aaron, > commit 1ae616190cb3f88221571343a284fdf9f55b683f > Author: drkhsh > AuthorDate: Mon Dec 19 02:40:00 2022 +0100 > Commit: drkhsh > CommitDate: Mon Dec 19 02:44:21 2022 +0100 > > Update LICENSE > > diff --git a/LICENSE b/LICENSE > index 70b9fb3..b7e3aa6 100644 > --- a/LICENSE > +++ b/LICENSE > @@ -27,6 +27,8 @@ Copyright 2020 Alexandre Ratchov > Copyright 2020 Mart Lubbers > Copyright 2020 Daniel Moch > Copyright 2022 NRK > +Copyright 2022 Patrick Iacob > +Copyright 2021-2022 planet36 > > Permission to use, copy, modify, and/or distribute this software for > any purpose with or without fee is hereby granted, provided that the > above planet36's real name is "Steven Ward" (as can be extracted from his GitHub[0]) and his canonical E-Mail-address is plane...@gmail.com. It should be avoided to add pseudonyms to license files, as the license is formally and legally binding. With best regards Laslo [0]:https://github.com/planet36/organize-roms/commit/24f10204297b74939a8676a864fa5c605e9f0306
Re: [hackers] [slstatus] config.mk: Fix PREFIX assignment || planet36
On Mon, 19 Dec 2022 02:44:40 +0100 (CET) g...@suckless.org wrote: Dear Aaron, > commit c225c4315161a992b9e44dd990d083ee57f7f713 > Author: planet36 > AuthorDate: Wed May 26 14:29:32 2021 -0400 > Commit: drkhsh > CommitDate: Mon Dec 19 02:44:21 2022 +0100 > > config.mk: Fix PREFIX assignment > > Signed-off-by: drkhsh > > diff --git a/config.mk b/config.mk > index ead1859..8f06800 100644 > --- a/config.mk > +++ b/config.mk > @@ -4,7 +4,7 @@ VERSION = 0 > # customize below to fit your system > > # paths > -PREFIX = /usr/local > +PREFIX ?= /usr/local > MANPREFIX = $(PREFIX)/share/man > > X11INC = /usr/X11R6/include > I would interject here that "?=" is not POSIX and assume that there was push by some packager. Based on my experience, I would recommend to go back to "=" and encourage packagers to simply do make PREFIX=... which overrides any assignments in config.mk. With best regards Laslo
[hackers] [slstatus] entropy: Use Unicode escape sequence in string || planet36
commit 581d937e51d10e6e74868d2397081b12952eae07 Author: planet36 AuthorDate: Fri Oct 28 10:49:05 2022 -0500 Commit: drkhsh CommitDate: Mon Dec 19 02:44:21 2022 +0100 entropy: Use Unicode escape sequence in string Signed-off-by: drkhsh diff --git a/components/entropy.c b/components/entropy.c index 66b2e5a..65010b0 100644 --- a/components/entropy.c +++ b/components/entropy.c @@ -22,7 +22,8 @@ const char * entropy(const char *unused) { + // https://www.unicode.org/charts/PDF/U2200.pdf /* Unicode Character 'INFINITY' (U+221E) */ - return "\xe2\x88\x9e"; + return "\u221E"; } #endif
[hackers] [slstatus] num_files: opendir() returns a directory stream || planet36
commit 984f45719e8ac9f4451c2d009fb34e28afdfbdb6 Author: planet36 AuthorDate: Tue May 11 22:45:34 2021 -0400 Commit: drkhsh CommitDate: Mon Dec 19 02:44:21 2022 +0100 num_files: opendir() returns a directory stream opendir() returns a directory stream, not a file descriptor Co-authored-by: drkhsh Signed-off-by: drkhsh diff --git a/components/num_files.c b/components/num_files.c index e4b4281..df0acd1 100644 --- a/components/num_files.c +++ b/components/num_files.c @@ -10,23 +10,23 @@ const char * num_files(const char *path) { struct dirent *dp; - DIR *fd; + DIR *dir; int num; - if (!(fd = opendir(path))) { + if (!(dir = opendir(path))) { warn("opendir '%s':", path); return NULL; } num = 0; - while ((dp = readdir(fd))) { + while ((dp = readdir(dir))) { if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..")) continue; /* skip self and parent */ num++; } - closedir(fd); + closedir(dir); return bprintf("%d", num); }
[hackers] [slstatus] Make LEN macro consistent with other suckless repos || planet36
commit c432c981df97f786c683435a4a06bd58fc9a7b18 Author: planet36 AuthorDate: Tue Apr 13 12:43:18 2021 -0400 Commit: drkhsh CommitDate: Mon Dec 19 02:44:21 2022 +0100 Make LEN macro consistent with other suckless repos Signed-off-by: drkhsh diff --git a/util.h b/util.h index 7f1f26c..cf4b027 100644 --- a/util.h +++ b/util.h @@ -3,7 +3,7 @@ extern char buf[1024]; -#define LEN(x) (sizeof (x) / sizeof *(x)) +#define LEN(x) (sizeof(x) / sizeof((x)[0])) extern char *argv0;
[hackers] [slstatus] config.mk: Fix PREFIX assignment || planet36
commit c225c4315161a992b9e44dd990d083ee57f7f713 Author: planet36 AuthorDate: Wed May 26 14:29:32 2021 -0400 Commit: drkhsh CommitDate: Mon Dec 19 02:44:21 2022 +0100 config.mk: Fix PREFIX assignment Signed-off-by: drkhsh diff --git a/config.mk b/config.mk index ead1859..8f06800 100644 --- a/config.mk +++ b/config.mk @@ -4,7 +4,7 @@ VERSION = 0 # customize below to fit your system # paths -PREFIX = /usr/local +PREFIX ?= /usr/local MANPREFIX = $(PREFIX)/share/man X11INC = /usr/X11R6/include
[hackers] [slstatus] Update LICENSE || drkhsh
commit 1ae616190cb3f88221571343a284fdf9f55b683f Author: drkhsh AuthorDate: Mon Dec 19 02:40:00 2022 +0100 Commit: drkhsh CommitDate: Mon Dec 19 02:44:21 2022 +0100 Update LICENSE diff --git a/LICENSE b/LICENSE index 70b9fb3..b7e3aa6 100644 --- a/LICENSE +++ b/LICENSE @@ -27,6 +27,8 @@ Copyright 2020 Alexandre Ratchov Copyright 2020 Mart Lubbers Copyright 2020 Daniel Moch Copyright 2022 NRK +Copyright 2022 Patrick Iacob +Copyright 2021-2022 planet36 Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above
[hackers] [slstatus] Sort functions by name || planet36
commit d77f216faea5566ba8ebdbf1456c5e6806d2eeb5 Author: planet36 AuthorDate: Fri Apr 2 14:11:00 2021 -0400 Commit: drkhsh CommitDate: Mon Dec 19 02:44:21 2022 +0100 Sort functions by name Co-authored-by: drkhsh Signed-off-by: drkhsh diff --git a/config.def.h b/config.def.h index 2fc2557..d805331 100644 --- a/config.def.h +++ b/config.def.h @@ -14,13 +14,13 @@ static const char unknown_str[] = "n/a"; * * battery_percbattery percentage battery name (BAT0) * NULL on OpenBSD/FreeBSD - * battery_state battery charging state battery name (BAT0) - * NULL on OpenBSD/FreeBSD * battery_remaining battery remaining HH:MM battery name (BAT0) * NULL on OpenBSD/FreeBSD + * battery_state battery charging state battery name (BAT0) + * NULL on OpenBSD/FreeBSD * cat read arbitrary file path - * cpu_perccpu usage in percentNULL * cpu_freqcpu frequency in MHzNULL + * cpu_perccpu usage in percentNULL * datetimedate and time format string (%F %T) * disk_free free disk space in GB mountpoint path (/) * disk_perc disk usage in percent mountpoint path (/) @@ -60,8 +60,8 @@ static const char unknown_str[] = "n/a"; * usernameusername of current userNULL * vol_percOSS/ALSA volume in percent mixer file (/dev/mixer) * NULL on OpenBSD/FreeBSD - * wifi_perc WiFi signal in percent interface name (wlan0) * wifi_essid WiFi ESSID interface name (wlan0) + * wifi_perc WiFi signal in percent interface name (wlan0) */ static const struct arg args[] = { /* function format argument */ diff --git a/slstatus.h b/slstatus.h index f062e73..8ef5874 100644 --- a/slstatus.h +++ b/slstatus.h @@ -2,8 +2,8 @@ /* battery */ const char *battery_perc(const char *); -const char *battery_state(const char *); const char *battery_remaining(const char *); +const char *battery_state(const char *); /* cat */ const char *cat(const char *path); @@ -73,12 +73,12 @@ const char *uptime(const char *unused); /* user */ const char *gid(const char *unused); -const char *username(const char *unused); const char *uid(const char *unused); +const char *username(const char *unused); /* volume */ const char *vol_perc(const char *card); /* wifi */ -const char *wifi_perc(const char *interface); const char *wifi_essid(const char *interface); +const char *wifi_perc(const char *interface);
[hackers] [slstatus] battery: Consistent naming for capacity percentage || planet36
commit 87c3dd2c36e6d1df577e87fd4d73970fe58a3007 Author: planet36 AuthorDate: Tue Apr 6 12:48:18 2021 -0400 Commit: drkhsh CommitDate: Mon Dec 19 02:44:21 2022 +0100 battery: Consistent naming for capacity percentage https://www.kernel.org/doc/html/latest/power/power_supply_class.html Co-authored-by: drkhsh Signed-off-by: drkhsh diff --git a/components/battery.c b/components/battery.c index 9fa1014..1c753f9 100644 --- a/components/battery.c +++ b/components/battery.c @@ -6,6 +6,9 @@ #include "../util.h" #if defined(__linux__) +/* + * https://www.kernel.org/doc/html/latest/power/power_supply_class.html + */ #include #include #include @@ -35,15 +38,15 @@ const char * battery_perc(const char *bat) { - int perc; + int cap_perc; char path[PATH_MAX]; if (esnprintf(path, sizeof(path), POWER_SUPPLY_CAPACITY, bat) < 0) return NULL; - if (pscanf(path, "%d", &perc) != 1) + if (pscanf(path, "%d", &cap_perc) != 1) return NULL; - return bprintf("%d", perc); + return bprintf("%d", cap_perc); } const char * @@ -197,14 +200,14 @@ const char * battery_perc(const char *unused) { - int cap; + int cap_perc; size_t len; - len = sizeof(cap); - if (sysctlbyname(BATTERY_LIFE, &cap, &len, NULL, 0) < 0 || !len) + len = sizeof(cap_perc); + if (sysctlbyname(BATTERY_LIFE, &cap_perc, &len, NULL, 0) < 0 || !len) return NULL; - return bprintf("%d", cap); + return bprintf("%d", cap_perc); } const char *
[hackers] [slstatus] uptime: Use sizeof instead of repeating the size || planet36
commit 40f13be551f0e1a0eaee07dcb64b3b6ab3a68dd9 Author: planet36 AuthorDate: Thu Mar 25 13:05:48 2021 -0400 Commit: drkhsh CommitDate: Mon Dec 19 02:44:21 2022 +0100 uptime: Use sizeof instead of repeating the size Signed-off-by: drkhsh diff --git a/components/uptime.c b/components/uptime.c index d97e5e8..6227f73 100644 --- a/components/uptime.c +++ b/components/uptime.c @@ -22,7 +22,7 @@ uptime(const char *unused) struct timespec uptime; if (clock_gettime(UPTIME_FLAG, &uptime) < 0) { - snprintf(warn_buf, 256, "clock_gettime %d", UPTIME_FLAG); + snprintf(warn_buf, sizeof(warn_buf), "clock_gettime %d", UPTIME_FLAG); warn(warn_buf); return NULL; }
[hackers] [slstatus] keymap: Variable "layout" should be const || planet36
commit c75cb9ad7af55d16b864b1059fbc1aaa9d9874de Author: planet36 AuthorDate: Fri Mar 5 14:35:24 2021 -0500 Commit: drkhsh CommitDate: Mon Dec 19 02:44:21 2022 +0100 keymap: Variable "layout" should be const Signed-off-by: drkhsh diff --git a/components/keymap.c b/components/keymap.c index 4740431..f8a2a47 100644 --- a/components/keymap.c +++ b/components/keymap.c @@ -50,7 +50,8 @@ keymap(const char *unused) Display *dpy; XkbDescRec *desc; XkbStateRec state; - char *symbols, *layout; + char *symbols; + const char *layout; layout = NULL; @@ -74,7 +75,7 @@ keymap(const char *unused) warn("XGetAtomName: Failed to get atom name"); goto end; } - layout = (char *)bprintf("%s", get_layout(symbols, state.group)); + layout = bprintf("%s", get_layout(symbols, state.group)); XFree(symbols); end: XkbFreeKeyboard(desc, XkbSymbolsNameMask, 1);
[hackers] [slstatus] config.def.h: Remove stray double quote in comment || planet36
commit e22d447684d8b42731871de5b732669a822ddd1a Author: planet36 AuthorDate: Fri Mar 5 14:19:49 2021 -0500 Commit: drkhsh CommitDate: Mon Dec 19 02:44:21 2022 +0100 config.def.h: Remove stray double quote in comment Signed-off-by: drkhsh diff --git a/config.def.h b/config.def.h index 90b57a1..2fc2557 100644 --- a/config.def.h +++ b/config.def.h @@ -24,7 +24,7 @@ static const char unknown_str[] = "n/a"; * datetimedate and time format string (%F %T) * disk_free free disk space in GB mountpoint path (/) * disk_perc disk usage in percent mountpoint path (/) - * disk_total total disk space in GB mountpoint path (/") + * disk_total total disk space in GB mountpoint path (/) * disk_used used disk space in GB mountpoint path (/) * entropy available entropy NULL * gid GID of current user NULL
[hackers] [slstatus] verr: Remove special "usage" case || planet36
commit 0e2ff8dc1009dccab4d2e17ed53ba65c4e99450e Author: planet36 AuthorDate: Fri Mar 5 14:20:29 2021 -0500 Commit: drkhsh CommitDate: Mon Dec 19 02:44:21 2022 +0100 verr: Remove special "usage" case In function verr, remove special case for "usage" string Co-authored-by: drkhsh Signed-off-by: drkhsh diff --git a/util.c b/util.c index d1f6077..bca9b2e 100644 --- a/util.c +++ b/util.c @@ -13,9 +13,6 @@ char *argv0; static void verr(const char *fmt, va_list ap) { - if (argv0 && strncmp(fmt, "usage", sizeof("usage") - 1)) - fprintf(stderr, "%s: ", argv0); - vfprintf(stderr, fmt, ap); if (fmt[0] && fmt[strlen(fmt) - 1] == ':') {
[hackers] [slstatus] disk: Cast fsblkcnt_t to double instead of float || planet36
commit 89f8476110c7bdfb70528da79be328ba0f6490be Author: planet36 AuthorDate: Fri Mar 5 14:28:15 2021 -0500 Commit: drkhsh CommitDate: Mon Dec 19 02:44:21 2022 +0100 disk: Cast fsblkcnt_t to double instead of float Signed-off-by: drkhsh diff --git a/components/disk.c b/components/disk.c index 0d1c13e..e19a693 100644 --- a/components/disk.c +++ b/components/disk.c @@ -29,7 +29,7 @@ disk_perc(const char *path) } return bprintf("%d", (int)(100 * - (1.0f - ((float)fs.f_bavail / (float)fs.f_blocks; + (1 - ((double)fs.f_bavail / (double)fs.f_blocks; } const char *
[hackers] [slstatus] Update README || drkhsh
commit 173b03417d2a21a646c3d0d3d05ba158f9427139 Author: drkhsh AuthorDate: Mon Dec 19 02:41:19 2022 +0100 Commit: drkhsh CommitDate: Mon Dec 19 02:44:21 2022 +0100 Update README diff --git a/README b/README index b3fa7ae..7b50895 100644 --- a/README +++ b/README @@ -65,6 +65,5 @@ source code. This keeps it fast, secure and simple. Upcoming - -A release (v1.0) will come soon... ;) -After a long phase of inactivity, development has been continued! +A first feature-complete release with official packages for common distributions +will come soon.
Re: [hackers] DWM keypad navigation?
> Hello there. Hi fossy, > Does anyone know if there's a way to use the key-pad numbers (usually > found on the right side of generic keyboards) to navigate tags? > > I'm sure it can be done.. > The default is XK_1, for example, using TAGKEYS() macro. The keypad keys are prefixed with XK_KP (KP like KeyPad), and for example key number '1' is XK_KP_1
[hackers] DWM keypad navigation?
Hello there. Does anyone know if there's a way to use the key-pad numbers (usually found on the right side of generic keyboards) to navigate tags? I'm sure it can be done.. The default is XK_1, for example, using TAGKEYS() macro. I'm just annoyed by the numbers being so far apart (say 1 compared to 9), and having to guess them in dark (yeah - what a keyboard newbie, right?).