summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--st/config.h2
-rw-r--r--st/st.h2
-rw-r--r--st/x.c8
3 files changed, 9 insertions, 3 deletions
diff --git a/st/config.h b/st/config.h
index 705662e..3e13adf 100644
--- a/st/config.h
+++ b/st/config.h
@@ -119,6 +119,7 @@ unsigned int tabspaces = 8;
/* bg opacity */
float alpha = 0.8;
+float alpha_def;
float alphaOffset = 0.05;
float alphaUnfocus;
@@ -269,6 +270,7 @@ static Shortcut shortcuts[] = {
// APPEAREANCES
{ MODKEY, XK_a, changealpha, { .f = +0.05 } },
{ MODKEY, XK_s, changealpha, { .f = -0.05 } },
+ { MODKEY, XK_equal, changealpha, { .f = 0 } },
{ TERMMOD, XK_Down, zoom, { .f = -1 } },
{ TERMMOD, XK_Up, zoom, { .f = +1 } },
{ TERMMOD, XK_Next, zoom, { .f = -1 } },
diff --git a/st/st.h b/st/st.h
index 60d973a..310db4f 100644
--- a/st/st.h
+++ b/st/st.h
@@ -139,7 +139,7 @@ extern char *termname;
extern unsigned int tabspaces;
extern unsigned int defaultfg;
extern unsigned int defaultbg;
-extern float alpha;
+extern float alpha, alpha_def;
extern float alphaUnfocus;
extern const int boxdraw, boxdraw_bold, boxdraw_braille;
extern unsigned int defaultcs;
diff --git a/st/x.c b/st/x.c
index 3c1c242..6856e48 100644
--- a/st/x.c
+++ b/st/x.c
@@ -323,7 +323,9 @@ void
changealpha(const Arg *arg)
{
if((alpha > 0 && arg->f < 0) || (alpha < 1 && arg->f > 0))
- alpha += arg->f;
+ alpha += arg->f;
+ else if (arg->f == 0.0f)
+ alpha = alpha_def;
alpha = clamp(alpha, 0.0, 1.0);
alphaUnfocus = clamp(alpha-alphaOffset, 0.0, 1.0);
@@ -1331,10 +1333,12 @@ xinit(int cols, int rows)
xloadfonts(usedfont, 0);
}
-
/* spare fonts */
xloadsparefonts();
+ /* Backup default alpha value */
+ alpha_def = alpha;
+
/* colors */
xw.cmap = XCreateColormap(xw.dpy, parent, xw.vis, None);
xloadcols();