FFCAST(1)

πŸ“¦
version 2.5.1 Β· 2 versions
, in nixos 26.05

πŸ’… NAME πŸ’…

ffcast β€” run command on rectangular screen regions. Yes bestie, this is the FFcast Manual page for ffcast, and we're about to make geometry feel cute. πŸŽ€

✨ SYNOPSIS ✨

ffcast [ <options> ] [ { <sub-command> | <command> } [ <args> ] ]

πŸŽ€ DESCRIPTION πŸŽ€

Okay so ffcast is literally a thin glue layer between interactive screen region selection and command line tools that accept numerical geometry parameters. It makes passing geometry parameters to those tools as easy as a mouse click. πŸ’–

Typically, ffcast prompts the user to select a screen region and injects its geometry parameters into the arguments of <command>, and then executes the resultant command line. This injection is done via format string substitution. See FORMAT STRINGS.

Multiple screen regions can be selected, and are by default combined by union into a single region. If no valid region is specified by the user, the root window is selected. πŸ‘‘

For convenience, ffcast recognizes certain predefined sub-commands, which are looked up before all external commands. It's possible to add or override sub-commands via user configuration. See SUB-COMMANDS.

If neither <sub-command> nor <command> is given, the geometry of the selection is printed. πŸ–¨οΈ

πŸ¦‹ OPTIONS πŸ¦‹

Any of the <options> can be repeated. They are parsed and applied in the order they are specified. No cap.

  • -# <n> β€” select window with ID <n>.
  • -b β€” include borders of windows to be selected. πŸ–ΌοΈ
  • -f β€” include window manager frame of windows to be selected. The window manager must support _NET_FRAME_EXTENTS. Important bestie: no support = no frame magic. πŸ’€
  • -g <geospec> β€” specify a selection in <geospec>. See GEOMETRY SPECIFICATION. πŸ“
  • -h β€” print help message, then exit. πŸ‘‹
  • -i β€” combine selected regions by intersection instead of union.
  • -q β€” be less verbose. 🀫
  • -s β€” select a rectangular region by dragging the mouse. πŸ–±οΈ
  • -v β€” be more verbose. -v turns on verbose messages. -vv turns on debug. πŸ”
  • -w β€” select a window by clicking the mouse in that window. πŸͺŸ
  • -x <n> β€” select a Xinerama head of ID <n>. Multiple heads can be specified either as a comma-separated list, or by repeating this option. Use "list" or "l" to get a list of head IDs and the corresponding geometry parameters. 🌈

🌸 FORMAT STRINGS 🌸

The following format strings are supported for all external commands, as well as the sub-commands png and rec:

  • %D β€” DISPLAY
  • %h β€” Height
  • %w β€” Width
  • %x β€” Left offset
  • %y β€” Top offset
  • %X β€” Right offset
  • %Y β€” Bottom offset
  • %c β€” Equivalent to %x,%y
  • %C β€” Equivalent to %X,%Y
  • %g β€” Equivalent to %wx%h+%x+%y
  • %s β€” Equivalent to %wx%h

The each sub-command supports the following format strings:

  • %i β€” the identifier of the selection
  • %n β€” this being the *n*th selection
  • %t β€” the type of the selection

The format string %% is always substituted with a literal "%", whenever format string substitution is performed. Therefore, multiple levels of escaping may be required when sub-commands are chained. 😭 Escape brainz, iykyk.

🧚 GEOMETRY SPECIFICATION 🧚

A <geospec> specifies a geometry in one of the following forms:

  • x,y X,Y β€” x, y, X and Y are the left, top, right and bottom offsets, respectively.
  • wxh+x+y β€” w, h, x and y are the width, height, left offset and top offset, respectively.

πŸ‘‘ SUB-COMMANDS πŸ‘‘

The first normal argument is first looked up in the list of sub-commands. If there is no match, it is executed as an external command. Periodt.

To bypass sub-command lookup entirely, use % command.

