Re: FVWM: setting up special windows on startup automatically

From: Dominik Vogt <fvwm_at_fvwm.org>
Date: Mon, 13 Aug 2001 11:11:01 +0200

On Sat, Aug 11, 2001 at 04:59:23PM -0700, Cyprian Laskowski wrote:
> Dominik Vogt <dominik.vogt_at_gmx.de> writes:
>
> > On Thu, Aug 09, 2001 at 12:22:27PM -0700, Cyprian Laskowski wrote:
>
> >> 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.
>
> > 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)
> >
> Ok, the sticky business worked fine. But the Key commands did not
> work as expected. They seemed to do nothing (although they are bound,
> since the application doesn't see these keys). I tried replacing the
> FlipFocus above with Beep to see if it did anything, and it did in
> fact beep. So it appears that the FlipFocus isn't working as I
> expect. Now I'm thinking that the problem is that $w is being
> replaced when the command is executed and not when the command is run
> (which corresponds to what you're saying above in the "Next Key"
> discussion, right?).

Exactly.

> Which makes sense to me, but I did not consider
> it before. In that case, the FlipFocus would always just give focus
> to the window that already has the focus, which has no visible effect.
> Is this what happens?

I honestly do not know :)

> If so, is there any way for me to make this work still the way I want?

You have to quote the '$' to protect it from being evaluated too
early. There is a logic behind it, but even I can exactly tell
how many '$'s are necessary except by trying. One of these lines
should work:

  + I Key $1 $2 $3 WindowId $$w FlipFocus
  + I Key $1 $2 $3 WindowId $$$w FlipFocus
  + I Key $1 $2 $3 WindowId $$$$w FlipFocus
  + I Key $1 $2 $3 WindowId $$$$$w FlipFocus
  + I Key $1 $2 $3 WindowId $$$$$$w FlipFocus
  + I Key $1 $2 $3 WindowId $$$$$$$w FlipFocus
  + I Key $1 $2 $3 WindowId $$$$$$$$w FlipFocus

;-)

Bye

Dominik ^_^ ^_^

-- 
Dominik Vogt, email: d.vogt_at_lifebits.de
LifeBits Aktiengesellschaft, Albrechtstr. 9, D-72072 Tuebingen
fon: ++49 (0) 7071/7965-0, fax: ++49 (0) 7071/7965-20
--
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 Mon Aug 13 2001 - 04:11:14 BST

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:52 BST