9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] program to bind/rebind keys
@ 2021-06-04 18:20 binary cat
  2021-06-04 20:02 ` Sigrid Solveig Haflínudóttir
  2021-06-04 22:12 ` Stuart Morrow
  0 siblings, 2 replies; 3+ messages in thread
From: binary cat @ 2021-06-04 18:20 UTC (permalink / raw)
  To: 9front

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9front] program to bind/rebind keys
  2021-06-04 18:20 [9front] program to bind/rebind keys binary cat
@ 2021-06-04 20:02 ` Sigrid Solveig Haflínudóttir
  2021-06-04 22:12 ` Stuart Morrow
  1 sibling, 0 replies; 3+ messages in thread
From: Sigrid Solveig Haflínudóttir @ 2021-06-04 20:02 UTC (permalink / raw)
  To: 9front

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9front] program to bind/rebind keys
  2021-06-04 18:20 [9front] program to bind/rebind keys binary cat
  2021-06-04 20:02 ` Sigrid Solveig Haflínudóttir
@ 2021-06-04 22:12 ` Stuart Morrow
  1 sibling, 0 replies; 3+ messages in thread
From: Stuart Morrow @ 2021-06-04 22:12 UTC (permalink / raw)
  To: 9front

> wrapping around rio,

Also the most correct way to write a screen locker. Right now if
someone has a rio with keyboard-based window management, they can just
close screenlock(1) with the keyboard.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-05 12:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-04 18:20 [9front] program to bind/rebind keys binary cat
2021-06-04 20:02 ` Sigrid Solveig Haflínudóttir
2021-06-04 22:12 ` Stuart Morrow

9front - general discussion about 9front

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/9front

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 9front 9front/ http://inbox.vuxu.org/9front \
		9front@9front.org
	public-inbox-index 9front

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.9front


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git