FvwmCommand(1)

πŸ“¦
version 2.7.0 Β· 6 versions
, in alpine 3.24, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0

πŸ’– FvwmCommand(1) πŸ’–

Fvwm Modules section 🌸 Part 1 of 2, more coming, bestie ✨

✨ NAME ✨

okay so FvwmCommand is the fvwm command external interface πŸ¦‹. It's the door that lets outside stuff talk to fvwm.

🌷 SYNOPSIS

FvwmCommand [-cmrvw] [-S name] [-i level] [-f name] [-F level]
[command...]

πŸ’… DESCRIPTION

FvwmCommand lets you keep an eye on fvwm transactions and fire off fvwm commands straight from a shell command line or a script 🧚. Every argument you pass gets treated as its own fvwm command. Want to send something with spaces in it? Wrap it in quotes, periodt πŸŽ€. Like this:

FvwmCommand 'FvwmPager 0 1'

🫢 INVOCATION

FvwmCommandS needs to get spawned once by fvwm 🌈, whether that happens in your .fvwm2rc file, from a menu, or from FvwmConsole. After that, FvwmCommand can be called from a shell or script to run fvwm commands.

From inside your .fvwm2rc file, you can do one of these:

Module FvwmCommandS

Or, the other way:

AddToFunc StartFunction "I" Module FvwmCommandS

Then, in a script file or from the shell, you can do something like:

FvwmCommand  'popup Utilities'

πŸŽ€ OPTIONS

  • -c β€” tells FvwmCommand to read multiple commands from standard input πŸ“₯ instead of the single command in the command-line arguments. Heads up, this disables -m or -i.
(echo "Exec xload"; echo "Beep") | FvwmCommand -c
  • -F <level> β€” picks which level of fvwm window flags FvwmCommand outputs πŸͺŸ. Choose one:
    • 0 β€” no window flags get printed, sad but true 😭
    • 2 β€” full window flags get printed, but only if the information level (-i) is 2 or 3 ✨
  • -f <name> β€” lets you use an alternative FIFO set to talk to a server πŸ”Œ. The default FIFO set is /var/tmp/FvwmCommand-${DISPLAY}C. In there, FvwmCommand..C is used to send commands and FvwmCommand..M is used to receive messages. If that path is unusable, ${FVWM_USERDIR}/FvwmCommand-${DISPLAY} gets used instead.

FvwmCommandS has to be invoked with the same <name> as its first argument before you run FvwmCommand. You can also use -S for this (see -S below). This is super useful when you need a dedicated connection to run a background job while another connection stays open for interactive use 🫧.

  • -i <level> β€” controls how much info comes back πŸ“š. Choose one:
    • 0 β€” error messages only πŸ™ˆ
    • 1 β€” errors, replies, and window configuration info. This is the default πŸ’–
    • 2 β€” everything from level 1, plus the above and static window info ✨
    • 3 β€” all information available πŸ”₯

πŸ™ˆ Level 0 (-i 0)

FvwmCommand -i0 FvwmBanner will show a banner without any output. Cute, but quiet 🀫.

On the other hand, FvwmCommand -i 0 foobar will return:

[fvwm][executeModule]: <<ERROR>> No such module
'foobar' in ModulePath '/usr/lib/X11/fvwm'
Note: Fvwm doesn't return any error messages in cases like the one below, since windowid itself is a valid command πŸ’€.
FvwmCommand -i 0 'windowid foo bar'

🌟 Level 1 (default)

Errors, replies, and window configuration info all show up at this level. Try FvwmCommand send_windowlist and you'll get something like this:

0x02000014 window               FvwmConsole
0x02000014 icon                 FvwmConsole
0x02000014 class                XTerm
0x02000014 resource             FvwmConsole
0x01c00014 window               console
0x01c00014 icon                 console
0x01c00014 class                XTerm
0x01c00014 resource             console
0x01000003 window               Fvwm Pager
0x01000003 icon
0x01000003 class                FvwmModule
0x01000003 resource             FvwmPager
0x00c0002c window               emacs: FvwmCommand.man
0x00c0002c icon                 FvwmCommand.man
0x00c0002c icon file            xemacs.xpm
0x00c0002c class                Emacs
0x00c0002c resource             emacs
end windowlist

