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

From: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Sat, 8 Jun 2019 19:10:55 +0200

On Sat, Jun 08, 2019 at 06:09:58PM +0200, Tobias Bengfort wrote:
> 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
>
>

Have you seen config.def.h?

        static Key key[] = {
                [...]

Isn't that enough?

-- 
Kind regards,
Hiltjo
Received on Sat Jun 08 2019 - 19:10:55 CEST

This archive was generated by hypermail 2.3.0 : Sat Jun 08 2019 - 19:12:23 CEST