Subject: FVWM: Building a decent Panel?

From: "Felix E. Klee" <[email-masked]>
Date: Sun, 13 Apr 2003 11:52:32 +0200

Hi,

I would like to set up a panel that is similar to Gnome's panel or KDE's 
kicker. Some neccessary features that I absolutely need are:
1. A button that shows the applications menu
2. A list of the windows on the current desktop
3. The pager
4. A Clock
5. Autohide

I know that there is FvwmTaskbar and FvwmButtons. But FvwmTaskbar doesn't 
support the pager and FvwmButtons doesn't support autohide.

Any ideas how to forge such a thing?

BTW, I'm willing to upgrade to the latest unstable FVWM version if that's 
neccessary.

Felix

-- 
To contact me personally don't reply but send email to 
  felix DOT klee AT inka DOT 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 [email-masked].
To report problems, send mail to [email-masked].

---

From: Mikhael Goikhman <[email-masked]>
Date: Mon, 14 Apr 2003 13:20:53 +0000

> BTW, I'm willing to upgrade to the latest unstable FVWM version if that's 

You should use FvwmButtons.

You may implement auto-hide of any window, here is how I just did it for
a fun with my persistent pager (for 2.5.x only):

  DestroyModuleConfig FvwmEvent-AutoHide: *
  *FvwmEvent-AutoHide: PassId
  *FvwmEvent-AutoHide: enter_window AutoUnHide
  *FvwmEvent-AutoHide: leave_window AutoHide

  DestroyFunc AutoUnHide
  AddToFunc   AutoUnHide
  + I WindowId $0 (FvwmPager-Desker,    Shaded) WindowShade false
  + I WindowId $0 (FvwmButtons-MyPanel, Shaded) WindowShade false

  DestroyFunc AutoHide
  AddToFunc   AutoHide
  + I WindowId $0 (FvwmPager-Desker,    !HasPointer) WindowShade true
  + I WindowId $0 (FvwmButtons-MyPanel, !HasPointer) WindowShade true

  AddToFunc StartFunction
  + I FvwmEvent FvwmEvent-AutoHide

You may implement a timeout for autohiding too, there were some examples
in the archive using the similar technology and Schedule command.

If you have your panel on the screen bottom (or on the left) use this:

  Style FvwmButtons-MyPanel NoTitle, TitleAtBottom  # or TitleAtLeft

so it shades a window to the corresponding direction, not just to the up.

Regards,
Mikhael.

---

From: Uwe Pross <[email-masked]>
Date: Mon, 14 Apr 2003 15:34:07 +0200

Hi there,

On 14 Apr 2003 at 13:20:53 +0000, Mikhael Goikhman wrote:

> ...

You may also use the "EdgeCommand" in version 2.5.x to execute a
function or command if the mouse hits the edge of the screen:

EdgeThickness 1
EdgeCommand
EdgeCommand Right  Next ("FvwmButtons") Focus
EdgeCommand Bottom Next ("FvwmTaskBar") Focus

DestroyFunc AutoLowerFunction
AddToFunc AutoLowerFunction
+ I Current (!FvwmButtons) All (FvwmButtons) Lower
+ I Current (!FvwmTaskBar) All (FvwmTaskBar) Lower

DestroyFunc AutoRaiseFunction
AddToFunc AutoRaiseFunction
+ I Current (FvwmButtons) Raise
+ I Current (FvwmTaskBar) Raise

Style FvwmButtons ClickToFocus
Style FvwmTaskBar ClickToFocus

Module FvwmAuto 100 "Silent AutoRaiseFunction" "Silent AutoLowerFunction"

This has the advantage that the TaskBar nor the Buttons don't need to
be visible.

Regards, Uwe
-- 
  ,_,  Uwe Pross
 (O,O) mailto:[email-masked]
 (   ) http://www.tu-chemnitz.de/~uwp
=-"-"-================================
--
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 [email-masked].
To report problems, send mail to [email-masked].

---

From: Mikhael Goikhman <[email-masked]>
Date: Mon, 14 Apr 2003 14:56:22 +0000

> This has the advantage that the TaskBar nor the Buttons don't need to

The disadvantage that makes this setup useless is that a user normally
wants that all special modules, like FvwmButtons, FvwmTaskBar, FvwmPager
are not focusable. I.e. these modules should normally be NeverFocus,
not ClickToFocus.

A much better solution for me would be to hide a window on EdgeCommand
and unhide it on any focus:

  EdgeThickness 1
  EdgeCommand
  EdgeCommand Right Next (FvwmButtons-MyPanel, CirculateHit) UnhideWindow
  EdgeCommand Bottom Next (FvwmTaskBar, CirculateHit) UnhideWindow

  DestroyFunc HideWindow
  AddToFunc   HideWindow
  + I WindowShade true   # or: Lower

  DestroyFunc UnhideWindow
  AddToFunc   UnhideWindow
  + I WindowShade false  # or: Raise

  Style FvwmButtons NeverFocus, NoTitle, TitleAtRight
  Style FvwmTaskBar NeverFocus, NoTitle, TitleAtBottom

  DestroyFunc HideAll
  AddToFunc   HideAll
  + I Next (FvwmButtons-MyPanel, CirculateHit) HideWindow
  + I Next (FvwmTaskBar, CirculateHit) HideWindow

  Module FvwmAuto 100 HideAll

