Skip to content

tinyopsec/capta

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

capta



MIT C99 Linux Imlib2 PRs Welcome


capta is a minimal, fast screenshot utility for X11. No daemons, no config files, no GUI overhead.

Features

  • Full-screen capture
  • Focused window capture
  • Interactive region or window selection with a crosshair cursor
  • Capture delay (useful for menus and tooltips)
  • Image quality control from 1 to 100
  • Auto-generated timestamped filenames when no output path is given

Installation

Requires libX11 and Imlib2 development headers.

git clone --depth 1 https://github.com/tinyopsec/capta
cd capta
make
sudo make install

Usage

capta [-s] [-u] [-d sec] [-q 1-100] [file]
Flag Description
-s Select a region or window with the mouse
-u Capture the currently focused window
-d sec Delay sec seconds before capturing
-q num Image quality 1-100 (default 75)
file Output path; auto-named if omitted

Examples

capta                        # full screen, auto-named
capta screenshot.png         # full screen to a file
capta -s                     # select a region
capta -s -q 95 region.jpg    # select, high quality JPEG
capta -u window.png          # focused window
capta -d 3                   # 3-second delay, then full screen
capta -d 2 -s capture.png    # delay then select

How It Works

capta
 ├── parseargs()      parse CLI flags
 ├── initx()          connect to X display, configure Imlib2 context
 ├── [sleep delay]
 ├── grab
 |    ├── grabfull()     imlib_create_image_from_drawable (root, full size)
 |    ├── grabfocused()  XGetInputFocus -> grabwin()
 |    └── grabsel()      XGrabPointer + XOR rubber-band -> grabwin() or rect
 └── saveimg()        imlib_save_image_with_error_return

A drag smaller than 2x2 px in selection mode captures the window under the cursor rather than a region.

Source Layout

capta/
├── capta.c    main logic: argument parsing, grab strategies, entry point
├── imlib.c    X11 init and Imlib2 save wrapper
├── imlib.h    shared display/screen globals and function declarations
├── Makefile   build, install, clean targets
└── LICENSE    MIT

Contributing

Patches and bug reports are welcome. Keep C99, avoid extra dependencies, avoid dynamic allocation where unnecessary.

make clean && make

License

MIT - see LICENSE.

Releases

No releases published

Packages

 
 
 

Contributors