@@ -0,0 +1,149 @@ |
| 1 | +# garshot |
| 2 | + |
| 3 | +X11 screenshot utility for the gar desktop suite. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- Full screen, region, window capture |
| 8 | +- Interactive selection with blur overlay |
| 9 | +- Multi-monitor support (XRandR) |
| 10 | +- Output formats: PNG, JPEG, WebP |
| 11 | +- Auto-copy to clipboard |
| 12 | +- Optional cursor capture |
| 13 | +- MIT-SHM for fast screen capture |
| 14 | + |
| 15 | +## Dependencies |
| 16 | + |
| 17 | +Build: |
| 18 | +- Rust 1.85+ |
| 19 | +- libxcb, libx11 |
| 20 | +- cairo |
| 21 | + |
| 22 | +Runtime: |
| 23 | +- X11 |
| 24 | +- xclip (for clipboard) |
| 25 | + |
| 26 | +### Fedora/RHEL |
| 27 | +```sh |
| 28 | +sudo dnf install libxcb-devel libX11-devel cairo-devel xclip |
| 29 | +``` |
| 30 | + |
| 31 | +### Debian/Ubuntu |
| 32 | +```sh |
| 33 | +sudo apt install libxcb1-dev libx11-dev libcairo2-dev xclip |
| 34 | +``` |
| 35 | + |
| 36 | +### Arch |
| 37 | +```sh |
| 38 | +sudo pacman -S libxcb libx11 cairo xclip |
| 39 | +``` |
| 40 | + |
| 41 | +## Build |
| 42 | + |
| 43 | +```sh |
| 44 | +cargo build --release |
| 45 | +``` |
| 46 | + |
| 47 | +Binary at `target/release/garshot`. |
| 48 | + |
| 49 | +## Install |
| 50 | + |
| 51 | +```sh |
| 52 | +cargo install --path garshot |
| 53 | +``` |
| 54 | + |
| 55 | +Or copy manually: |
| 56 | +```sh |
| 57 | +sudo install -Dm755 target/release/garshot /usr/local/bin/garshot |
| 58 | +``` |
| 59 | + |
| 60 | +## Usage |
| 61 | + |
| 62 | +### Full screen |
| 63 | +```sh |
| 64 | +garshot screen # All monitors |
| 65 | +garshot screen -m DP-1 # Specific monitor |
| 66 | +garshot screen -c # Include cursor |
| 67 | +garshot screen -f jpeg -o shot.jpg # JPEG output |
| 68 | +``` |
| 69 | + |
| 70 | +### Interactive selection |
| 71 | +```sh |
| 72 | +garshot select # Blur overlay, drag to select |
| 73 | +garshot select -b 20 # Custom blur radius |
| 74 | +``` |
| 75 | + |
| 76 | +Controls: |
| 77 | +- Left click + drag: select region |
| 78 | +- Right click / Escape: cancel |
| 79 | +- Release: capture |
| 80 | + |
| 81 | +### Window capture |
| 82 | +```sh |
| 83 | +garshot window # Active window |
| 84 | +garshot window -i 0x1400007 # By window ID |
| 85 | +garshot window -d # Include decorations |
| 86 | +``` |
| 87 | + |
| 88 | +### Region by geometry |
| 89 | +```sh |
| 90 | +garshot region -g 800x600+100+50 # WxH+X+Y format |
| 91 | +``` |
| 92 | + |
| 93 | +### List monitors |
| 94 | +```sh |
| 95 | +garshot monitors |
| 96 | +``` |
| 97 | + |
| 98 | +### Common options |
| 99 | + |
| 100 | +| Option | Description | |
| 101 | +|--------|-------------| |
| 102 | +| `-o, --output <PATH>` | Output file path | |
| 103 | +| `-f, --format <FMT>` | png, jpeg, webp (default: png) | |
| 104 | +| `-c, --cursor` | Include cursor in capture | |
| 105 | +| `--no-clipboard` | Don't copy to clipboard | |
| 106 | + |
| 107 | +## Configuration |
| 108 | + |
| 109 | +Config file: `~/.config/garshot/config.toml` |
| 110 | + |
| 111 | +```toml |
| 112 | +[general] |
| 113 | +save_dir = "~/Pictures/Screenshots" |
| 114 | +format = "png" |
| 115 | +quality = 90 |
| 116 | +include_cursor = false |
| 117 | + |
| 118 | +[selection] |
| 119 | +blur_radius = 15 |
| 120 | +line_color = "#ff6600" |
| 121 | +line_width = 2 |
| 122 | + |
| 123 | +[naming] |
| 124 | +pattern = "screenshot-%Y%m%d-%H%M%S" |
| 125 | +``` |
| 126 | + |
| 127 | +## Keybindings (gar) |
| 128 | + |
| 129 | +Add to `~/.config/gar/init.lua`: |
| 130 | + |
| 131 | +```lua |
| 132 | +gar.bind("ctrl+shift+4", function() |
| 133 | + gar.exec("garshot select") |
| 134 | +end) |
| 135 | +gar.bind("ctrl+shift+5", function() |
| 136 | + gar.exec("garshot screen") |
| 137 | +end) |
| 138 | +gar.bind("ctrl+shift+6", function() |
| 139 | + gar.exec("garshot window") |
| 140 | +end) |
| 141 | +``` |
| 142 | + |
| 143 | +## Environment |
| 144 | + |
| 145 | +- `RUST_LOG=debug` - Enable debug logging |
| 146 | + |
| 147 | +## License |
| 148 | + |
| 149 | +MIT |