9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Acme event file and keyboard
@ 2025-03-26 17:09 m via 9fans
  0 siblings, 0 replies; 6+ messages in thread
From: m via 9fans @ 2025-03-26 17:09 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 811 bytes --]

Has anyone managed to do anything productive with acme's event files on 
windows and the keyboard ? All I can find is mouse-related scripts. 
 
I'm trying to do keybindings the easy way, by tapping into that event 
file, but I have some issues: 
 
- When text is added the tag isn't updated with Undo and Put 
 
- Thinking it's because acme didn't receive the event, I send it with 
winwriteevent from $PLAN9/lib/acme.rc but get "9p: write error: bad 
event syntax". No error when using 9fans.net/go/acme, but still no 
update on the tag 
 
Am I doing something wrong ? 
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tdb1f8947d5ae8b6d-M4aec50a6dec7807f200ea8e6
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 1490 bytes --]

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

* Re: [9fans] Acme event file and keyboard
  2025-04-01 23:41     ` Mathieu Bivert
@ 2025-04-04 16:33       ` rako via 9fans
  0 siblings, 0 replies; 6+ messages in thread
From: rako via 9fans @ 2025-04-04 16:33 UTC (permalink / raw)
  To: 9fans

On 4/2/25 01:41, Mathieu Bivert wrote:
> 1/ opening the event file disables menu management. one can
> write 'menu' to ctl (should still be undocumented) to re-enable it.
> 
> 2/ xfideventwrite() (src/cmd/acme/xfid.c) doesn't seem to handle
> "keyboard insert" events (e.g. "KI275 275 0 1 e"; third integers
> is a flag; acme(4) only describes writing event with a flag to 1).
> one can still insert text using the addr/data files, e.g. simulating
> the previous "KI" event with:
> 
>    $ echo -n '#275' | 9p write acme/796/addr # or '#275,#275'
>    $ echo -n e | 9p write acme/796/data
> 
> 3/ in my experience, at least on UNIX, something like sxhkd[0] has
> been preferable to acme events for shortcuts, albeit imperfect. in
> particular, I remember frequently hitting a race or something
> (iirc in 9pserve) when registering an "event handler" (reading
> acme event files) on all buffers.
> 
> hope it helps,
> 
> [0]: https://github.com/baskerville/sxhkd <https://github.com/ 
> baskerville/sxhkd>

Wow, thank you, that is exactly what I needed. I'm not so much 
interested in writing random text, but mapping Ctrl-key shortcuts and I 
hope sxhkd can do that !

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T08b139f442c68dca-M92050f400557e42386552ecf
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

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

* Re: [9fans] Acme event file and keyboard
  2025-03-29  0:25   ` m via 9fans
@ 2025-04-01 23:41     ` Mathieu Bivert
  2025-04-04 16:33       ` rako via 9fans
  0 siblings, 1 reply; 6+ messages in thread
From: Mathieu Bivert @ 2025-04-01 23:41 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 2133 bytes --]

1/ opening the event file disables menu management. one can
write 'menu' to ctl (should still be undocumented) to re-enable it.

2/ xfideventwrite() (src/cmd/acme/xfid.c) doesn't seem to handle
"keyboard insert" events (e.g. "KI275 275 0 1 e"; third integers
is a flag; acme(4) only describes writing event with a flag to 1).
one can still insert text using the addr/data files, e.g. simulating
the previous "KI" event with:

  $ echo -n '#275' | 9p write acme/796/addr # or '#275,#275'
  $ echo -n e | 9p write acme/796/data

3/ in my experience, at least on UNIX, something like sxhkd[0] has
been preferable to acme events for shortcuts, albeit imperfect. in
particular, I remember frequently hitting a race or something
(iirc in 9pserve) when registering an "event handler" (reading
acme event files) on all buffers.

hope it helps,

[0]: https://github.com/baskerville/sxhkd

On Sat, Mar 29, 2025 at 1:30 AM m via 9fans <9fans@9fans.net> wrote:

> Sorry I wasn't really clear, I'm talking about, in your example,
> `acme/29/event`. acme(4) explains I can also receive keyboard events and I
> do, I can get the characters I enter, but sending them back in has the
> behaviour I explained. I'm using `wineventloop` from acme.rc, and my event
> function is trivial:
>
> ```
> fn event {
>     winwritevent $*
> }
>
> newwindow
> wineventloop
> ```
>
> As I said I don't have errors when using the go API, only with the acme.rc
> one. I don't have anything special in +Errors
>
> --
> Matthieu
> *9fans <https://9fans.topicbox.com/latest>* / 9fans / see discussions
> <https://9fans.topicbox.com/groups/9fans> + participants
> <https://9fans.topicbox.com/groups/9fans/members> + delivery options
> <https://9fans.topicbox.com/groups/9fans/subscription> Permalink
> <https://9fans.topicbox.com/groups/9fans/T08b139f442c68dca-M336f69c7e238c2194c8283b1>
>

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T08b139f442c68dca-M3087eb6d571865be8f1e80f6
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 3120 bytes --]

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

* Re: [9fans] Acme event file and keyboard
  2025-03-28 13:56 ` Robert Kroeger
@ 2025-03-29  0:25   ` m via 9fans
  2025-04-01 23:41     ` Mathieu Bivert
  0 siblings, 1 reply; 6+ messages in thread
From: m via 9fans @ 2025-03-29  0:25 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 754 bytes --]

Sorry I wasn't really clear, I'm talking about, in your example, `acme/29/event`. acme(4) explains I can also receive keyboard events and I do, I can get the characters I enter, but sending them back in has the behaviour I explained. I'm using `wineventloop` from acme.rc, and my event function is trivial:

```
fn event {
    winwritevent $*
}

newwindow
wineventloop
```

As I said I don't have errors when using the go API, only with the acme.rc one. I don't have anything special in +Errors

-- 
Matthieu
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T08b139f442c68dca-M336f69c7e238c2194c8283b1
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 1482 bytes --]

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

* Re: [9fans] Acme event file and keyboard
  2025-03-26 17:02 Matthieu Rakotojaona via 9fans
@ 2025-03-28 13:56 ` Robert Kroeger
  2025-03-29  0:25   ` m via 9fans
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Kroeger @ 2025-03-28 13:56 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 1823 bytes --]

You said "acme's event files on windows". To be absolutely precise: you
mean this kind of window (from p9p and Edwood) (the 29 in this context)?

; 9p ls acme/29
addr
body
ctl
data
editout
errors
event
rdsel
tag
wrsel
xdata

So: what's the exact command line with args that you're running? Because
the error that you're seeing suggests that winwriteevent is sending a
malformed message to acme. Do you get any complaint content in Acme's
'+Errors' window? p9p Acme and Edwood both log some issues that show up in
their file system implementation to +Errors.

At least as how I understand the code, p9p Acme supports only the
interception of (some) mouse events. The event flow in (e.g. Edwood)
definitely does not include code to route key events to specific windows.
This is perhaps a worthwhile API addition.

Rob.



On Wed, Mar 26, 2025 at 11:37 AM Matthieu Rakotojaona via 9fans <
9fans@9fans.net> wrote:

> Has anyone managed to do anything productive with acme's event files on
> windows and the keyboard ? All I can find is mouse-related scripts.
> 
> I'm trying to do keybindings the easy way, by tapping into that event
> file, but I have some issues:
> 
> - When text is added the tag isn't updated with Undo and Put
> 
> - Thinking it's because acme didn't receive the event, I send it with
> winwriteevent from $PLAN9/lib/acme.rc but get "9p: write error: bad
> event syntax". No error when using 9fans.net/go/acme, but still no
> update on the tag
> 
> Am I doing something wrong ?
> 


-- 
Robert Kroeger
rjkroege@liqui.org

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T08b139f442c68dca-Mc4bbcc6bf08001a870632574
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 3664 bytes --]

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

* [9fans] Acme event file and keyboard
@ 2025-03-26 17:02 Matthieu Rakotojaona via 9fans
  2025-03-28 13:56 ` Robert Kroeger
  0 siblings, 1 reply; 6+ messages in thread
From: Matthieu Rakotojaona via 9fans @ 2025-03-26 17:02 UTC (permalink / raw)
  To: 9fans

Has anyone managed to do anything productive with acme's event files on 
windows and the keyboard ? All I can find is mouse-related scripts.

I'm trying to do keybindings the easy way, by tapping into that event 
file, but I have some issues:

- When text is added the tag isn't updated with Undo and Put

- Thinking it's because acme didn't receive the event, I send it with 
winwriteevent from $PLAN9/lib/acme.rc but get "9p: write error: bad 
event syntax". No error when using 9fans.net/go/acme, but still no 
update on the tag

Am I doing something wrong ?


------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T08b139f442c68dca-M9942e01549af86d8617824d0
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

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

end of thread, other threads:[~2025-04-04 16:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-26 17:09 [9fans] Acme event file and keyboard m via 9fans
  -- strict thread matches above, loose matches on Subject: below --
2025-03-26 17:02 Matthieu Rakotojaona via 9fans
2025-03-28 13:56 ` Robert Kroeger
2025-03-29  0:25   ` m via 9fans
2025-04-01 23:41     ` Mathieu Bivert
2025-04-04 16:33       ` rako via 9fans

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).