Subject: FVWM: Selective auto-shade

From: "Moore, Garron" <[email-masked]>
Date: Tue, 5 Aug 2003 09:04:34 -0700

I'm trying to set up the following:

When you click a button in the title bar, the window goes into
auto-shade mode. This is like auto-raise, but shade instead. I'm having
trouble figuring out how to set it up. I'm sure it's the same procedure
as setting up auto-raise in the same manner because I'm using FvwmAuto.

Thanks,
Garron
--
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: parv <[email-masked]>
Date: Tue, 5 Aug 2003 13:44:10 -0400

in message <[email-masked]>,
wrote Moore, Garron thusly...
> auto-shade mode. This is like auto-raise, but shade instead. I'm
> having trouble figuring out how to set it up.

So, you want a window to be shaded when you click on a button?

  #  make the window shaded when title bar button 4 is clicked
  Mouse 0  4  N  WindowShade toggle

  #  window is shaded when title bar is clicked by mouse button 3
  Mouse 3   T  N  WindowShade toggle

...Mind you the raise/focus issue is conveniently ignored.

> I'm sure it's the same procedure as setting up auto-raise in the
> same manner because I'm using FvwmAuto.

I don't get it.  You want to use -Auto module /along with/ mouse
click?

  - Parv

-- 
A programmer, budding Unix system administrator, and amateur photographer
seeks employment:  http://www103.pair.com/parv/work/

---

From: Uwe Pross <[email-masked]>
Date: Tue, 5 Aug 2003 20:51:02 +0200

Hi Moore,,

> as setting up auto-raise in the same manner because I'm using FvwmAuto.

I hope I got you right. The following code (using it with
2.5.7) make the third button from the left side turn on/off
auto shade when the window gets focus. If the window leaves
focus it is shaded automatically. if the window gets focus
it is unshaded automatically. You can turn off this
behaviour using the button:

ButtonStyle 6 Vector 5 40x40@2 40x60@2 60x60@2 60x40@2 40x40@2 -- Flat UseTitleStyle
Style * Button 6 
Mouse 1 6 A State 1 toggle

DestroyFunc AutoShadeOn 
AddToFunc AutoShadeOn I WindowId $0 (State 1) WindowShade on

DestroyFunc AutoShadeOff
AddToFunc AutoShadeOff I WindowId $0 (State 1) WindowShade off

Module FvwmAuto 0 -passid "Silent AutoShadeOff" "Silent AutoShadeOn"

Cheers, Uwe

---

From: Phil Stracchino <[email-masked]>
Date: Tue, 5 Aug 2003 15:56:38 -0400

> Module FvwmAuto 0 -passid "Silent AutoShadeOff" "Silent AutoShadeOn"

Out of curiosity and for the sake of learning, I tried this code on
fvwm-2.4.16 and it didn't work.  I can get the new button to show up on
either side of the menubar, I can get the vector button to look suitable
for the function (my definition is actually Vector 5 20x20@2 20x30@2
80x30@0 80x20@0 20x20@2 -- Raised), the button depresses when I click
it, but then when I move focus on and off the window, nothing happens. 

I noticed that in fvwm-2.4.16, the argument to WindowShade is apparently
1 or 2, rather than on or off.  I made that change, with no effect.  It
still doesn't work.

The following is precisely what I have in .fvwm2rc:

ButtonStyle 3 Vector 5 20x20@2 20x30@2 80x30@0 80x20@0 20x20@2 -- Raised 
Style * Button 3
Mouse 1 3 A State 1 toggle
DestroyFunc AutoShadeOn
AddToFunc AutoShadeOn I WindowId $0 (State 1) WindowShade 1
DestroyFunc AutoShadeOff
AddToFunc AutoShadeOff I WindowId $0 (State 1) WindowShade 2
Module FvwmAuto 0 -passid "Silent AutoShadeOff" "Silent AutoShadeOn"

Now, I also looked in my .xsession-errors, hoping fvwm2 was logging
something, and behold!

[FVWM][execute_function]: <<ERROR>> No such command 'State'

So.  What does State do in fvwm-2.5.7, so that I can figure out how to
get the same functionality in fvwm-2.4.16?  Or is this functionality
simply not available in 2.4.16?

(Before you ask, I haven't updated to 2.5.7 because the FVWM homepage
seems to be saying that 2.4.16 is the stable version and 2.5.x is the
development tree.)

-- 
 .*********  Fight Back!  It may not be just YOUR life at risk.  *********.
 : phil stracchino : unix ronin : renaissance man : mystic zen biker geek :
 :  [email-masked] : [email-masked] : [email-masked]  :
 :   2000 CBR929RR, 1991 VFR750F3 (foully murdered), 1986 VF500F (sold)   :
 :    Linux Now!   ...Because friends don't let friends use Microsoft.    :
