slop

Get a selection of the screen.

TLDR

Wait for the user to make a selection and output its geometry to standard output

$ slop
copy


Double click, rather than click and drag, to draw a selection
$ slop -D
copy


Highlight the selection rather than outlining it
$ slop -l
copy


Specify the output format
$ slop -f [format_string]
copy


Specify the selection rectangle's color
$ slop -c [red],[green],[blue],[alpha]
copy

SYNOPSIS

slop [-klqn] [OPTIONS]

DESCRIPTION

slop is an application that queries 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.

OPTIONS

-h, --help

Print help and exit.

-v, --version

Print version and exit.

-x, --xdisplay=hostname:number.screen_number

Sets the xdisplay to use.

-b, --bordersize=FLOAT

Sets the selection rectangle's thickness.

-p, --padding=FLOAT

Sets the padding size for the selection, this can be negative.

-t, --tolerance=FLOAT

How far in pixels the mouse can move after clicking, and still be detected as a normal click instead of a click-and-drag. Setting this to 0 will disable window selections. Alternatively setting it to 9999999 would force a window selection.

-c, --color=FLOAT,FLOAT,FLOAT,FLOAT

Sets the selection rectangle's color. Supports RGB or RGBA input. Depending on the system's window manager/OpenGL support, the opacity may be ignored.

-r, --shader=STRING

This sets the vertex shader, and fragment shader combo to use when drawing the final framebuffer to the screen. This obviously only works when OpenGL is enabled. The shaders are loaded from ~/.config/slop. See https://github.com/naelstrof/slop for more information on how to create your own shaders.

-f, --format=STRING

Sets the output format for slop. Format specifiers are %x (x offset), %y (y offset), %w (width), %h (height), %i (window id), %c (1 if cancelled, 0 otherwise), %g (geometry - `%wx%h+%x+%y'), and %% for a literal percent sign.

-n, --nodecorations=INT

Sets the level of aggressiveness when trying to remove window decorations. `0' is off, `1' will try lightly to remove decorations, and `2' will recursively descend into the root tree until it gets the deepest available visible child under the mouse. Defaults to `0'. Supplying slop with just `-n` is equivalent to supplying `-n1`.

-l, --highlight

Instead of outlining a selection, slop will highlight it instead. This is particularly useful if the color is set to an opacity lower than 1.

-D, --nodrag

Allows you to click twice to indicate a selection, rather than click-dragging.

-q, --quiet

Disable any unnecessary cerr output. Any warnings simply won't print.

-k, --nokeyboard

Disables the ability to cancel selections with the keyboard.

-o, --noopengl

Disables graphics acceleration. Might be useful if you get rendering bugs.

EXAMPLES

To emulate a windows XP selection, you can use something like this:

slop --highlight --tolerance=0 --color=0.3,0.4,0.6,0.4

In order to avoid using eval(1) in your scripts (pretty big security issue), you can use slop like this instead:

read -r X Y W H G ID < <(slop -f "%x %y %w %h %g %i")

BUGS

No known bugs.

SEE ALSO

maim(1)

AUTHOR

Dalton Nell (naelstrof@gmail.com)

Copied to clipboard