summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2020-08-21 19:05:54 +0000
committerLuke Smith <luke@lukesmith.xyz>2020-08-21 19:05:54 +0000
commit80c6f5c5f0dad7e7c41c3376006290a2b0b319be (patch)
tree1af12adbc42b055d526512081d332cf2b32eafc8
parente187610a230803ddca6b86fe0620cacdee177ac3 (diff)
parent73a6020865607018f6442317e7f94fb5d54a7016 (diff)
Merge branch 'master' into 'master'
change alpha with keyboard shortcut C-F11/C-F12 See merge request LukeSmithxyz/st!6
-rw-r--r--config.h2
-rw-r--r--x.c15
2 files changed, 17 insertions, 0 deletions
diff --git a/config.h b/config.h
index 47ed4d5..b49a405 100644
--- a/config.h
+++ b/config.h
@@ -267,6 +267,8 @@ static Shortcut shortcuts[] = {
{ MODKEY, XK_Down, kscrolldown, {.i = 1} },
{ MODKEY, XK_u, kscrollup, {.i = -1} },
{ MODKEY, XK_d, kscrolldown, {.i = -1} },
+ { ControlMask, XK_F11, changealpha, {.f = -0.05} },
+ { ControlMask, XK_F12, changealpha, {.f = +0.05} },
{ TERMMOD, XK_Up, zoom, {.f = +1} },
{ TERMMOD, XK_Down, zoom, {.f = -1} },
{ TERMMOD, XK_K, zoom, {.f = +1} },
diff --git a/x.c b/x.c
index d2ed474..652f3cc 100644
--- a/x.c
+++ b/x.c
@@ -68,6 +68,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 *);
@@ -304,6 +305,20 @@ numlock(const Arg *dummy)
}
void
+changealpha(const Arg *arg)
+{
+ if((alpha > 0 && arg->f < 0) || (alpha < 1 && arg->f > 0))
+ alpha += arg->f;
+ if(alpha < 0)
+ alpha = 0;
+ if(alpha > 1)
+ alpha = 1;
+
+ xloadcols();
+ redraw();
+}
+
+void
zoom(const Arg *arg)
{
Arg larg;