The first column is the window ID number, which you can use with the windowid command πŸͺ„. The second column is the information type, and the last column is the contents πŸ’…. If no information comes back, add -w <time> or -r. This might be needed on heavily loaded systems 😭.

✨ Level 2 (-i2)

This level gives you everything above plus the static window info ✨. Try FvwmCommand -i2 'FvwmPager 0 1', and you'll get this output:

0x03c00003 frame                x 962, y 743, width 187, height 114
0x03c00003 desktop              0
0x03c00003 StartIconic          no
0x03c00003 OnTop                yes
0x03c00003 Sticky               yes
0x03c00003 WindowListSkip       yes
0x03c00003 SuppressIcon         no
0x03c00003 NoiconTitle          no
0x03c00003 Lenience             no
0x03c00003 StickyIcon           no
0x03c00003 CirculateSkipIcon    no
0x03c00003 CirculateSkip        no
0x03c00003 ClickToFocus         no
0x03c00003 SloppyFocus          no
0x03c00003 SkipMapping          no
0x03c00003 Handles              no
0x03c00003 Title                no
0x03c00003 Mapped               no
0x03c00003 Iconified            no
0x03c00003 Transient            no
0x03c00003 Raised               no
0x03c00003 Visible              no
0x03c00003 IconOurs             no
0x03c00003 PixmapOurs           no
0x03c00003 ShapedIcon           no
0x03c00003 Maximized            no
0x03c00003 WmTakeFocus          no
0x03c00003 WmDeleteWindow       yes
0x03c00003 IconMoved            no
0x03c00003 IconUnmapped         no
0x03c00003 MapPending           no
0x03c00003 HintOverride         yes
0x03c00003 MWMButtons           no
0x03c00003 MWMBorders           no
0x03c00003 title height         0
0x03c00003 border width         4
0x03c00003 base size            width 8, height 7
0x03c00003 size increment       width 9, height 9
0x03c00003 min size             width 8, height 7
0x03c00003 max size             width 32767, height 32767
0x03c00003 gravity              SouthEast
0x03c00003 pixel                text 0xffffff, back 0x7f7f7f
0x03c00003 window               Fvwm Pager
0x03c00003 icon                 Fvwm Pager
0x03c00003 class                FvwmModule
0x03c00003 resource             FvwmPager

πŸ”₯ Level 3 (-i3)

This level gives you all the information available 🀯. For example, FvwmCommand -i3 'Killmodule Fvwm*' reports which windows get closed:

0x03400003 destroy
0x02400002 destroy
  • -m β€” keeps monitoring fvwm window information transactions πŸ¦‹. It continuously outputs whatever it receives and never exits. It's handy in a background job, often paired with -i3 so you can control windows dynamically πŸŽ€. For example:
FvwmCommand -mi3 | grep 'iconify'

That reports whenever windows get iconified or de-iconified.

Heads up πŸ™ˆ: FvwmCommand doesn't block-buffer its output, but many utilities like grep or sed do. So the next example won't show anything until either FvwmCommand is terminated or the stdout buffer from grep is filled.
FvwmCommand -mi3 | grep ' map' |
sed 's/\(0x[0-9a-f]*\).*/windowid \1 move 0 0/'

Instead, use tools with buffer control, like pty or perl πŸ’…. The one below will iconify new windows when they open:

