Giter Site home page Giter Site logo

selx's Introduction

selx

selx is a simple X11 rectangle selection tool, meant to be a smaller alternative to slop.

Some key features:

  • Select a rectangle interactively.
  • Select a window by right-click.
  • Re-adjust the selection area by scroll-wheel up/down.
  • Select a window by window ID.
  • Adjustable selection line color and border width.

View the manpage for more details.

Preview

preview

(Note: the preview image is using the old project name sx4 before it was renamed to selx)

Example Usage

  • Take a screenshot of the selected area with sxot:
$ sxot -g "$(selx)" > out.ppm
  • Recording the selected area with ffmpeg:
#!/bin/sh

IFS=, read x y w h << EOF
$(selx)
EOF
[ -z "$h" ] && exit 1  # nothing selected
# pad to an even resolution since some output format do no accept odd res
even_w="$(( w + (w % 2) ))"; even_h="$(( h + (h % 2) ))";

ffmpeg -f x11grab -s "${w}x${h}" -i ":0.0+$x,$y" -c:v libx264 -an \
	-framerate 30 -r 30 -threads "$(nproc)" -preset slow -tune zerolatency \
	-vf "format=yuv422p, pad=w=${even_w}:h=${even_h}" -crf 18 \
	"$HOME/videos/$(date '+%F_%T').mp4"

Dependencies

  • Build Dependencies:

    • C99 compiler
    • Necessary library headers (on some distros you need to install *-dev packages to get header files)
  • Runtime Dependencies:

    • X11 server
    • Xlib
    • Xext
    • libXrandr

Building

  • Simple optimized build:
$ cc -o selx selx.c -O3 -s -l X11 -l Xext -l Xrandr

The above command should also work with c99, gcc, clang or any other C compiler that has a POSIX compatible cli interface.

  • Debug build with gcc (also works with clang):
$ gcc -o selx selx.c -std=c99 -Wall -Wextra -Wpedantic -Wshadow \
    -g3 -D DEBUG -O0 -fsanitize=address,undefined -l X11 -l Xext -l Xrandr
  • If you're editing the code, you may optionally run some static analysis:
$ make -f etc/analyze.mk

Installing

Just copy the executable and the man-page to the appropriate location:

# cp selx /usr/local/bin
# cp selx.1 /usr/local/share/man/man1

Or using the install utility:

# install -Dm755 selx /usr/local/bin/selx
# install -Dm644 selx.1 /usr/local/share/man/man1/selx.1

Limitation

May not work properly when a compositor is running.

selx's People

Contributors

dusanlesan avatar maxgyver83 avatar n-r-k avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.