diff --git a/config.h b/config.h index 089aa37..494f2fd 100644 --- a/config.h +++ b/config.h @@ -65,7 +65,7 @@ static const int natural_scrolling = 0; static const char *termcmd[] = { "alacritty", NULL }; static const char *menucmd[] = { "bemenu-run", NULL }; -static const Key keys[] = { +const Key keys[] = { /* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */ /* modifier key function argument */ { MODKEY, XKB_KEY_p, spawn, {.v = menucmd} }, diff --git a/config.mk b/config.mk index cd4e821..589ab78 100644 --- a/config.mk +++ b/config.mk @@ -2,7 +2,14 @@ PREFIX = /usr/local # Default compile flags (overridable by environment) -CFLAGS ?= -g -Wall -Wextra -Werror -Wno-unused-parameter -Wno-sign-compare -Wno-unused-function -Wno-unused-variable -Wdeclaration-after-statement +#CFLAGS ?= -g -Wall -Wextra -Werror -Wno-unused-parameter -Wno-sign-compare -Wno-unused-function -Wno-unused-variable -Wdeclaration-after-statement # Uncomment to build XWayland support -#CFLAGS += -DXWAYLAND +CFLAGS += -DXWAYLAND + +JL_BIN = ./julia/julia +JL_SHARE = $(shell $(JL_BIN) -e 'print(joinpath(Sys.BINDIR, Base.DATAROOTDIR, "julia"))') +CFLAGS += $(shell $(JL_BIN) $(JL_SHARE)/julia-config.jl --cflags) +CXXFLAGS += $(shell $(JL_BIN) $(JL_SHARE)/julia-config.jl --cflags) +LDFLAGS += $(shell $(JL_BIN) $(JL_SHARE)/julia-config.jl --ldflags) +LDLIBS += $(shell $(JL_BIN) $(JL_SHARE)/julia-config.jl --ldlibs) diff --git a/dwl.c b/dwl.c index a8e1dcd..2d6d6c0 100644 --- a/dwl.c +++ b/dwl.c @@ -48,6 +48,9 @@ #include #endif +#include +JULIA_DEFINE_FAST_TLS // only define this once, in an executable (not in a shared library) if you want fast code. + /* macros */ #define BARF(fmt, ...) do { fprintf(stderr, fmt "\n", ##__VA_ARGS__); exit(EXIT_FAILURE); } while (0) #define EBARF(fmt, ...) BARF(fmt ": %s", ##__VA_ARGS__, strerror(errno)) @@ -2571,6 +2574,10 @@ main(int argc, char *argv[]) if (optind < argc) goto usage; + /* required: setup the Julia context */ + jl_init(); + jl_eval_string("@show(cglobal(:keys))"); + // Wayland requires XDG_RUNTIME_DIR for creating its communications // socket if (!getenv("XDG_RUNTIME_DIR")) @@ -2578,6 +2585,7 @@ main(int argc, char *argv[]) setup(); run(startup_cmd); cleanup(); + jl_atexit_hook(0); return EXIT_SUCCESS; usage: