aboutsummaryrefslogtreecommitdiff
path: root/patches/changealpha.diff
diff options
context:
space:
mode:
authorProsperousPotato <ProsperousPotato@users.noreply.github.com>2025-12-10 18:47:53 +0000
committerProsperousPotato <ProsperousPotato@users.noreply.github.com>2025-12-10 18:47:53 +0000
commit57e07138a53149443263ff6a792909d94214cef4 (patch)
tree28fb04aefce8e257e5e1717cecd61bb4e1a490b2 /patches/changealpha.diff
parent8c4519141a7a2631c72ffc7bb611bcd3db9749b4 (diff)
update st config
Diffstat (limited to 'patches/changealpha.diff')
-rwxr-xr-xpatches/changealpha.diff80
1 files changed, 0 insertions, 80 deletions
diff --git a/patches/changealpha.diff b/patches/changealpha.diff
deleted file mode 100755
index 172969f..0000000
--- a/patches/changealpha.diff
+++ /dev/null
@@ -1,80 +0,0 @@
-diff --git a/config.def.h b/config.def.h
-index 91ab8ca..8a06176 100644
---- a/config.def.h
-+++ b/config.def.h
-@@ -93,6 +93,9 @@ char *termname = "st-256color";
- */
- unsigned int tabspaces = 8;
-
-+/* Background opacity */
-+float alpha_def;
-+
- /* Terminal colors (16 first used in escape sequence) */
- static const char *colorname[] = {
- /* 8 normal colors */
-@@ -201,6 +204,9 @@ static Shortcut shortcuts[] = {
- { TERMMOD, XK_Y, selpaste, {.i = 0} },
- { ShiftMask, XK_Insert, selpaste, {.i = 0} },
- { TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
-+ { MODKEY, XK_bracketleft, chgalpha, {.f = -1} }, /* Decrease opacity */
-+ { MODKEY|ShiftMask, XK_braceright, chgalpha, {.f = +1} }, /* Increase opacity */
-+ { MODKEY, XK_bracketright,chgalpha, {.f = 0} }, /* Reset opacity */
- };
-
- /*
-diff --git a/st.h b/st.h
-index fd3b0d8..3bb587e 100644
---- a/st.h
-+++ b/st.h
-@@ -124,3 +124,4 @@ extern unsigned int tabspaces;
- extern unsigned int defaultfg;
- extern unsigned int defaultbg;
- extern unsigned int defaultcs;
-+extern float alpha_def;
-diff --git a/x.c b/x.c
-index aa09997..f8c8c1a 100644
---- a/x.c
-+++ b/x.c
-@@ -59,6 +59,7 @@ static void zoom(const Arg *);
- static void zoomabs(const Arg *);
- static void zoomreset(const Arg *);
- static void ttysend(const Arg *);
-+static void chgalpha(const Arg *);
-
- /* config.h for applying patches and the configuration. */
- #include "config.h"
-@@ -1147,6 +1148,9 @@ xinit(int cols, int rows)
- usedfont = (opt_font == NULL)? font : opt_font;
- xloadfonts(usedfont, 0);
-
-+ /* Backup default alpha value */
-+ alpha_def = alpha;
-+
- /* colors */
- xw.cmap = XDefaultColormap(xw.dpy, xw.scr);
- xloadcols();
-@@ -1371,6 +1375,24 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
- return numspecs;
- }
-
-+void
-+chgalpha(const Arg *arg)
-+{
-+ if (arg->f == -1.0f && alpha >= 0.1f)
-+ alpha -= 0.1f;
-+ else if (arg->f == 1.0f && alpha < 1.0f)
-+ alpha += 0.1f;
-+ else if (arg->f == 0.0f)
-+ alpha = alpha_def;
-+ else
-+ return;
-+
-+ dc.col[defaultbg].color.alpha = (unsigned short)(0xFFFF * alpha);
-+ /* Required to remove artifacting from borderpx */
-+ cresize(0, 0);
-+ redraw();
-+}
-+
- void
- xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, int y)
- {