Forrest logo
back to the maim tool

maim:tldr:2ede6

maim: Capture a screenshot of the current active window (requires `xdotool`).
$ maim --window $(xdotool getactivewindow) ${path-to-screenshot-png}
try on your machine

This command captures a screenshot of the currently active window and saves it as a PNG image file.

Here's a breakdown of the command:

  • maim: This is the command-line utility for taking screenshots.
  • --window: It is an option flag used to specify that we want to capture a specific window.
  • $(xdotool getactivewindow): This part is a command substitution that retrieves the ID of the currently active window using the xdotool utility. The ID is then passed as an argument to the --window option. This ensures that only the active window is captured.
  • ${path-to-screenshot-png}: This is the path where the screenshot image file will be saved. You need to replace it with the actual desired path and filename for the screenshot image. It should end with the file extension .png, indicating that it will be saved in PNG format.

After executing this command, the active window will be captured and saved as a PNG image file at the specified location.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the maim tool