On Wed, Sep 4, 2019 at 11:32 PM Stephen Dennison <stephe...@gmail.com> wrote:
> Well, as Thomas Adam points out, you can just use FvwmPager
> -transient. You can then use up/down/left/right to move towards a
> page, then hit any key to dismiss it. With just -transient it wont
> show other desks, so you'd have to pick the number of desks you want
> and provide that as a max. For example, I use five here (for six
> desks):
>
> Key Alt_L A C FvwmPager -transient 0 5
>
> ...
>
> But really, use Thomas's suggestion, as usual, it's terse and entirely
> on point.

Ok, it took me a while to get back to this. I've been trying different
configurations and simplifying, and have come up with a solution for
now. The transient option did not behave as I desired, as it required
me to hit a key or button to make the pager go away, at least as I had
it configured. There is still a bit of tweaking to do, but this works
and is close enough to the ideal behavior (from my perspective), that
I'll stick with it for a while.


First, my configuration is as follows (these are all the entries in my
`.fvwm/config` file that I thought were relevant):

#v+
# Set debug variable.
InfoStoreAdd DEBUG         true

# Virtual desktops
DesktopName 0 main
DesktopName 1 vm
DesktopName 2 code
DesktopName 3 other
DesktopSize 1x1

# Give hints to ewmh compliant pagers and taskbars.
EwmhNumberOfDesktops 4

# Set focus style to SloppyFocus, and a mouse click raises a window.
Style * SloppyFocus, MouseFocusClickRaises

# Minimize overlap with other windows measured by pixel area.
Style * MinOverlapPlacement

# Use the rubber-band outline style when resizing windows.
Style * ResizeOutline

# Allow windows/icons to snap to other windows/icons, respectively, if
# they come within 15 pixels of the other object. All can snap to the
# screen edge.
Style * SnapAttraction 15 SameType ScreenAll

# Style for the pop-up pager.
Style PopUpPager PositionPlacement screen 0 100-100w 0-1p
Style PopUpPager !Borders, CirculateSkip, FixedPosition, FixedSize, !Handles, \
                 StaysOnTop, Sticky, !Title, WindowListSkip

# Function: ShadeIt - START
#
# $0: Name of window
# $1: Shaded state (Shaded or !Shaded)
# $2: ToBeShaded (True or False)
# $3: Target layer
# $4: Post shade action (usually Raise or Lower)
#
# If a window named $0 exists and is in state $1, then apply shade
# state $2 to it, place it in layer $3, then take action $4 (usually
# Raise or Lower).
DestroyFunc ShadeIt
AddToFunc ShadeIt
# Log function entry and parameters.
+ I Test ($[infostore.DEBUG]) \
         Echo < ShadeIt (0: $0) (1: $1) (2: $2) (3: $3) (4: $4)

# If no window of this name exists then log it and break out.
+ I None ("$0", CirculateHit) Echo | ShadeIt - no such window
+ I TestRc (Match) Break

# If it does exist and is in state $1, then apply shade state $2, ...
+ I Next ("$0", CirculateHit, $1) WindowShade $2
+ I TestRc (Match) KeepRc Test ($[infostore.DEBUG]) \
    Echo | ShadeIt - '$0' shaded state to $2 based on $1

# ... place it in layer $3, ...
+ I TestRc (Match) Next ("$0", CirculateHit, !$1) Layer 0 $3
+ I TestRc (Match) KeepRc Test ($[infostore.DEBUG]) \
    Echo | ShadeIt - '$0' placed in layer $3

# ... and execute $4 on it.
+ I TestRc (Match) Next ("$0", CirculateHit, !$1) $4
+ I TestRc (Match) KeepRc Test ($[infostore.DEBUG]) \
    Echo | ShadeIt - $4 '$0'

# Function: ShadeIt - END

# Function: ToggleShade - START
#
# $0: Name of window
# $1: Command to execute
#
# Check for window named $0. If not found, execute $1. Once found,
# toggle shade state of $0 (shade if unshaded, unshade if shaded).
#
# Found: https://fvwmforums.org/wiki/Tips/TogglingWindows/
DestroyFunc ToggleShade
AddToFunc ToggleShade
+ I Test ($[infostore.DEBUG]) Echo < ToggleShade (0: $0) (1: $1)
+ I None ("$0", CirculateHit) $1
+ I TestRc (Match) KeepRc Test ($[infostore.DEBUG]) \
    Echo | ToggleShade - '$0' opened
