ewancoder / wmii

Automatically exported from code.google.com/p/wmii
MIT License
0 stars 0 forks source link

local_events not read (in sh wmiirc) #229

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Let dash be your shell in wmiirc and have this in wmiirc_local:

local_events() {
    cat <<'!'
Key $MODKEY-Control-Shift-$LEFT
        wmiir xwrite /tag/sel/ctl grow sel sel right -1
Key $MODKEY-Control-Shift-$RIGHT
        wmiir xwrite /tag/sel/ctl grow sel sel right 1
Key $MODKEY-Control-Shift-$DOWN
        wmiir xwrite /tag/sel/ctl grow sel sel down 1
Key $MODKEY-Control-Shift-$UP
        wmiir xwrite /tag/sel/ctl grow sel sel down -1
!
}

2. Try to use the keybindings.

What is the expected result? What do you see instead?
The keys do not work. They are also not in /keys.

What version of the product are you using (wmii -v)? On what operating
system (uname -a)?
wmii-hg2785

Please provide any additional information below.
The following does work instead:

wi_events <<'!'
...
!

Also, on another machine, which uses ksh as the shell in wmiirc, the original 
snippet with local_events does work, so I assume it is related to dash. Anyway, 
I am wondering what local_events is about when you can use wi_events directly. 
I thought about corner cases, where the functional nature would be useful, but 
since everything in wmiirc_local is evaluated only after the definitions in 
wmiirc, I could not find one.

Original issue reported on code.google.com by skwi...@googlemail.com on 23 Feb 2011 at 8:37

GoogleCodeExporter commented 8 years ago
I'm not sure if Kris intended the "sh wmiirc" to be runnable under dash.  Try 
bash.

Original comment by sunaku on 23 Feb 2011 at 7:30

GoogleCodeExporter commented 8 years ago
He did.
See for example changeset 2668:a41c27c7d8be.

Original comment by skwi...@googlemail.com on 23 Feb 2011 at 7:35

GoogleCodeExporter commented 8 years ago
Same problem with bash here.
I suppose the reason is that the default code in wmiirc,

  local_events | wi_events

will execute `wi_events' in a subshell, and that `wi_events' stores settings in 
a shell-scoped space (so they're immediately lost after exiting the subshell). 
When replacing the line with

  local_events >/tmp/localEvents$$
  wi_events < /tmp/localEvents$$
  rm -f /tmp/localEvents$$

everything works fine.

In version 3.9.2, this problem did not exist (so I lost all custom key settings 
when switching to -hg).

BTW, there's a similar problem with $HOME/.wmii-hg/wmiirc_local: The `status' 
function is also called as part of a pipe, and that means that if `status' 
needs to preserve information over multiple invocations then this requires 
really ugly workarounds (as opposed to simply storing that information in some 
shell variable).

Adding a simple "show-average-network-bandwidth-over-last-3-seconds" status 
field with that almost drove me nuts...

So it would be really useful if execution of `local_events' and `status' in a 
subshell could be avoided somehow.

Original comment by a...@fractal9.net on 5 Jun 2011 at 3:11

GoogleCodeExporter commented 8 years ago

Original comment by sunaku on 19 Sep 2011 at 8:24

GoogleCodeExporter commented 8 years ago
local_events is deprecated. wmiirc_local.sh should simply call wi_events itself 
since it now supports multiple invocations. That line was an inadequately 
tested stopgap compatibility measure.

Original comment by maglion...@gmail.com on 19 Sep 2011 at 8:30

GoogleCodeExporter commented 8 years ago
This issue was closed by revision ec047f6f9b26.

Original comment by maglion...@gmail.com on 19 Sep 2011 at 8:39