XShot is a small command-line screen capture tool written in C using Xlib and libpng. It lets the user interactively select a rectangular region on the X11 root window and saves that region as a PNG image. The program is intentionally minimal and focused on reliable, no-dependencies screen capture on traditional X11 desktops.
- Clone the repository:
git clone https://github.com/nhrx1337/xshot.git
cd xshot/- Install build dependencies:
sudo apt-get install libx11-dev libpng-devsudo pacman -S libx11 libpng- Build:
make- (Optional) Install system-wide:
sudo make installRun interactively:
./xshot- Click and drag with the left mouse button to draw a selection rectangle.
- Release the button to save the selected area as a PNG file.
- Press any key to abort selection.
Saved files are created in the current working directory with timestamped names like DD-MM-YYYY_HH-MM-SS.png.
- The program grabs the pointer and keyboard while selecting to ensure it receives all events during the selection operation.
- The selection rectangle is drawn using XOR drawing so it toggles cleanly while dragging.
- Captured images are written with libpng as 8-bit RGB PNGs.
- Xlib (libX11)
- libpng
If you installed system-wide:
sudo make uninstall