A simple bash script for taking screenshots using maim
Published at 2026-04-04 11:31
Here's a simple bash script that help you take a screenshot by
clicking on an application or by selecting a region of the screen.
It uses maim. On Arch Linux you can install it with:
sudo pacman -S maim
Code
‾‾‾‾
#!/usr/bin/env bash
# Create Screenshots directory if it doesn't exist
mkdir -p "$HOME/Screenshots"
# Take screenshot and name the file by date and time
maim -su "$HOME/Screenshots/$(date +%Y-%m-%d-%H-%M-%S).jpg"
You can bind a hotkey or make an alias for this script.
It's up to you.
🪙 Donate
‾‾‾‾‾‾‾‾‾
If this tutorial saved you time, sanity, or a mild existential
crisis... consider fueling future chaos with a small donation:
HTML Buy me a Ko-Fi ☕
DIR 🎓 Back to my tutorials
DIR Back to my homepage