--
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: Uwe Pross <[email-masked]>
Date: Wed, 6 Aug 2003 08:30:27 +0200

Hi Phil,

> simply not available in 2.4.16?

The state command was introduced in version 2.5.1:
   http://www.fvwm.org/news/#2.5.1 
so the code cannot work in a 2.4.x version. 

The state command sets/unsets/toggles one of 31 user states
which may be used to remember certain things such as a
button press.

You may try the following at your box to see the effect:

DestroyFunc AutoShadeOn
AddToFunc AutoShadeOn I WindowId $0 WindowShade True
DestroyFunc AutoShadeOff
AddToFunc AutoShadeOff I WindowId $0 WindowShade False
Module FvwmAuto 0 -passid "Silent AutoShadeOff" "Silent AutoShadeOn"

which should work with 2.4.16. The problem is you cannot
turn the autoshade on/off for certain windows since you
don't have the state command/condition.

> (Before you ask, I haven't updated to 2.5.7 because the
> FVWM homepage seems to be saying that 2.4.16 is the stable
> version and 2.5.x is the development tree.)

According to my experience 2.5.7 is quite stable - I never
had a crash :-) - so you might check it out. The new
features are really worth it.

Cheers, Uwe

---

From: Mikhael Goikhman <[email-masked]>
Date: Wed, 6 Aug 2003 21:59:18 +0300

On 06 Aug 2003 08:30:27 +0200, Uwe Pross wrote:
> which should work with 2.4.16.

Actually, the passid options are never really needed in FvwmEvent and
FvwmAuto. Here is the same code, but shorter and clearer:

DestroyFunc AutoShadeOn
AddToFunc   AutoShadeOn I WindowShade True
DestroyFunc AutoShadeOff
AddToFunc   AutoShadeOff I WindowShade False
Module FvwmAuto 0 "Silent AutoShadeOff" "Silent AutoShadeOn"

If you need a condition, you may use ThisWindow instead of "WindowId $0".

Regards,
Mikhael.

---

From: Phil Stracchino <[email-masked]>
Date: Wed, 6 Aug 2003 16:29:35 -0400

> If you need a condition, you may use ThisWindow instead of "WindowId $0".

Hmm.  Interestingly, I received this followup, but not the post of Uwe's
(following up mine) that you were following up to.

I just tried this code, as given, both with and without ThisWindow and
WindowId $0, and it doesn't seem to have the desired result.

With WindowId $0, clicking the new button gives no effect and a logged
error:
[FVWM][execute_function]: <<ERROR>> No such command 'State'
Then each time focus changes from one window to another, the following
errors are logged:
[FVWM][execute_function]: <<ERROR>> No such command 'True'
[FVWM][execute_function]: <<ERROR>> No such command 'False'

With ThisWindow, or with neither ThisWindow nor WindowId $0, the "No
such command 'State'" error still occurs, clicking the new button still
does nothing, and all windows autoshade upon losing focus but never
unshade.

There does not seem to be a 'State' documented anywhere in fvwm-2.4.16.
I can trivially implement a manual per-window WindowShade button, and I
can make all windows automatically Shade, but I don't seem to be able to
make a window automatically unshade, or make a per-window autoshade.  Is
this a 2.4.16 limitation?

Experimenting with this has raised another question.  The following
ButtonStyle creates a raised button with a narrow raised bar across the
top of the button:

The following ButtonStyle *SHOULD*, unless I'm missing something, create
a button like the above with a capital A drawn in the shadow color below
the bar:

ButtonStyle 6 Vector 13 20x20@2 20x30@2 50x30@0 50x40@1 90x30@2 80x35@2 \
      80x65@2 90x70@2 50x40@2 50x30@1 80x30@0 80x20@0 20x20@2 -- Raised

However, when I load this configuration, this button actually looks the
same as the ButtonStyle 3 button.  Can anyone suggest why this would
happen?

(My intention is for Button 3 to be manual-shade and button 6 to be
 per-window autoshade, at present.  If I ever actually get this
 *working*, I'll probably actually swap the two buttons.)

---

From: Phil Stracchino <[email-masked]>
Date: Wed, 6 Aug 2003 16:56:16 -0400

> same as the ButtonStyle 3 button.  Can anyone suggest why this would

DOH!  Well, I just figured *this* out.  I used the wrong color for the 
A -- color 2 when I should have been using color 0.  (I also drew the A
on its side, and it look's kinda rough even then.)