summaryrefslogtreecommitdiff
path: root/.config/paru/pkg_config/st/patches/0004-Apply-changealpha-0.1-modified.diff
blob: 3886ae9bca6bdee2adf449e062d3e83a3608f117 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
From ce788c4b745653bb3d74eb8dc3ec1312bb97ee57 Mon Sep 17 00:00:00 2001
From: A Farzat <a@farzat.xyz>
Date: Sun, 31 Dec 2023 09:56:43 +0900
Subject: [PATCH 4/4] Apply changealpha-0.1 modified

---
 config.def.h |  2 ++
 st.1         |  6 ++++++
 x.c          | 13 +++++++++++++
 3 files changed, 21 insertions(+)

diff --git a/config.def.h b/config.def.h
index 4a60638..b76cb0e 100644
--- a/config.def.h
+++ b/config.def.h
@@ -202,6 +202,8 @@ static Shortcut shortcuts[] = {
 	{ ControlMask,          XK_Print,       toggleprinter,  {.i =  0} },
 	{ ShiftMask,            XK_Print,       printscreen,    {.i =  0} },
 	{ XK_ANY_MOD,           XK_Print,       printsel,       {.i =  0} },
+	{ TERMMOD,              XK_F11,         changealpha,    {.f = -0.05} },
+	{ TERMMOD,              XK_F12,         changealpha,    {.f = +0.05} },
 	{ TERMMOD,              XK_Prior,       zoom,           {.f = +1} },
 	{ TERMMOD,              XK_Next,        zoom,           {.f = -1} },
 	{ TERMMOD,              XK_Home,        zoomreset,      {.f =  0} },
diff --git a/st.1 b/st.1
index 39120b4..ef18153 100644
--- a/st.1
+++ b/st.1
@@ -151,6 +151,12 @@ Decrease font size.
 .B Ctrl-Shift-Home
 Reset to default font size.
 .TP
+.B Ctrl-Shift-F11
+Decrease the opacity by 0.05.
+.TP
+.B Ctrl-Shift-F12
+Increase the opacity by 0.05.
+.TP
 .B Ctrl-Shift-y
 Paste from primary selection (middle mouse button).
 .TP
diff --git a/x.c b/x.c
index 9a76f95..9e75b23 100644
--- a/x.c
+++ b/x.c
@@ -55,6 +55,7 @@ static void clipcopy(const Arg *);
 static void clippaste(const Arg *);
 static void numlock(const Arg *);
 static void selpaste(const Arg *);
+static void changealpha(const Arg *);
 static void zoom(const Arg *);
 static void zoomabs(const Arg *);
 static void zoomreset(const Arg *);
@@ -295,6 +296,18 @@ numlock(const Arg *dummy)
 	win.mode ^= MODE_NUMLOCK;
 }
 
+void
+changealpha(const Arg *arg)
+{
+	alpha += arg->f;
+	LIMIT(alpha, 0, 1);
+
+	dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * alpha);
+	/* Required to remove artifacting from borderpx */
+	cresize(0, 0);
+	redraw();
+}
+
 void
 zoom(const Arg *arg)
 {
-- 
2.46.0