naelstrof e078d082ca Fixed a lot of accuracy issues. 11 anos atrás
README.md updated readme 11 anos atrás
license.txt changed to gpl 11 anos atrás
main.cpp Fixed a lot of accuracy issues. It was due to the mouse in X11 selecting pixels one left and one above where you actually can put the mouse, and doing some window border math wrong. This caused you to be incapable of selecting the whole screen since the mouse can't position itself completely in the lower right corner, and judging a window's reported size wrong. I also made the tolerance option more functional; setting it to 0 will disable window selections. Because of this I also removed the --nowindow option. 11 anos atrás
makefile added an option to disable auto-window-selection and fixed a few options in the makefile 11 anos atrás
options.cpp Fixed a lot of accuracy issues. It was due to the mouse in X11 selecting pixels one left and one above where you actually can put the mouse, and doing some window border math wrong. This caused you to be incapable of selecting the whole screen since the mouse can't position itself completely in the lower right corner, and judging a window's reported size wrong. I also made the tolerance option more functional; setting it to 0 will disable window selections. Because of this I also removed the --nowindow option. 11 anos atrás
options.hpp Fixed a lot of accuracy issues. It was due to the mouse in X11 selecting pixels one left and one above where you actually can put the mouse, and doing some window border math wrong. This caused you to be incapable of selecting the whole screen since the mouse can't position itself completely in the lower right corner, and judging a window's reported size wrong. I also made the tolerance option more functional; setting it to 0 will disable window selections. Because of this I also removed the --nowindow option. 11 anos atrás
x.cpp give slop's window a class 11 anos atrás
x.hpp name change, slrn was taken by some guy from 1994 11 anos atrás

README.md

slop

slop (Select Operation) is an application that querys for a selection from the user and prints the region to stdout. It grabs the mouse and turns it into a crosshair, lets the user click and drag to make a selection (or click on a window) while drawing a pretty box around it, then finally prints the selection's dimensions 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.
  • Clicking and dragging causes a selection rectangle to appear, renders pretty well (compared to scrot). And will return the dimensions of that rectangle in absolute screen coords.
  • On startup it turns your cursor into a crosshair, then adjusts the cursor into angles as you drag the selection rectangle.
  • Supports simple arguments:
    • Change selection rectangle border size.
    • Select X display.
    • Set padding size, even to negative padding sizes!
    • Set click tolerance for if you have a shaky mouse.
    • Set the color of the selection rectangles to match your theme!

practical applications

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

#!/bin/bash
eval `slop`
ffmpeg -f x11grab -s "$W"x"$H" -i :0.0+$X,$Y -f alsa -i pulse ~/myfile.webm

slop lets you select a region or window and ffmpeg will record it in the format of your choice! Combined with keybinds and a server on your filesystem you can make a really neat and unobtrusive screenshooter.

You can also take images using imagemagick like so:

#!/bin/bash
eval `slop`
import -window root -crop "$W"x"$H"+$X+$Y ~/myimage.png

You can see my implementation of slop in a screenshooter here: https://gist.github.com/naelstrof/6530959

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 shuts down before ffmpeg or imagemagick can take a picture.