149 lines
6.4 KiB
Markdown
149 lines
6.4 KiB
Markdown
# 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 and multi-monitor support.
|
|
|
|
## Features
|
|
|
|
- **Multi-Monitor Support**: Specialized tools for handling multiple displays
|
|
- **Monitor Selection**: Choose which monitor to capture (with rofi)
|
|
- **Countdown Timer**: Option to use a countdown to avoid capturing menus
|
|
- **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)
|
|
- **Multiple Methods**: Several different approaches to handle compatibility with different systems
|
|
- **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:
|
|
|
|
```bash
|
|
# For Arch-based distros (including CachyOS)
|
|
sudo pacman -S maim slop feh scrot imagemagick xclip xdotool rofi
|
|
|
|
# For Debian/Ubuntu-based distros
|
|
sudo apt install maim slop feh scrot imagemagick xclip xdotool rofi
|
|
```
|
|
|
|
Note: `rofi` is optional but recommended for the multi-monitor script.
|
|
|
|
## Installation
|
|
|
|
1. Clone this repository or download the scripts:
|
|
|
|
```bash
|
|
git clone https://github.com/yourusername/i3-screenshot.git
|
|
cd i3-screenshot
|
|
```
|
|
|
|
2. Make the scripts executable:
|
|
|
|
```bash
|
|
chmod +x i3-screenshot*.sh
|
|
```
|
|
|
|
3. Move the scripts to a directory in your PATH (optional):
|
|
|
|
```bash
|
|
sudo cp i3-screenshot*.sh /usr/local/bin/
|
|
```
|
|
|
|
## Configuration
|
|
|
|
Add the following lines to your i3 config file (typically `~/.config/i3/config`):
|
|
|
|
```
|
|
# Screenshot with area selection (main script, updated for multi-monitor)
|
|
bindsym Print exec --no-startup-id /path/to/i3-screenshot.sh
|
|
|
|
# Multi-monitor screenshot with selection menu (requires rofi)
|
|
bindsym $mod+Print exec --no-startup-id /path/to/i3-screenshot-multimonitor.sh
|
|
|
|
# Countdown screenshot with selection menu (avoids capturing menus)
|
|
bindsym $mod+Shift+s exec --no-startup-id /path/to/i3-screenshot-countdown.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
|
|
|
|
# ImageMagick import-based screenshot
|
|
bindsym Mod1+Print exec --no-startup-id /path/to/i3-screenshot-import.sh
|
|
```
|
|
|
|
Replace `/path/to/` with the actual path to the scripts.
|
|
|
|
## Usage
|
|
|
|
- Press `Print Screen` to use the main area selection tool (works with multiple monitors)
|
|
- Press `$mod+Print Screen` to use the multi-monitor selection tool with rofi menu
|
|
- Press `$mod+Shift+s` to use the countdown screenshot tool (avoids capturing menus)
|
|
- Press `Shift+Print Screen` to use the alternative freeze-and-select tool
|
|
- Press `Ctrl+Print Screen` to use the simple area selection tool without freezing
|
|
- Press `Alt+Print Screen` to use the ImageMagick import-based tool
|
|
|
|
After pressing the key combination:
|
|
1. For the multi-monitor script: A menu will appear allowing you to select a specific monitor or area
|
|
2. For the countdown script: After selection, a 3-second countdown will start before taking the screenshot
|
|
3. For the area selection scripts: The screen will dim, and you can select an area with your mouse
|
|
4. The screenshot will be saved to `~/Pictures/Screenshots/` with a timestamp
|
|
5. The screenshot will also be copied to your clipboard
|
|
6. A notification will appear confirming the screenshot was taken
|
|
|
|
## How It Works
|
|
|
|
### Main Script (`i3-screenshot.sh`)
|
|
Now uses direct area selection with `slop` and `maim` for better multi-monitor support.
|
|
|
|
### Multi-Monitor Script (`i3-screenshot-multimonitor.sh`)
|
|
Uses `rofi` to provide a selection menu where you can choose to capture a specific monitor, select an area, or take a full screenshot. If `rofi` is not installed, it falls back to area selection mode. Includes a small delay to avoid capturing the menu.
|
|
|
|
### Countdown Script (`i3-screenshot-countdown.sh`)
|
|
Similar to the multi-monitor script, but adds a 3-second countdown before taking the screenshot. This ensures that any menus (like the rofi selection menu) are completely gone before the screenshot is taken.
|
|
|
|
### 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.
|
|
|
|
### Import Script (`i3-screenshot-import.sh`)
|
|
Uses ImageMagick's `import` command, which provides its own selection interface. This may work better on some systems where the other methods fail.
|
|
|
|
## Multi-Monitor Troubleshooting
|
|
|
|
- **Screenshots span across multiple monitors**: Use the `i3-screenshot-multimonitor.sh` script to select a specific monitor
|
|
- **Selection tool appears on the wrong monitor**: Try using the `i3-screenshot-import.sh` script instead
|
|
- **Rofi menu doesn't appear**: Make sure `rofi` is installed (`sudo pacman -S rofi`)
|
|
- **Rofi menu appears in the screenshot**: Use the `i3-screenshot-countdown.sh` script which waits before taking the screenshot
|
|
|
|
## General Troubleshooting
|
|
|
|
### Common Issues
|
|
|
|
- **Screen freezes but selection doesn't work**: The main script has been updated to use direct selection without freezing
|
|
- **Selection tool doesn't appear**: Make sure `slop` is installed and working correctly
|
|
- **Black screenshots**: This can happen with compositing issues. Try using the `i3-screenshot-import.sh` script instead
|
|
- **Menu appears in screenshots**: Use the countdown script which gives time for menus to disappear
|
|
|
|
### General Tips
|
|
|
|
- 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
|
|
- Try each of the different scripts to see which works best on your system
|
|
|
|
## Customization
|
|
|
|
You can modify the scripts to change:
|
|
- The save location by editing the `SAVE_DIR` variable
|
|
- The notification messages
|
|
- The file naming convention
|
|
- The rofi appearance and options in the multi-monitor script
|
|
- The countdown duration in the countdown script
|
|
|
|
## License
|
|
|
|
This project is licensed under the MIT License - see the LICENSE file for details. |