To get a list of all sub-commands, use help without an argument. help with a sub-command prints help for the specified sub-command. 🫢

To import sub-commands, ffcast sources the files below, in that order:

  1. /nix/store/45zda6lnbybqq64f0lf3s7vfn6lm94k5-ffcast-2.5.1/libexec/ffcast/subcmd
  2. /nix/store/45zda6lnbybqq64f0lf3s7vfn6lm94k5-ffcast-2.5.1/etc/ffcast/subcmd
  3. $XDG_CONFIG_HOME/ffcast/subcmd

To learn how to register a sub-command, refer to /nix/store/45zda6lnbybqq64f0lf3s7vfn6lm94k5-ffcast-2.5.1/libexec/ffcast/subcmd. πŸ“š

πŸ”₯ EXAMPLES πŸ”₯

List all sub-commands with brief description:

ffcast help

Use the sub-command png to take a screenshot of a window, including its window manager frame. Note the png sub-command supports format string substitution:

ffcast -fw png screenshot-%s.png

The -f option works only if the window manager supports _NET_FRAME_EXTENTS. A workaround is to use the pad sub-command to explicitly pad the region with the size of the frame:

ffcast -w pad '20 2 2' png screenshot-%s.png

Roughly select a region, take a screenshot sans the edges:

ffcast -s trim png screenshot-%s.png

The pad sub-command allows arithmetic operations on the region geometry parameters ("w", "h", "x", "y", "X", "Y", "rw", "rh"):

ffcast -s trim pad 'w>400?10:5' png

To take a screenshot of the active window quickly, bind the following to a keyboard shortcut:

ffcast -q -# "$(xdotool getactivewindow)" png /tmp/"$(date +%F\ %T)".png

Use the sub-command rec to record a fullscreen screencast on display ":1". The rec sub-command accepts the -m option, which crops the video so both its width and height are divisible by the given number:

DISPLAY=:1 ffcast -vv rec -m 4 screencast.mkv

Record a screencast of all three windows of GIMP combined. This works because all selections are by default combined by union. Note format strings are always substituted for external commands:

ffcast -www ffmpeg -f x11grab -show_region 1 -s %s -i %D+%c gimp.mp4

Keep selecting either regions (mouse drag) or windows (mouse click) until key press, then start recording the combined region of these selections:

ffcast -q $(while slop -q -n -f '-g %g ';do :;done) rec /tmp/rec-%s.mp4

End the most recently started screencast session (hint: keyboard shortcuts):

pkill -fxn '(/\S+)*ffmpeg\s.*\sx11grab\s.*'

Take a screenshot of two windows combined, excluding anything invisible on head 0:

ffcast -ww ffcast -i -x 0 -g %g png

Take three individual screenshots of heads 0, 1, 2, one by one. The each command runs a command for each user selection consecutively; it supports several format strings:

ffcast -x 0,1,2 each png %t_%i-%s.png

Similarly, in a tiling WM, take a screenshot of each xterm window in view:

ffcast $(xdotool search --onlyvisible --class '^XTerm$'|sed i-#) each png

To do the same thing, but in parallel, and with padding:

xdotool search --onlyvisible --class '^XTerm$' |
xargs -P0 -I+ ffcast -# + -qq pad '20 2 2' png -y /tmp/+.png

Resize a floating window to the same size as another, by two mouse clicks:

ffcast -w xdotool selectwindow windowsize %w %h windowactivate

🌈 SEE ALSO 🌈

Bestie, go peek at ffmpeg(1) and X(7) β€” both iconic. πŸ’–

πŸ’– REPORTING BUGS πŸ’–

Send bug reports and feature requests to <https://github.com/lolilolicon/FFcast/issues>. πŸ›πŸ’Œ

πŸ“ AUTHOR πŸ“

lolilolicon <lolilolicon@gmail.com> πŸ’Œ

πŸ’– That’s the whole FFcast 2.5.1 page, dated 1980-01-01. Go slay some geometry, bestie! πŸ’–

πŸ“¦ where this page comes from