Subject: FVWM: Focus problem / Mail hotkey

From: Ives Aerts <[email-masked]>
Date: Fri, 6 Nov 1998 10:02:23 +0100

I'm trying to set a `hotkey' for checking my mail (a shell window
called 'Mutt'). I would like it to pop up my mail window and focus it.
Afterwards, it should iconify the mail window again and return focus
to whatever window I was working in before.

The closest I could get is this:

  AddToFunc PopWindow     "I"     Iconify
  +                       "I"     Focus

  AddToFunc PushWindow    "I"     Iconify
  +                       "I"     FlipFocus

  key n   A       MC      Current [Mutt !Iconic] PushWindow
  Key m   A       MC      Next [Mutt Iconic] PopWindow

But this solution suffers from the following problems:
- The FlipFocus in the PushWindow function doesn't always work.
  Depending on the position of my mouse pointer, focus is either
  correctly set to the window I was working in *or* to the iconified
  mail window.
- Would it be possible to write a smarter function which combines the
  functionality of these two functions? That way I could have on
  hotkey which toggles between the current window and the mail window.

BTW: I am using `SloppyFocus' on all my windows.

Thanks in advance for your help,
-Ives
______________________________________________________________________
Ives Aerts (R&D Software engineer)           Sony DNSE-Brussels
[email-masked]                       St.Stevens Woluwestr. 55
`IBM definition SY-34378:                    B-1130 Brussels, Belgium
 A signature consists of sequences of        PHONE : +32 2 724 86 11
 non-blank characters separated by blanks'   FAX   : +32 2 724 86 88
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Tim Phipps <[email-masked]>
Date: Thu, 12 Nov 1998 15:09:48 +0000

FlipFocus is meant to be used only in conjunction with Prev.  e.g.
+ "I" Prev [CurrentDesk !Iconic] FlipFocus
For what you are doing you may as well use Focus here.  FlipFocus is a
way of changing the order of the windowlist so that Prev [] FlipFocus,
Prev [] FlipFocus toggles back and forth between two windows.

>   hotkey which toggles between the current window and the mail window.

This is where None comes into its own:

# function to toggle iconic state of Mutt window
AddToFunc ToggleMail "I" Next [Mutt !Iconic] HideMutt
+                    "I" None [Mutt !Iconic] ShowMutt
# function to iconify Mutt
AddToFunc HideMutt   "I" Iconify
+                    "I" Prev [CurrentDesk !Iconic] Focus
# function to de-iconify or start Mutt
AddToFunc ShowMutt   "I" Next [Mutt] Iconify
+                    "I" None [Mutt] Exec mutt
+                    "I" None [Mutt] Wait Mutt
+                    "I" Next [Mutt] Focus

Hope this helps,
Tim.

---

From: Ives Aerts <[email-masked]>
Date: Thu, 12 Nov 1998 17:39:37 +0100

> Prev [] FlipFocus toggles back and forth between two windows.

Thanks. I'm not sure I understand it, but it does work better (the
focussing is correct now). Is there a good explanation somewhere about
the windowlist and how the focussing of windows is influenced by the
various commands?

> +                    "I" None [Mutt !Iconic] ShowMutt

This still doesn't work. It does pop up the window (or indeed start it
if it's not there yet) but instead of hiding it, it will hide it and
then pop it up again. Seems like the first line changes the windowlist
so that the second one is always executed.
So I'm still stuck with two keys:

  AddToFunc StartMutt     "I" Exec rxvt -geometry 80x55+450+50 -font Screen16 -title Mutt -n Mutt -e mutt

  AddToFunc ShowMutt      "I" Next [Mutt] Iconify -1
  +                       "I" None [Mutt] StartMutt
  +                       "I" None [Mutt] Wait Mutt
  +                       "I" Next [Mutt] Focus

  AddToFunc HideWindow    "I" Iconify 1
  +                       "I" Prev [CurrentDesk !Iconic] Focus

  AddToFunc HideMutt      "I" Current [Mutt !Iconic] HideWindow

  key m   A       MC      ShowMutt
  key n   A       MC      HideMutt