Fvwm -mi3 | perl -ne '
$|=1;
print "windowid $1 iconify\n" if /^(0x\S+) add/;
' > ~/.FvwmCommandC
  • -r β€” waits for a reply before it exits 🫢. Normally, FvwmCommand exits if no information or error is returned within a fixed amount of time (check -w for that). The -r option overrides this time limit and waits for at least one message back. After that first message, it waits for another message for the time limit. This is useful when the system is too loaded to predict how fast it'll respond AND the command causes some message to be sent back 🐒.
  • -S <name> β€” invokes another server, FvwmCommandS, with FIFO set <name> πŸ”€.
    • Without -f: the invoking FvwmCommand uses the default FIFO to talk to the default server so it can invoke a new server.
    • With -f: the invoking FvwmCommand still uses the default FIFO to talk to the default server and invoke a new server. Then it switches the FIFO set and starts talking to the new server.

This is useful when you need a dedicated connection for a background job while another connection is kept for interactive use. If <name> is a relative path name, it's relative to where fvwm is running, not to where FvwmCommand is invoked πŸ“.

  • -v β€” returns the FvwmCommand version number and exits πŸ”’.
  • -w <time> β€” waits for <time> micro seconds for a message ⏳. FvwmCommand exits if no information or error is returned within a fixed amount of time, unless -m is used. The default is 500 ms, and this option overrides that default value.

✨ EXAMPLES ✨

okay bestie, here's the lineup of example scripts πŸ’… they're not meant to be practical, they just show how it can be done 🫢

🧚 test1.pl

  • test1.pl takes 1 argument:
    • 't' invokes FvwmTalk πŸ’–
    • 'td' kills FvwmTalk πŸ’€
    • '' moves windows πŸ¦‹

🌸 test2.sh

  • test2.sh takes 1 argument:
    • 'b' invokes FvwmButtons πŸ”₯
    • 'kb' kills FvwmButtons πŸ’€
    • 'r' changes the # of button rows 🌈
    • 'c' changes the # of button columns πŸ‘‘

πŸ¦‹ ex-auto.pl, ex-cascade.pl, ex-grpmv.pl

  • ex-auto.pl auto raises small windows, and it keeps them visible ✨
  • ex-cascade.pl cascades windows, then moves them back 🌸
  • ex-grpmv.pl lets you choose a group of windows to move together πŸŽ€
These examples are not meant to be practical. They're just here to show how it can be done 🫢

This is a user programmable window focus script, and the default behaviour is giving main character energy ✨

  1. When a window is opened, focus the window and move the pointer to it. The parent window regains focus when a window is closed. Parenthood is determined when a window is opened, and it is the last focused window with the same X class. πŸ¦‹
  2. #1 would not occur for an AcroRead opening window. πŸ™ˆ
  3. #1 would not occur when SkipMapping is set and the window is the only window of its class. πŸ’…
  4. For the Netscape find dialog window, in addition to #1, resize the window to 300x150 pixels and move it to the East edge of the screen. Download/upload windows will not be focused, nor will they be in the focus link list. 🌈
  5. Move appletviewer to the NorthWest corner. 🧚
  6. Xterm won't focus back to its parent after it's closed. 😭
  7. When a window is de-iconified, focus it and move the pointer. πŸ’–

πŸŽ€ focus-Netscape.pl

This one focuses pop-up windows, like 'open URL' or 'find', whenever they open. That means you can type right away without moving the mouse πŸ–±οΈ so cute, no cap. It also moves the 'download' window to the right edge so it stays visible πŸ‘‘

If you invoke it from .fvwm2rc, use it like this:

AddToFunc "StartFunction" "I" Module  FvwmCommandS
+ "I" Exec $HOME/scripts/focus-Netscape.pl

🫧 push-away.pl

push-away.pl <direction> <window name>

This pushes windows away so they don't overlap 🌊 Use it like this:

push-away.pl up 'Fvwm Pager'

πŸ”— SEE ALSO πŸ”—

  • fvwm 🌟

πŸ‘‘ AUTHOR πŸ‘‘

FvwmCommand is the original work of Toshi Isogai πŸ’–


bestie, that's the whole page πŸŽ€ source: 3rd Berkeley Distribution, version 2.7.0, dated 19 October 2022, FvwmCommand(1) βœ¨πŸ’…πŸ«Ά