Skip to content

Instantly share code, notes, and snippets.

@SeungheonOh
Last active February 22, 2020 05:12
Show Gist options
  • Save SeungheonOh/5e251f98928942737d2a4c17884a3f97 to your computer and use it in GitHub Desktop.
Save SeungheonOh/5e251f98928942737d2a4c17884a3f97 to your computer and use it in GitHub Desktop.
St Live font reload patch
diff --git a/st.c b/st.c
index 21c6739..dd3c577 100644
--- a/st.c
+++ b/st.c
@@ -1936,6 +1936,15 @@ strhandle(void)
}
}
return;
+ case 69:
+ if (narg < 2)
+ break;
+ xunloadfonts();
+ xloadfonts(strescseq.args[1], 0);
+ xloadsparefonts();
+ cresize(0, 0);
+ xhints();
+ return;
case 4: /* color set */
if (narg < 3)
break;
diff --git a/win.h b/win.h
index a6ef1b9..7a60768 100644
--- a/win.h
+++ b/win.h
@@ -23,6 +23,11 @@ enum win_mode {
|MODE_MOUSEMANY,
};
+void xloadfonts(char *, double);
+void xloadsparefonts(void);
+void xunloadfonts(void);
+void xhints(void);
+void cresize(int, int);
void xbell(void);
void xclipcopy(void);
void xdrawcursor(int, int, Glyph, int, int, Glyph);
diff --git a/x.c b/x.c
index c09392b..b97d6b9 100644
--- a/x.c
+++ b/x.c
@@ -160,16 +160,11 @@ static void ximopen(Display *);
static void ximinstantiate(Display *, XPointer, XPointer);
static void ximdestroy(XIM, XPointer, XPointer);
static void xinit(int, int);
-static void cresize(int, int);
static void xresize(int, int);
-static void xhints(void);
static int xloadcolor(int, const char *, Color *);
static int xloadfont(Font *, FcPattern *);
-static void xloadfonts(char *, double);
static int xloadsparefont(FcPattern *, int);
-static void xloadsparefonts(void);
static void xunloadfont(Font *);
-static void xunloadfonts(void);
static void xsetenv(void);
static void xseturgency(int);
static int evcol(XEvent *);
@SeungheonOh
Copy link
Author

Note: apply with git apply --ignore-space-change --ignore-whitespace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment