3.5 KiB
i3 Screenshot Tool
A collection of scripts for taking screenshots in i3 window manager on Linux (CachyOS), with a focus on the "freeze and select" functionality.
Features
- Freeze and Select: Freeze the screen and then select an area to capture
- Simple Selection: Direct area selection without freezing (faster but without the freeze effect)
- Clipboard Integration: Automatically copies screenshots to clipboard
- Notifications: Desktop notifications when screenshots are taken
- Timestamp Naming: Automatically names files with timestamps
Requirements
These scripts depend on various Linux utilities. Install them using your package manager:
# For Arch-based distros (including CachyOS)
sudo pacman -S maim slop i3lock feh scrot imagemagick xclip xdotool
# For Debian/Ubuntu-based distros
sudo apt install maim slop i3lock feh scrot imagemagick xclip xdotool
Installation
- Clone this repository or download the scripts:
git clone https://github.com/yourusername/i3-screenshot.git
cd i3-screenshot
- Make the scripts executable:
chmod +x i3-screenshot.sh i3-screenshot-alt.sh i3-screenshot-simple.sh
- Move the scripts to a directory in your PATH (optional):
sudo cp i3-screenshot*.sh /usr/local/bin/
Configuration
Add the following lines to your i3 config file (typically ~/.config/i3/config):
# Screenshot with freeze and area selection (main script)
bindsym Print exec --no-startup-id /path/to/i3-screenshot.sh
# Alternative screenshot with freeze and area selection
bindsym Shift+Print exec --no-startup-id /path/to/i3-screenshot-alt.sh
# Simple screenshot with area selection (no freeze)
bindsym Ctrl+Print exec --no-startup-id /path/to/i3-screenshot-simple.sh
Replace /path/to/ with the actual path to the scripts.
Usage
- Press
Print Screento use the main freeze-and-select screenshot tool - Press
Shift+Print Screento use the alternative freeze-and-select tool - Press
Ctrl+Print Screento use the simple area selection tool without freezing
After pressing the key combination:
- For the freeze scripts: The screen will freeze, and you can select an area with your mouse
- For the simple script: The screen will dim, and you can select an area with your mouse
- The screenshot will be saved to
~/Pictures/Screenshots/with a timestamp - The screenshot will also be copied to your clipboard
- A notification will appear confirming the screenshot was taken
How It Works
Main Script (i3-screenshot.sh)
Uses maim to take a full screenshot, displays it with i3lock to freeze the screen, then uses slop for area selection and maim again to capture just that area.
Alternative Script (i3-screenshot-alt.sh)
Uses scrot for the initial screenshot, feh to display it fullscreen, slop for selection, and imagemagick to crop the image.
Simple Script (i3-screenshot-simple.sh)
Uses just maim with the -s flag for direct area selection without freezing the screen first.
Customization
You can modify the scripts to change:
- The save location by editing the
SAVE_DIRvariable - The notification messages
- The file naming convention
Troubleshooting
- If the scripts don't work, make sure all dependencies are installed
- Check that the scripts have executable permissions
- Verify your i3 config has the correct paths to the scripts
- If using the i3lock method, ensure your system supports i3lock with image display
License
This project is licensed under the MIT License - see the LICENSE file for details.