Command to focus a Swallow app

Command focusing a window?
When an application is Swallow in FvwmButtons, the window focus is on the title bar and buttons, but the application is not included.

PCmanFM menu is Ctrl+m. To activate it, the app must be focused. How to Focus Pcmanfm. Currently, I am using a poor function attached to FvwmButtons.

DestroyFunc MenuFocus
AddToFunc MenuFocus
+ I SloppyFocus
+ I Schedule 900 Exec xdotool key ctrl+m
+ I Schedule 1000 ClickToFocus
*DeskDnd: Geometry 330x440+100+100
*DeskDnd: (1x1, Container (Columns 1))
*DeskDnd: (1x1, Title Menu, Action(Mouse 1) MenuFocus, Frame 1, Colorset 10)
*DeskDnd: (1x28, Swallow (UseOld) "pcmanfm" \
   'Exec exec $[DND_DIR]/DeskLauncher/script/pcmanfm $[HOME]/Desktop', Frame 0, Colorset 15)
*DeskDnd: (End)

Click Menu button and move mouse courser on Pcmanfm.

WindowId <id no> Focus does it but swallow pcmanfm doesn’t show an ID. Terminal commands xwininfo and xprop show same ID as Module FvwmIdent.
Terminal: echo $WINDOWID shows a different number 94371854. Didn’t point it out on DeskDnd. Try it. Or keep the “poor” function, does the job. :smiley:

Another option is not to swallow but still use the same Style (without a title bar, border width, etc.).

Exec exec $[DND_DIR]/DeskLauncher/script/pcmanfm $[HOME]/Desktop

Style Pcmanfm !Title, WindowListSkip, Sticky, !Handles, !Iconifiable, BorderWidth 0, StaysOnBottom
Style Pcmanfm PositionPlacement 100p 100p
Style Pcmanfm MinWindowSize 330p 440p, MaxWindowSize 440p 440p

For the thin menu bar (Ctrl+m) I will try to modify in my pcmanfm-miniDesk Github… fork of Pcmanfm.

In short you cannot focus a window that has been swallowed. Once a window has been reparented, fvwm no longer manages it. In this case FvwmButtons manages it.

Ok. Also, since I don’t know Gtk, the solution is to store the window of Pcmanfm $[w.id] + Focus. It works fine.

DestroyFunc MenuFocus
AddToFunc MenuFocus
+ I WindowId $[infostore.PcmanWin] Focus
+ I Exec xdotool key ctrl+m
## Menu Button
Module FvwmButtons MenuB
DestroyModuleConfig MenuB:*
*MenuB: Geometry 333x20+100+80
*MenuB: (1x1, Title Menu, Action(Mouse 1) MenuFocus, Frame 0, Colorset 10)

Style MenuB !Title, WindowListSkip, Sticky, !Handles, \
         !Iconifiable, BorderWidth 0, StaysOnBottom, NeverFocus
# MiniDesk Drag-and-Drop
Exec exec $[DND_DIR]/DeskLauncher/script/pcmanfm $[HOME]/Desktop
Schedule 300 Current InfoStoreAdd PcmanWin $[w.id]

Style Pcmanfm !Title, WindowListSkip, Sticky, !Handles, \
         !Iconifiable, BorderWidth 0, StaysOnBottom
Style Pcmanfm PositionPlacement 100p 100p
Style Pcmanfm MinWindowSize 330p 440p, MaxWindowSize 500p 440p

Menu Button and MiniDesk (Pcmanfm) are of two parts. To disable moving them…
Style foo FixedPosition

MiniDesk allows resizing between 330p to 500p, giving 3 to 5 icon columns.

1 Like