Re: FVWM: "Toggle buttons"

From: <dominik.vogt_at_gmx.de>
Date: Tue, 1 Apr 2003 01:24:05 +0200

On Mon, Mar 31, 2003 at 11:25:02PM +0200, David Vilar Torres wrote:
> 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

Try this:

 
> 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)?

  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
> style" and it would be nice to join them into only one button.

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, dominik.vogt_at_gmx.de
Reply-To: dominik.vogt_at_gmx.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 majordomo_at_fvwm.org.
To report problems, send mail to fvwm-owner_at_fvwm.org.
Received on Mon Mar 31 2003 - 17:30:19 BST

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