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
> @@ -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
> @@ -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

Reply via email to