Skip to content

Instantly share code, notes, and snippets.

@unexist
Created January 4, 2026 14:30
Show Gist options
  • Select an option

  • Save unexist/4ee3cb94c91555b1bac01e23f992b9e4 to your computer and use it in GitHub Desktop.

Select an option

Save unexist/4ee3cb94c91555b1bac01e23f992b9e4 to your computer and use it in GitHub Desktop.
subtle 0.7b patch file
--- src/subtle.h.orig 2026-01-04 14:49:11.057371304 +0100
+++ src/subtle.h 2026-01-04 14:47:02.050248599 +0100
@@ -151,6 +151,7 @@
} SubSublet;
SubSublet *subSubletFind(Window win); // Find a sublet
+void subSubletSift(int pos);
void subSubletInit(void); // Init sublet list
void subSubletNew(int type, int ref, // Create a new sublet
time_t interval, unsigned int width);
--- src/lua.c.orig 2026-01-04 15:06:14.289906558 +0100
+++ src/lua.c 2026-01-04 15:21:59.501183000 +0100
@@ -146,6 +146,7 @@
}
else snprintf(buf, sizeof(buf), "%s/config.lua", CONFIG_DIR);
}
+ else snprintf(buf, sizeof(buf), "%s", path);
subLogDebug("Reading `%s'\n", buf);
if(luaL_loadfile(configstate, buf) || lua_pcall(configstate, 0, 0, 0))
@@ -295,13 +296,13 @@
subLuaLoadSublets(const char *path)
{
DIR *dir = NULL;
- char buf[100];
+ char dirbuf[100] = {0};
struct dirent *entry = NULL;
state = StateNew();
- if(path) snprintf(buf, sizeof(buf), "%s", buf);
- else snprintf(buf, sizeof(buf), "%s/.%s/sublets", getenv("HOME"), PACKAGE_NAME);
+ if(path) snprintf(dirbuf, sizeof(dirbuf), "%s", path);
+ else snprintf(dirbuf, sizeof(dirbuf), "%s/.%s/sublets", getenv("HOME"), PACKAGE_NAME);
/* Put functions onto stack */
lua_newtable(state);
@@ -311,14 +312,15 @@
SetField(state, "add_meter", LUA_TFUNCTION, LuaAddMeter);
lua_setglobal(state, PACKAGE_NAME);
- if((dir = opendir(buf)))
+ if((dir = opendir(dirbuf)))
{
+ char filebuf[255] = {0};
while((entry = readdir(dir)))
{
if(!fnmatch("*.lua", entry->d_name, FNM_PATHNAME))
{
- snprintf(buf, sizeof(buf), "%s/.%s/sublets/%s", getenv("HOME"), PACKAGE_NAME, entry->d_name);
- luaL_loadfile(state, buf);
+ snprintf(filebuf, sizeof(filebuf), "%s/%s", dirbuf, entry->d_name);
+ luaL_loadfile(state, filebuf);
lua_pcall(state, 0, 0, 0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment