9front - general discussion about 9front
 help / color / mirror / Atom feed
From: "Sigrid Solveig Haflínudóttir" <ftrvxmtrx@gmail.com>
To: 9front@9front.org
Subject: Re: [9front] program to bind/rebind keys
Date: Fri, 04 Jun 2021 22:02:19 +0200	[thread overview]
Message-ID: <4B3D0310DCDE3856ED8C43B7828EB4F0@gmail.com> (raw)
In-Reply-To: <CAHtSCHKWDKhUfYuXTZKgSYoJ8yB4-nsh9DbC=TcO48bN2og-YA@mail.gmail.com>

Quoth binary cat <dogedoge61@gmail.com>:
> The program would operate by opening /dev/kbd, then binding its output
> to /dev/kbd.
> It would read a list of keybindings (from a file and/or command line options),
> then operate in a loop of reading a key from (the old) /dev/kbd, checking if it
> matches any of the bindings given to it. If it finds a match, it executes the
> action associated with it. Otherwise, it passes the keypress on.
> 
> This could be used for global keyboard shortcuts by wrapping around rio,
> or for per-program keyboard shortcuts.
> 
> `awk` is surprisingly close to working for this, but it has a few problems,
> both with reading input delimited by NUL instead of LF, and with
> non-printable characters in regular expressions.
> 
> I'm up to provide a bounty for this, although first I'd like to have a rough
> idea of how difficult it would be to either write such a program, or to
> fix the problems with `awk`, so I know how much a reasonable bounty
> would be.
> 
> -- binarycat

One of the easy approaches used in riow[1] is to catch all keyboard
events that involve a specific modifier, Mod4 in this case, export it
via fs, and convert to plain text form in another small program.
Those then are used to do window management.

[1] https://git.sr.ht/~ft/riow


  reply	other threads:[~2021-06-05 12:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-04 18:20 binary cat
2021-06-04 20:02 ` Sigrid Solveig Haflínudóttir [this message]
2021-06-04 22:12 ` Stuart Morrow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B3D0310DCDE3856ED8C43B7828EB4F0@gmail.com \
    --to=ftrvxmtrx@gmail.com \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).