On Thu, Aug 09, 2001 at 12:22:27PM -0700, Cyprian Laskowski wrote:
> Hi,
>
> Yesterday, it occurred to me: wait a minute: why have I not upgraded
> my fvwm (my system came with 2.2.4)? I was astounded, as I could not
> come up with a reasonable answer. Needless to say, I immediately
> upgraded to 2.4.0 and am very pleased with the changes. Thanks a lot!
> You guys rule!
>
> Playing around with it also brought up an old issue, which I still
> don't know how to solve:
>
> On startup (in InitFunction), I like to start up one xterm and one
> emacs, and have them treated specially for the duration of the
> session: I want the xterm to be sticky, and I want special keybindings
> that will immediately take me to both of these windows. But the
> following doesn't work, and my other similar variants don't either.
>
> AddToFunc InitFunction
> + 'I' Exec exec xmodmap $HOME/.xmodmaprc
> + 'I' Exec exec xbiff -geometry 50x50+1080+5
> + 'I' Exec exec xterm -font 7x13 -geometry 55x8+765+5 -T BANG
> + 'I' Wait xterm
> + 'I' Next FlipFocus
> + 'I' Stick
> + 'I' Key Return A 3 WindowId $w FlipFocus
> + 'I' Exec exec emacs -f eshell
> + 'I' Wait emacs
> + 'I' Next (emacs) FlipFocus
> + 'I' Key Return A 3C WindowId $w FlipFocus
> The problem begins with Stick, but I suspect that my Key commands
> aren't set up right either (although I know that Mod3 is set up right,
> as it works in other, more standard situations). Could you show me
> how to make this work?
When you run a command that needs a window to work on, the window
is usually chosen from the context the function was invoked from.
Usually, the context window is simply the window you clicked on,
but it can be something else or even unset under some
circumstances. This is why you need "Next FlipFocus" to focus the
window, not just "FlipFocus". It is important to know that the
context window does not change during function execution. Thus,
the "Stick" line refers to the original context window again, not
to the one just focused. "Next Stick" should work. The "Key"
lines do not work for the same reason. In addition, the "$w" is
replaced by a more or less random window, even if you use
"Next Key ..." since it is replaced at the time the "Next Key ..."
line is executed - and at that time the window was not yet
selected by the "Next".
I recommend doing this stuff in a separate function:
Style BANG Sticky
AddToFunc WaitAndFocusAndKeybind
+ I Wait $0
+ I Next ($0) FlipFocus
+ I Key $1 $2 $3 WindowId $w FlipFocus
AddToFunc InitFunction
+ I Exec exec xmodmap $HOME/.xmodmaprc
+ I Exec exec xbiff -geometry 50x50+1080+5
+ I Exec exec xterm -font 7x13 -geometry 55x8+765+5 -T BANG
+ I WaitAndFocusAndKeybind BANG Return A 3
+ I Exec exec emacs -f eshell
+ I WaitAndFocusAndKeybind emacs Return A 3
(untested)
You get the idea.
> BTW, the problem with Stick is also a problem I sometimes have with
> FvwmCommand. Say I try (I know this is a silly example):
>
> % FvwmCommand 'Stick'
>
> Fvwm seems to wait for me to select a window, but I want it to just
> use the current one. There are other commands with which I have the
> same problem. But I'm probably just using the wrong approach, right?
Try
% FvwmCommand "Next Stick"
or
% FvwmCommand "Current Stick"
instead. When commands are executed from a module, there may not
be a context window to operate on, so fvwm asks for user
interaction. To select a window automatically you have to use one
of the conditional commands. If you would like a module command
to fail quietly if there is no window to operate on you can use
the "Silent" command prefix:
% FvwmCommand "Silent Current (xterm) kill"
This would kill the current window if it is an xterm and do
nothing otherwise.
Bye
Dominik ^_^ ^_^
--
Dominik Vogt, dominik.vogt_at_gmx.de
Reply-To: dominik.vogt_at_gmx.de
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_fvwm.org.
To report problems, send mail to fvwm-owner_at_fvwm.org.
Received on Fri Aug 10 2001 - 01:03:32 BST