woodruffw / screenfetch-c

A rewrite of screenFetch in C.
MIT License
73 stars 17 forks source link

Use C code to detect WM theme #42

Closed darealshinji closed 6 years ago

darealshinji commented 6 years ago

An attempt to replace the detectwm script. Still needs to be tested on all WMs/DEs except MATE/Metacity.

darealshinji commented 6 years ago

Building with -D_POSIX_C_SOURCE=200809L would prevent us from implementing our own version of strdup():

--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 CC = gcc
 CFLAGS = -O3 -std=c99 -Wall -Wformat -Wunused-variable -pedantic
-CPPFLAGS = -D_POSIX_C_SOURCE=200112L
+CPPFLAGS =
 LDFLAGS =
 INSTALL = install -c

@@ -37,9 +37,11 @@ else
        ifeq ($(UNAME_S),Linux)
                SOURCES += $(wildcard ./src/plat/linux/*.c)
                CFLAGS += -Wno-unused-result
+               CPPFLAGS += -D_POSIX_C_SOURCE=200809L
                LDFLAGS += -lX11 -lGL
                SCRIPTS += ./src/scripts/detectgtk
                TESTS += x11test gltest
+       else
+               CPPFLAGS += -D_POSIX_C_SOURCE=200112L
        endif

        ifeq ($(UNAME_S),Darwin)
woodruffw commented 6 years ago

This looks pretty good to me, besides the one change above. Thanks a ton!

darealshinji commented 6 years ago

I've updated src/util.c

woodruffw commented 6 years ago

Thanks! I'll take a final look at this in a bit.