The previous FvwmEvent solution is good too regarding NeverFocus.

Regards,
Mikhael.

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 14 Apr 2003 17:16:23 +0200

> On 14 Apr 2003 15:34:07 +0200, Uwe Pross wrote:
[snip]
> > function or command if the mouse hits the edge of the screen:
[snip]
> are not focusable. I.e. these modules should normally be NeverFocus,
[snip]

Below is the new and official, race condition free, resource
friendly, configurable and extensible way for autohiding.  I will
polish it a bit and put it in the FAQ.  This works with the latest
CVS code only:

  AddToFunc autohide_handler
  + I hide_or_show $0 FvwmButtons 500 W
  #                   ^           ^   ^
  #                   |           |   |___  Shade direction (optional)
  #                   |           |_______  Hide delay
  #                   |___________________  Unique window name/resource

  AddToFunc hide_or_show
  + I WindowId $0 ($1) Deschedule $0
  + I WindowId $0 ($1) ThisWindow (shaded) WindowShade $i3 off
  + I CondCase (!Match) All (!shaded, $1) Schedule $2 $$$$$$$$w WindowShade $3 on

  AddToFunc StartFunction
  + I Module FvwmAuto FvwmAutohide -passid -menter autohide_handler

Bye

Dominik ^_^  ^_^

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 14 Apr 2003 17:41:41 +0200

On Mon, Apr 14, 2003 at 05:16:23PM +0200, fvwm wrote:
> friendly, configurable and extensible

... and buggy ...  Should not have modified the config before
posting.  I'll post an update later.

> way for autohiding.  I will

Bye

Dominik ^_^  ^_^

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 14 Apr 2003 17:50:11 +0200

> > polish it a bit and put it in the FAQ.  This works with the latest

Fixed version:

  AddToFunc enter_handler
  + I autohide $0 FvwmButtons 500 SW
  #               ^           ^   ^
  #               |           |   |___  Shade direction (optional)
  #               |           |_______  Hide delay
  #               |___________________  Unique window name/resource

  AddToFunc autohide
  + I WindowId $0 ($1) Deschedule $0
  + I WindowId $0 ($1) ThisWindow (shaded) WindowShade off
  + I CondCase (!Match) All (!shaded, $1) autohide_hide $$$$$$$w $2 $3

  AddToFunc autohide_hide
  + I Deschedule $0
  + I Schedule $1 $0 WindowShade $2

  AddToFunc StartFunction
  + I Module FvwmAuto FvwmAutohide -passid -menter enter_handler

Bye

Dominik ^_^  ^_^

---

From: Mikhael Goikhman <[email-masked]>
Date: Mon, 14 Apr 2003 19:44:20 +0000

>   + I Module FvwmAuto FvwmAutohide -passid -menter enter_handler

This is nice. Just a note, this requires the latest cvs to run.
I am not quite sure why the number of dollars is 7 instead of 8 here.

Anyway, here is a more short and understandable version of the whole
thing (all functions have one parameter less and only one dollar):

  AddToFunc enter_handler
  + I autohide FvwmTaskBar 500 SW
  #            ^           ^   ^
  #            |           |   |___  Shade direction (optional)
  #            |           |_______  Hide delay
  #            |___________________  Unique window name/resource

  AddToFunc autohide
  + I ThisWindow ($0) Deschedule $[w.id]
  + I ThisWindow ($0, shaded) WindowShade off
  + I Cond (!Match) All ($0, !shaded) autohide_hide $1 $2

  AddToFunc autohide_hide
  + I Deschedule $[w.id]
  + I Schedule $0 $[w.id] WindowShade $1

  AddToFunc StartFunction
  + I Module FvwmAuto FvwmAutohide -menter enter_handler

Regards,
Mikhael.

---

From: Uwe Pross <[email-masked]>
Date: Tue, 15 Apr 2003 09:04:37 +0200

Hi there,

>   + I Module FvwmAuto FvwmAutohide -menter enter_handler

What does "FvwmAutohide" do? The latest cvs version of the FvwmAuto
man page says only:

Module FvwmAuto Timeout [-passid] [-menter|-menterleave|-mfocus] [EnterCommand [LeaveCommand]]

BTW: Your solution requires that the autohide window is visible, 
     doesn't it?

Regards, Uwe

---

From: Mikhael Goikhman <[email-masked]>
Date: Tue, 15 Apr 2003 08:31:45 +0000

> Module FvwmAuto Timeout [-passid] [-menter|-menterleave|-mfocus] [EnterCommand [LeaveCommand]]

You are right, it is a tricky thing currently. Here is what happens.
This parameter is thought as a timeout by FvwmAuto, and since it is not a
number a timeout of 0 is assumed (we do our own timeout using Schedule).
But this "timeout that is not a number" string is not ignored by fvwm,
it uses heuristics and takes it as a module alias.

