Foster McLane 548e887157 use DISPLAY environment variable by default instead of :0 7 lat temu
modules pretty much done now 7 lat temu
src use DISPLAY environment variable by default instead of :0 7 lat temu
CMakeLists.txt improved namespace clashing 7 lat temu
COPYING Added copy of GPLv3, thanks to https://github.com/Simonft. 10 lat temu
README.md updated readme 7 lat temu
license.txt Added GPL notifications at the top of each file, and made it clear that contributors must agree with it too. 10 lat temu
slop.1 swapped around options a bit again 7 lat temu
slop.1.gz swapped around options a bit again 7 lat temu

README.md

slop

slop (Select Operation) is an application that queries for a selection from the user and prints the region to stdout.

Features

  • Hovering over a window will cause a selection rectangle to appear over it.
  • Clicking on a window makes slop return the dimensions of the window, and it's ID.
  • OpenGL accelerated graphics where possible.
  • Supports simple arguments:
    • Change selection rectangle border size.
    • Select X display.
    • Set padding size.
    • Force window, or pixel selections with the tolerance flag.
    • Set the color of the selection rectangles to match your theme! (Even supports transparency!)
    • Remove window decorations from selections.
  • Supports custom programmable shaders.

Practical Applications

slop can be used to create a video recording script in only two lines of code.

#!/bin/bash
read -r X Y W H G ID < <(slop -f "%x %y %w %h %g %i")
ffmpeg -f x11grab -s "$W"x"$H" -i :0.0+$X,$Y -f alsa -i pulse ~/myfile.webm

You can also take images using imagemagick like so:

#!/bin/bash
read -r G < <(slop -f "%g")
import -window root -crop $G ~/myimage.png

If you don't like ImageMagick's import: Check out maim for a better screenshot utility.

Lets see some action

Ok. Here's a comparison between 'scrot -s's selection and slop's:

scrotbad slopgood

You can see scrot leaves garbage lines over the things you're trying to screenshot! While slop not only looks nicer, it's impossible for it to end up in screenshots or recordings because it waits for DestroyNotify events before completely shutting down. Only after the window is completely destroyed can anything take a screenshot.

how to install

Install using your Package Manager (Preferred)

Install using CMake (Requires CMake)

Note: Dependencies should be installed first: libxext, OpenGL, and glm.

git clone https://github.com/naelstrof/slop.git
cd slop
cmake -DCMAKE_INSTALL_PREFIX="/usr" ./
make && sudo make install

Shaders

These are implemented, but not flushed out. I haven't gotten around to writing some tutorials on them. So check back later!