Re: [dev] wmii noob key binding help
I tried changing the shell to bash and it still didn't work. The fix at that link did though, so at least it works now. -Eitan On 02/26/2011 02:33 AM, Thomas Dahms wrote: It was the wrong wmiirc turns out. I was editing /etc/wmii-hg/wmiirc and I was thinking about how the keybindings aren't the only thing that wasn't working, so I ran a locate on wmiirc and found out I have a /usr/local/etc/wmii-hg/wmiirc. Putting the key bindings in there made them work. But I'm still confused about why they don't work when I put them in wmiirc_local in the local_events() function. I have a similar problem [1], but only when using dash as the shell. Try another shell if you are using dash. Or use the workaround described in [1]. [1] http://code.google.com/p/wmii/issues/detail?id=229
Re: [dev] wmii noob key binding help
It was the wrong wmiirc turns out. I was editing /etc/wmii-hg/wmiirc and I was thinking about how the keybindings aren't the only thing that wasn't working, so I ran a locate on wmiirc and found out I have a /usr/local/etc/wmii-hg/wmiirc. Putting the key bindings in there made them work. But I'm still confused about why they don't work when I put them in wmiirc_local in the local_events() function. I have a similar problem [1], but only when using dash as the shell. Try another shell if you are using dash. Or use the workaround described in [1]. [1] http://code.google.com/p/wmii/issues/detail?id=229 -- Thomas Dahms
Re: [dev] wmii noob key binding help
It was the wrong wmiirc turns out. I was editing /etc/wmii-hg/wmiirc and I was thinking about how the keybindings aren't the only thing that wasn't working, so I ran a locate on wmiirc and found out I have a /usr/local/etc/wmii-hg/wmiirc. Putting the key bindings in there made them work. But I'm still confused about why they don't work when I put them in wmiirc_local in the local_events() function. -Eitan On 02/25/2011 12:50 PM, Benjamin R. Haskell wrote: On Fri, 25 Feb 2011, Eitan Goldshtrom wrote: I've put the following directly into the events() function of my wmiirc script in the KeyGroup Other section Key $MODKEY-z amixer sset PCM 4+ & Key $MODKEY-v eval wmiir setsid amixer sset PCM 4+ & I've since quit wmii, logged out, logged back in, and started X and wmii again. Still the key bindings don't work. When I test each of those commands in a terminal it has the desired effect. I'm at a loss at this point as to why it doesn't work. Is there a way for me to check and see if anything is happening at all, even though my volume isn't actually changing? Try something interactive to see that keys are being reloaded (maybe you're editing the wrong wmiirc?): Key $MODKEY-z xmessage blahblah & or something that creates an obvious change: Key $MODKEY-z wmiir xwrite /ctl view "CHANGED" Maybe amixer isn't in your $PATH by the time wmii starts: Key $MODKEY-z $HOME/local-stuff/amixer sset PCM 4+ & Or just log the errors, and go from there: Key $MODKEY-z amixer sset PCM 4+ >$HOME/amixer.stdout 2>$HOME/amixer.stderr &
Re: [dev] wmii noob key binding help
On Fri, 25 Feb 2011, Eitan Goldshtrom wrote: I've put the following directly into the events() function of my wmiirc script in the KeyGroup Other section Key $MODKEY-z amixer sset PCM 4+ & Key $MODKEY-v eval wmiir setsid amixer sset PCM 4+ & I've since quit wmii, logged out, logged back in, and started X and wmii again. Still the key bindings don't work. When I test each of those commands in a terminal it has the desired effect. I'm at a loss at this point as to why it doesn't work. Is there a way for me to check and see if anything is happening at all, even though my volume isn't actually changing? Try something interactive to see that keys are being reloaded (maybe you're editing the wrong wmiirc?): Key $MODKEY-z xmessage blahblah & or something that creates an obvious change: Key $MODKEY-z wmiir xwrite /ctl view "CHANGED" Maybe amixer isn't in your $PATH by the time wmii starts: Key $MODKEY-z $HOME/local-stuff/amixer sset PCM 4+ & Or just log the errors, and go from there: Key $MODKEY-z amixer sset PCM 4+ >$HOME/amixer.stdout 2>$HOME/amixer.stderr & -- Best, Ben
Re: [dev] wmii noob key binding help
I've put the following directly into the events() function of my wmiirc script in the KeyGroup Other section Key $MODKEY-z amixer sset PCM 4+ & Key $MODKEY-v eval wmiir setsid amixer sset PCM 4+ & I've since quit wmii, logged out, logged back in, and started X and wmii again. Still the key bindings don't work. When I test each of those commands in a terminal it has the desired effect. I'm at a loss at this point as to why it doesn't work. Is there a way for me to check and see if anything is happening at all, even though my volume isn't actually changing? -Eitan
Re: [dev] wmii noob key binding help
Traditionally, this was solved by making wmiirc (1) emit "Start wmiirc" to /event at startup and later (2) exit if they see "Start wmiirc" inside their /event processing loop. In this manner, new instances of wmiirc terminate previously existing ones. I don't know why that mechanism was removed from the default SH wmiirc. It did exist in the past, however. It still exists. See ll. 2-4 and 211-212 in cmd/wmii.sh.sh in the source tree. However, spawning wmiirc from the Action menu does not work for me as well, although with different symptoms: No keybindings work thereafter. -- Thomas Dahms
Re: [dev] wmii noob key binding help
On Thu, Feb 24, 2011 at 12:14 PM, Benjamin R. Haskell wrote: > running the 'wmiirc' action just > spawned a second instance of wmiirc (resulting in event doubling, e.g. > keystroke that spawns a new terminal spawned two new terminals). Traditionally, this was solved by making wmiirc (1) emit "Start wmiirc" to /event at startup and later (2) exit if they see "Start wmiirc" inside their /event processing loop. In this manner, new instances of wmiirc terminate previously existing ones. I don't know why that mechanism was removed from the default SH wmiirc. It did exist in the past, however.
Re: [dev] wmii noob key binding help
On Thu, 24 Feb 2011, Suraj Kurapati wrote: On Thu, Feb 24, 2011 at 11:25 AM, Benjamin R. Haskell wrote: exec'ing wmii via the 'action' menu, which borks multi-monitor layouts; anyone have a better way? Have your wmiirc re-exec itself (as opposed to re-execing wmii). Hmm. Makes sense. Does the default wmiirc have something that makes that easy? I just noticed some entries in my actions menu that exist in my work config but not my home config. And I saw that wmii.sh adds scripts in $WMII_CONFPATH to the actions list. But running the 'wmiirc' action just spawned a second instance of wmiirc (resulting in event doubling, e.g. keystroke that spawns a new terminal spawned two new terminals). -- Best, Ben
Re: [dev] wmii noob key binding help
On Thu, Feb 24, 2011 at 11:25 AM, Benjamin R. Haskell wrote: > exec'ing wmii via the 'action' menu, which borks multi-monitor layouts; > anyone have a better way? Have your wmiirc re-exec itself (as opposed to re-execing wmii).
Re: [dev] wmii noob key binding help
On Wed, 23 Feb 2011, Eitan Goldshtrom wrote: I tried that just now and it didn't work. I also tried a few variations that each didn't work. I checked the "keys" file and it looks like the 2 key combinations aren't in the file. I thought they would be added because of the event declarations, but am I supposed to add them manually or something? If so, how do I do that? No, you shouldn't need to add them manually. You do need to reload your wmiirc, though. (AFAICT, there's no better way than just exec'ing wmii via the 'action' menu, which borks multi-monitor layouts; anyone have a better way?) When I try to wmiir write or xwrite to any of those 9P files it overwrites the whole thing; I just want to append them. As for this, I tried mounting the wmii namespace to /9/wmii, following the advice of http://wmii.suckless.org/9p, but the constant warnings from vim about "The file has been changed since reading it!!!" were too annoying. So now I use this zsh function to edit them: edit9 () { emulate -L zsh setopt err_return local path9=$1 temp="$(mktemp -t edit9.)" (( $#path9 && $#temp )) || return 1 { wmiir cat $path9 > $temp $EDITOR $temp wmiir write $path9 < $temp } always { rm $temp } } Usage: edit9 path-you-would-give-wmiir e.g. edit9 /keys -- Best, Ben
Re: [dev] wmii noob key binding help
I tried that just now and it didn't work. I also tried a few variations that each didn't work. I checked the "keys" file and it looks like the 2 key combinations aren't in the file. I thought they would be added because of the event declarations, but am I supposed to add them manually or something? If so, how do I do that? When I try to wmiir write or xwrite to any of those 9P files it overwrites the whole thing; I just want to append them. -Eitan On 02/23/2011 12:15 AM, Benjamin R. Haskell wrote: On Tue, 22 Feb 2011, Eitan Goldshtrom wrote: Hi. So I read through as much as I could find on the subject of defining my own keybindings. I can see how to do it from the 9P virtual filesystem that wmii has setup, but I am under the impression that it can be done moreproperly?...via wmiirc_local and the local_events() function. Unfortunately, whatever I try to put in there causes wmii to not watch for any input whatsoever, and I get locked out from doing anything. Could someone show me an example of how to, say, change volume with amixer? I have the cli commands: amixer sset PCM 4+ amixer sset PCM 4- and I would like to bind those commands to Mod-Control-bracketright and Mod-Control-bracketleft respectively, or at this point any key combination really. Could someone show me how to bind those, for example? E.g.: Before: local_events() { true;} After: local_events() { cat <<'!' Key XF86AudioRaiseVolume# raise the volume amixer sset PCM 4+ & Key XF86AudioLowerVolume# lower the volume amixer sset PCM 4- & ! } Since volume control programs should be of the "return-almost-immediately" variety, I didn't bother with the `eval wmiir setsid [cmd] &` that most of the default commands seem to use. (What's the point of the `eval` there?). Makes sense to use the setsid portion in this example: local_events() { cat <<'!' Key $ALTKEY-slash# open SSH on a host I frequently use eval wmiir setsid $WMII_TERM -e ssh remote.example.com & ! }
Re: [dev] wmii noob key binding help
On Tue, 22 Feb 2011, Eitan Goldshtrom wrote: Hi. So I read through as much as I could find on the subject of defining my own keybindings. I can see how to do it from the 9P virtual filesystem that wmii has setup, but I am under the impression that it can be done moreproperly?...via wmiirc_local and the local_events() function. Unfortunately, whatever I try to put in there causes wmii to not watch for any input whatsoever, and I get locked out from doing anything. Could someone show me an example of how to, say, change volume with amixer? I have the cli commands: amixer sset PCM 4+ amixer sset PCM 4- and I would like to bind those commands to Mod-Control-bracketright and Mod-Control-bracketleft respectively, or at this point any key combination really. Could someone show me how to bind those, for example? E.g.: Before: local_events() { true;} After: local_events() { cat <<'!' Key XF86AudioRaiseVolume# raise the volume amixer sset PCM 4+ & Key XF86AudioLowerVolume# lower the volume amixer sset PCM 4- & ! } Since volume control programs should be of the "return-almost-immediately" variety, I didn't bother with the `eval wmiir setsid [cmd] &` that most of the default commands seem to use. (What's the point of the `eval` there?). Makes sense to use the setsid portion in this example: local_events() { cat <<'!' Key $ALTKEY-slash# open SSH on a host I frequently use eval wmiir setsid $WMII_TERM -e ssh remote.example.com & ! } -- Best, Ben