Subject: FVWM: "Toggle buttons"

From: David Vilar Torres <[email-masked]>
Date: Mon, 31 Mar 2003 23:25:02 +0200

Hi all!! (this is my first post to the list :-)

To switch between the title bar at the top or at the bottom of the 
current window I have the following lines in my config

Mouse 0 8 A Current Style $n TitleAtTop
Mouse 0 0 A Current Style $n TitleAtBottom

However the natural way would be to have a "toggleable" button (can you 
say that?) that switches between both options. Is this possible (under 
2.4 preferibly)? I also have a similar pair of buttons for a "highlight 
style" and it would be nice to join them into only one button.

Thak you

David

--
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, 31 Mar 2003 22:09:29 +0000

> style" and it would be nice to join them into only one button.

This hopefully will give you a solution:

   http://www.hpc.uh.edu/fvwm/archive/0209/msg00404.html

"toggleable" is an ok term, but it means toggle between 2 states.
What you want is probably to toggle between 3 states, so this is not the
best term.

If you have 2 titlebar buttons just like now, you may make them look
toggleable if you use:

  Style * MwmButtons
  ButtonStyle 8 - MwmDecorLayer 6
  ButtonStyle 0 - MwmDecorLayer 2

Regards,
Mikhael.

---

From: [email-masked]
Date: Tue, 1 Apr 2003 01:24:05 +0200

Try this:

> 2.4 preferibly)?

  Mouse 0 8 A Current Piperead "if [ $(( $[cw.y] - $[w.y] == $[cw.x] - $[w.x] )) = 1 ]; then echo Style $$n TitleAtTop; else echo Style $$n TitleAtBottom; fi"

But you need at least 2.5.1 for the $[cw...] variables.  This
script assumes that the window has the title at the bottom if the
client window is offset by the same amount from the top of the
frame as from the left.  I can't think of an easy way to do that
in 2.4.x.  Perhaps one could pass the window id and the frame id
to a shell script that uses xwininfo to determine the position of
the title bar.

> I also have a similar pair of buttons for a "highlight 

The state command in 2.5.1 can help you:

  AddToFunc toggle_hilight
  + I ThisWindow (!State 0) switch_hilight_on
  + I ThisWindow (State 0) switch_hilight_off
  + I ThisWindow State 0 toggle

  AddToFunc switch_hilight_on
  ...

  AddToFunc switch_hilight_off
  ...

Of course this works for the TitleAt... thing too.  If you really
want to keep 2.4.x, you can write the state of the window to an
environment variable and evaluate it with a shell script:
 
  AddToFunc toggle_title
  + I Style $n $0
  + I SetEnv bottomtitle_$w $1

  Mouse 0 8 A Current Piperead "if [ x$$bottomtitle_$w = x1 ]; then echo toggle_title TitleAtTop 0; else echo toggle_title TitleAtBottom 1; fi"

Bye

Dominik ^_^  ^_^

 --
Dominik Vogt, [email-masked]
Reply-To: [email-masked]
--
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].