So you may to have several FvwmAuto running and kill them independently:

  Module FvwmAuto FvwmAuto-Beep -mfocus Beep
  Module FvwmAuto FvwmAuto-Raise -mfocus Raise

  # then after you find the first annoying, kill it only
  KillModule FvwmAuto FvwmAuto-Beep

So currently you may have either a non-zero timeout or an alias, or
FvwmAuto may be enhanced to support both. In the future there will be the
global non-tricky solution for module aliases in the core.

> BTW: Your solution requires that the autohide window is visible, 

Yes, the Dominik's solution requires that a small frame square of 10x10
(with NoTitle, BorderWidth 5) is visible. Try: "WindowShade NW" on any
window. You may setup this 10x10 pixel frame to be always OnTop.

Regards,
Mikhael.

---

From: Dominik Vogt <[email-masked]>
Date: Tue, 15 Apr 2003 10:41:43 +0200

> I am not quite sure why the number of dollars is 7 instead of 8 here.

Trial and error.  I added dollars until it worked.  Eight works
fine too.

> thing (all functions have one parameter less and only one dollar):

Ah!  I wasn't aware that a window id could be used in conditions.
But you are probably wrong about the number of '$'s because
$[w.id] *is* defined initially, but contains the wrong window.
I'll test that later.  There is still a bug with hiding:  as long
as enter events keep coming in fast enough, hiding will not
trigger.  The Deschedule command in autohide_hide must be
scheduled after the WindowShade command instead of being executed
right away.

Bye

Dominik ^_^  ^_^

---

From: Dominik Vogt <[email-masked]>
Date: Tue, 15 Apr 2003 10:47:10 +0200

> Module FvwmAuto Timeout [-passid] [-menter|-menterleave|-mfocus] [EnterCommand [LeaveCommand]]

That's the module alias syntax.  It starts an FvwmAuto module with
the name FvwmAutohide.

> BTW: Your solution requires that the autohide window is visible, 

Sure.  You can make the window StaysOnTop, so you have no problem
accessing it.  And if you don't like that part of it is always
visible, hide it to a corner of the screen.  Its almost impossible
to notice it there.

Bye

Dominik ^_^  ^_^

---

From: Mikhael Goikhman <[email-masked]>
Date: Tue, 15 Apr 2003 08:56:16 +0000

> $[w.id] *is* defined initially, but contains the wrong window.

At the time the functions are defined using AddToFunc, $[w.id] is not
defined. Of course, if you can't guarantee this, it may be escaped
as $$[w.id], but this is not really needed.

Other than this, since we only use $[w.id] inside ThisWindow condition,
whenever $[w.id] is defined, it is what we want to use as [De]Schedule
parameter. So it works well. With other conditions, like All we would
need many dollars.

Regards,
Mikhael.

---

From: Dominik Vogt <[email-masked]>
Date: Tue, 15 Apr 2003 17:14:34 +0200

> parameter. So it works well. With other conditions, like All we would

Right, but you removed one WindowId command too many.

  Thiswindow ($0) Thiswindow (shaded)

is *not* equvalent to

  ThisWindow ($0, shaded)

It has a different return code which is needed later.  New version
that takes care of the bug I described.  With any code earlier
than current CVS it immediately crashes because calling Deschedule
from a Schedule command does not work.  With my latest patch it is
more stable but may still crash if the timing is wrong.
Basically, fiddling with the scheduler's queue while traversing
through it can cause core dumps.  I need to revise the code so
that it delays destroying queue items.

  AddToFunc enter_handler
  + I autohide FvwmButtons 500 S
  #            ^           ^   ^
  #            |           |   |___  Shade direction (optional)
  #            |           |_______  Hide delay
  #            |___________________  Unique window name/resource

  AddToFunc autohide
  + I ThisWindow ($0) Deschedule $[w.id]
  + I ThisWindow ($0) ThisWindow (shaded) WindowShade off
  + I Cond (!Match) All ($0, !shaded) autohide_hide $1 $2

  AddToFunc autohide_hide
  + I Schedule $0 $[w.id] WindowShade $1
  + I Schedule $0 $[w.id] Deschedule $[w.id]

  AddToFunc StartFunction

Bye

Dominik ^_^  ^_^

---

From: "Felix E. Klee" <[email-masked]>
Date: Tue, 15 Apr 2003 19:56:51 +0200

> more stable but may still crash if the timing is wrong.

FVWM will crash? Then as an end user which of the many proposed solutions 
should I take in order to get autohiding to work reliably? I'm willing to 
upgrade to the CVS version if that's reasonably stable.

Felix

---

From: Mikhael Goikhman <[email-masked]>
Date: Tue, 15 Apr 2003 18:53:11 +0000

> upgrade to the CVS version if that's reasonably stable.

You may use a solution that does not use Schedule command.

I didn't notice any crash when tried a solution with Schedule.
It probably depends on your CPU and other factors.

The today's cvs fixed some bugs found with Schedule.

It is your choice now.

Regards,
Mikhael.