[hackers] [st][patch] Add sendraw as key binding alias for ttywrite

From: Tobias Bengfort <tobias.bengfort_AT_posteo.de>
Date: Sat, 8 Jun 2019 18:09:58 +0200

This is usefull to create key bindings that cannot be defined in a
terminal program itself. For example, this adds C-S-t as mapping for
creating a new tab in tmux:

  { TERMMOD, XK_T, sendraw, {.v = "\023c"} },
---
 st.c | 6 ++++++
 st.h | 1 +
 2 files changed, 7 insertions(+)
diff --git a/st.c b/st.c
index ede7ae6..dd1f6b8 100644
--- a/st.c
+++ b/st.c
_AT_@ -1954,6 +1954,12 @@ sendbreak(const Arg *arg)
 		perror("Error sending break");
 }
+void
+sendraw(const Arg *arg)
+{
+	ttywrite(arg->v, strlen(arg->v), 0);
+}
+
 void
 tprinter(char *s, size_t len)
 {
diff --git a/st.h b/st.h
index 4da3051..edaaf51 100644
--- a/st.h
+++ b/st.h
_AT_@ -83,6 +83,7 @@ void draw(void);
 void printscreen(const Arg *);
 void printsel(const Arg *);
 void sendbreak(const Arg *);
+void sendraw(const Arg *);
 void toggleprinter(const Arg *);
 int tattrset(int);
-- 
2.20.1
Received on Sat Jun 08 2019 - 18:09:58 CEST

This archive was generated by hypermail 2.3.0 : Sat Jun 08 2019 - 18:12:24 CEST