Thanks!,
-Ives
______________________________________________________________________
Ives Aerts (R&D Software engineer)           Sony DNSE-Brussels
[email-masked]                       St.Stevens Woluwestr. 55
`You can't expect to wield supreme executive B-1130 Brussels, Belgium
 power just 'cause some watery tart threw a  PHONE : +32 2 724 86 11
 sword at you!'  (M.Python - The Holy Grail) FAX   : +32 2 724 86 88
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Tim Phipps <[email-masked]>
Date: Thu, 12 Nov 1998 17:50:29 +0000

Ives Aerts wrote:
> Is there a good explanation somewhere about
'fraid not.  There is the source.

My understanding is that there is a list that fvwm builds.  When windows
are created they are added to the end of the list.  Fvwm also maintains
a pointer to the window which has the focus called the current window.
The Next command starts at the current window and works its way down the
list until it finds a window which matches it's list of conditions.  It
then sets another pointer (Scr->tmp) to this window and calls the
function in it's argument.  Prev is the same but it works back up the
list.  Both commands wrap around the top and bottom and stop if they get
back to the current window.  The None command starts at the current
window and stops if it finds a match for its conditions, it only
executes its function if it gets back to the current window.

The fact that Next/Prev start at the current window but set Scr->tmp
explains why you can't do Next, Next, Next to go three windows around
the windowlist since each Next starts at the same point.

If you change the focus with the mouse the newly focussed window is
moved to the  end of the list and the current window pointer is
updated.  The Focus command just moves the current window pointer.  Prev
Focus and Next Focus do not alter the windowlist order but moving focus
with the mouse does.  FlipFocus moves the focus in the same way as
changing the Focus with the mouse i.e. it puts the target window to the
end of the windowlist and updates the current window.

> So I'm still stuck with two keys:

Umm, looks like HideMutt is changing the Iconic state of Mutt before the
None conditions are evaluated.  Try the following:

AddToFunc ToggleMutt "I" Next [Mutt] Iconify
+                    "I" None [Mutt !Iconic] Prev [CurrentDesk !Iconic]
Focus
+                    "I" None [Mutt] exec mutt
+                    "I" None [Mutt] Wait Mutt
+                    "I" Next [Mutt !Iconic] Focus

Cheers,
Tim.

---

From: Sam Krishnabhat <[email-masked]>
Date: Thu, 12 Nov 1998 13:05:11 -0800 (PST)

Tim Phipps sez...
> + "I" Prev [CurrentDesk !Iconic] FlipFocus

Is this related to the following command in 'AddToFunc "InitFunction" "I"'
function or works in conjuction with that. Can anybody explain ?

+       "I" Next [!iconic CurrentScreen xterm] Focus

-sam

---

From: Ives Aerts <[email-masked]>
Date: Fri, 13 Nov 1998 09:47:22 +0100

On Thu, Nov 12, 1998 at 05:50:29PM +0000, Tim Phipps wrote:
> [lengthy explanation about windowlist omitted]

Great, at least I know what I'm doing now :^).

I think it would be a good idea to put this in the man page as it
seems to be rather essential for understanding Next/Prev/Current/etc.

> None conditions are evaluated.  Try the following:

That does it indeed. I'm a happy puppy now, thanks a lot!

Cheers,
-Ives
______________________________________________________________________
Ives Aerts (R&D Software engineer)           Sony DNSE-Brussels
[email-masked]                       St.Stevens Woluwestr. 55
`Perfection is achieved not when there is    B-1130 Brussels, Belgium
 nothing more to add, but when there is      PHONE : +32 2 724 86 11
 nothing more to remove.'(A. de St.-Exupery) FAX   : +32 2 724 86 88
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].