markdown · 2993 bytes Raw Blame History

garshot

X11 screenshot utility for the gar desktop suite.

Features

  • Full screen, region, window capture
  • Interactive selection with blur overlay
  • Multi-monitor support (XRandR)
  • Output formats: PNG, JPEG, WebP
  • Auto-copy to clipboard
  • Optional cursor capture
  • MIT-SHM for fast screen capture

Dependencies

Build:

  • Rust 1.85+
  • libxcb, libx11
  • cairo

Runtime:

  • X11
  • xclip (for clipboard)
  • libnotify (for --notify, optional)

Fedora/RHEL

sudo dnf install libxcb-devel libX11-devel cairo-devel xclip libnotify

Debian/Ubuntu

sudo apt install libxcb1-dev libx11-dev libcairo2-dev xclip libnotify-bin

Arch

sudo pacman -S libxcb libx11 cairo xclip libnotify

Build

cargo build --release

Binary at target/release/garshot.

Install

cargo install --path garshot

Or copy manually:

sudo install -Dm755 target/release/garshot /usr/local/bin/garshot

Usage

Full screen

garshot screen                     # All monitors
garshot screen -m DP-1             # Specific monitor
garshot screen -c                  # Include cursor
garshot screen -f jpeg -o shot.jpg # JPEG output
garshot screen --delay 3           # 3 second countdown
garshot screen --notify            # Desktop notification on save
garshot screen -o - | feh -        # Pipe to viewer

Interactive selection

garshot select                     # Blur overlay, drag to select
garshot select -b 20               # Custom blur radius

Controls:

  • Left click + drag: select region
  • Right click / Escape: cancel
  • Release: capture

Window capture

garshot window                     # Active window
garshot window -i 0x1400007        # By window ID
garshot window -d                  # Include decorations

Region by geometry

garshot region -g 800x600+100+50   # WxH+X+Y format

List monitors

garshot monitors

Common options

Option Description
-o, --output <PATH> Output file path (use - for stdout)
-f, --format <FMT> png, jpeg, webp (default: png)
-c, --cursor Include cursor in capture
--no-clipboard Don't copy to clipboard
--delay <SECS> Delay before capture (screen/region/window)
--notify Show desktop notification on save

Configuration

Config file: ~/.config/garshot/config.toml

[general]
save_dir = "~/Pictures/Screenshots"
format = "png"
quality = 90
include_cursor = false

[selection]
blur_radius = 15
line_color = "#ff6600"
line_width = 2

[naming]
pattern = "screenshot-%Y%m%d-%H%M%S"

Keybindings (gar)

Add to ~/.config/gar/init.lua:

gar.bind("ctrl+shift+4", function()
    gar.exec("garshot select")
end)
gar.bind("ctrl+shift+5", function()
    gar.exec("garshot screen")
end)
gar.bind("ctrl+shift+6", function()
    gar.exec("garshot window")
end)

Environment

  • RUST_LOG=debug - Enable debug logging

License

MIT

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