+ I TestRc (Match) Wait "$0"

# Check to see if the target window is shaded and, if so, unshade.
+ I Next ("$0", CirculateHit, Shaded) \
         ShadeIt "$0" Shaded False 6 Raise
+ I TestRc (Match) Break

# Check to see if the target window is unshaded and, if so, shade.
+ I Next ("$0", CirculateHit, !Shaded) \
         ShadeIt "$0" !Shaded True 0 Lower

# Function: ToggleShade - END

# Function: ChangeToDesk - START
#
# $1: Name of the pager to show when changing.
# $0: Change the view by this number of desks.
#
# Change desks downward (if $1 = 1) or upward (if $1 = -1), unshade
# the window named $0, and schedule it to shade each time the desk is
# changed to get it out of the way.
DestroyFunc ChangeToDesk
AddToFunc   ChangeToDesk
+ I Test ($[infostore.DEBUG]) Echo < ChangeToDesk
# Step 1: Display $0 by unshading if window name provided.
+ I Test (!EnvMatch 0 "") \
    Next ("$0", CirculateHit, Shaded) ShadeIt "$0" Shaded False 6 Raise
# Step 2: Change desks.
+ I GotoDesk $1 0 3
+ I Test ($[infostore.DEBUG]) \
    Echo | ChangeToDesk - Go to the desk $[desk.n]: $[desk.name$[desk.n]]
# Step 3: Deschedule shading the PagerBar.
+ I Next ("$0", CirculateHit) Deschedule 0x43
+ I Test ($[infostore.DEBUG]) \
    Echo | ChangeToDesk - deschedule task to shade window '$0'
# Step 4: Schedule shading the PagerBar after 1 seconds.
+ I Next ("$0", CirculateHit) Schedule 1000 0x43 ShadeIt "$0" !Shaded True 0 
Lower
+ I Test ($[infostore.DEBUG]) \
    Echo | ChangeToDesk - schedule task to shade window '$0'

# Function: ChangeToDesk - END

# Bring up pager when pressing Ctrl-Alt (this takes into account
# pressing Ctrl before Alt, or Alt before Ctrl).
Key Alt_L A C ToggleShade "PopUpPager" "Module FvwmPager PopUpPager 0 3"
Key Control_L A M ToggleShade "PopUpPager" "Module FvwmPager PopUpPager 0 3"

# Ctrl-Alt-Up/Down goes one above/below current desk (respectively).
Key Up A CM ChangeToDesk "PopUpPager" -1
Key Down A CM ChangeToDesk "PopUpPager" 1

# Module: PopUpPager - START
#
# This module displays the locations of the windows on the various
# pages and desks.
DestroyModuleConfig PopUpPager: *
*PopUpPager: Title PopUpPager
*PopUpPager: Rows 4
*PopUpPager: Columns 1
*PopUpPager: DeskTopScale 6
*PopUpPager: MiniIcons
*PopUpPager: UseSkipList

# Module: PopUpPager - END
#v-

When using that configuration, the pager pops up as soon as I press
Ctrl-Alt (either Ctrl or Alt can be pressed first). I can then move
between desks with the up and down arrow keys, and one second after I
get to the new desk (regardless of the state of Ctrl and/or Alt) the
pager shades itself.

This is sufficient for now, although shaded was my second choice. I
tried to use hidden (as set by `wmctrl`), but could not find an
fvwm-native way to determine whether a window was hidden or now. The
"Iconfied" state was true on the hidden window, but any attempt at
"Next ('name of window', CirculateHit, Iconified) Echo foundit" would
fail for a window with the title of "name of window" that was hidden.
Shading was the next best thing, and works well as long as the single
pixel line shown after shading is moved just under the task bar.

Regardless, I seem to have found a solution to my question, albeit one
that does not actually answer to subject of this threat. Of course,
finding a solution that doesn't fix the problem mentioned in the
subject implies a problem with defining the original problem, but I'll
leave that for another post. :)

Anyway, thanks for all the good ideas, which allowed me to find this
solution.

Regards,
  -dave

Reply via email to