Subject: While we are discussing new features...!

From: Larry Gensch <[email-masked]>
Date: Tue, 7 Aug 2001 08:24:15 -0400 (EDT)

I've had a desire for some time for an improved syntax for matching
windows using the Style, Next, Current, etc. commands.

Right now, I can say:

	Next ("xterm") Focus

I can even use wildcards:

	Next ("*term*") Focus

This is all well and good when your terminal windows all have "term"
somewhere in their name/iconname/class/resource.

However, I have a few applications that give terminal windows:

	Powershell
	Konsole
	xterm
	gnome-terminal

There isn't one wildcard expression that will capture all of those.

Add to this the ability of some applications to change their window
title due to state (xterm has an escape sequence that most terminal
windows accept, Netscape is another application that comes to mind
that does this), and it gets difficult to map a "hot key" that will
traverse through a related set of windows.

Do you think it might be a good time now to add some functionality to
the window matching feature to allow for alternates and/or more
specific matching?

My thought is that we could create "conditions" in a way similar to
that of Functions, Menus, Decors, etc:

	DestroyCondition	"ConditionName"
	AddToCondition		"ConditionName"
	+	ConditionTerm	ConditionPhrase
	+	ConditionTerm	ConditionPhrase

Each condition line is parsed one at a time.  At first, the condition
will select no windows, and each successive line will narrow or widen
the windows selected.

ConditionTerm may be:

    All			Select all windows

    Widen Term		Add to the selected windows those that match
			the Term (boolean OR)

    Narrow Term		Restrict the currently selected windows to
			those that match the ConditionPhrase (boolean
			AND)

Term may be one of the following:

    WindowName="xxx"	Wildcard match on window name
    IconName="xxx"	Wildcard match on icon name
    Resource="xxx"	Wildcard match on resource name
    Class="xxx"		Wildcard match on window class
    Match="xxx"		Wildcard match on title, icon, resource, or class

    CirculateHit	Override CirculateSkip Style attribute
    CirculateHitIcon	Override CirculateSkipIcon Style attribute
    CirculateHitShaded	Override CirculateSkipshaded Style attribute
    CurrentDesk		All windows on current desktop
    CurrentPage		All windows on current page and desktop
    CurrentPageAnyDesk	All windows on current page on any desktop
    Iconic		All windows that are iconified
    Layer[=n]		All windows on layer "n" (defaults to layer of 
    			currently focused window)
    Maximized		All maximized windows
    PlacedByButton3	True if last interative move ended with button 3
    Raised		All windows that are raised
    Shaded		All shaded windows
    Sticky		All sticky windows
    Transient		All transient windows
    Visible		All windows that are visible

Any Term can be negated by prefixing with "!":

    + Narrow	!WindowName="*Netscape*"

This would narrow the selection to windows that do NOT have "Netscape"
within their window names.

The Syntax to use these conditions could be something like:

    DestroyCondition "Terminal"
    AddToCondition	"Terminal"
    +		Widen	Resource="XTerm"		# xterm
    +		Widen	Resource="Powershell"		# powershell
    +		Widen	Resource="Konsole"		# konsole
    +		Widen	Resource="Terminal"		# gnome-terminal

    DestroyFunc	"CycleTerminals"
    AddToFunc	"CycleTerminals" \
      "I"	Next (Condition=Terminal)	Focus
    + "I"	None (Condition=Terminal)	Exec powershell

This example would cycle through all my terminal windows or, if no
terminal window was found, would spawn a new powershell.

    DestroyFunc	"IconifyTerminals"
    AddToFunc	"IconifyTerminals" \
      "I"	All (Condition=Terminal)	Iconify 1

This example also seems to be able to produce the If/Then/Else logic
that has been discussed on this list (although there may be hidden
caveats here!).

Not only is this useful for cycling through windows, but it can be
used to group Style attributes to a common set of windows:

    Style Condition=Terminal	some-special-styles-for-term-windows

I've been sitting on this idea for a while (ever since 2.3 was
originally announced to be in "feature freeze" quite a while ago), and
figured that this might be a good time to make this suggestion.

-- 
Larry Gensch                                          [email-masked]

            Working for COMPAQ for over a twentieth of a century

--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]