All Projects → naelstrof → Slop

naelstrof / Slop

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

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Slop

Diligentcore
Core functionality of Diligent Engine
Stars: ✭ 263 (-58.84%)
Mutual labels:  opengl, shaders
Python Opengl
An open access book on Python, OpenGL and Scientific Visualization, Nicolas P. Rougier, 2018
Stars: ✭ 441 (-30.99%)
Mutual labels:  opengl, shaders
Singlefile
Web Extension for Firefox/Chrome/MS Edge and CLI tool to save a faithful copy of an entire web page in a single HTML file
Stars: ✭ 4,417 (+591.24%)
Mutual labels:  cli, screenshot
Editly
Slick, declarative command line video editing & API
Stars: ✭ 3,162 (+394.84%)
Mutual labels:  cli, opengl
Luminance Rs
Type-safe, type-level and stateless Rust graphics framework
Stars: ✭ 632 (-1.1%)
Mutual labels:  opengl, shaders
mozscreenshots
Take screenshots of Mozilla applications in various UI configurations
Stars: ✭ 17 (-97.34%)
Mutual labels:  imagemagick, screenshot
Shadergen
Proof-of-concept library for generating HLSL, GLSL, and Metal shader code from C#,
Stars: ✭ 395 (-38.18%)
Mutual labels:  opengl, shaders
Centerline
Calculate the polygon's centerline
Stars: ✭ 94 (-85.29%)
Mutual labels:  cli, screenshot
Grim
Grab images from a Wayland compositor
Stars: ✭ 533 (-16.59%)
Mutual labels:  cli, screenshot
Renderhelp
⚡️ 可编程渲染管线实现,帮助初学者学习渲染
Stars: ✭ 494 (-22.69%)
Mutual labels:  opengl, shaders
Termuxarch
Experience the pleasure of the Linux command prompt in Android, Chromebook, Fire OS and Windows on smartphone, smartTV, tablet and wearable https://termuxarch.github.io/TermuxArch/
Stars: ✭ 183 (-71.36%)
Mutual labels:  cli, screenshot
Hybridrenderingengine
Clustered Forward/Deferred renderer with Physically Based Shading, Image Based Lighting and a whole lot of OpenGL.
Stars: ✭ 563 (-11.89%)
Mutual labels:  opengl, shaders
Site Scan
CLI for capturing website screenshots, powered by puppeteer.
Stars: ✭ 137 (-78.56%)
Mutual labels:  cli, screenshot
Tinyengine
Tiny OpenGL Wrapper / 3D Engine in C++
Stars: ✭ 251 (-60.72%)
Mutual labels:  opengl, shaders
Galacritty
WIP GTK terminal emulator based on Alacritty
Stars: ✭ 136 (-78.72%)
Mutual labels:  cli, opengl
Slurp
Select a region in a Wayland compositor
Stars: ✭ 350 (-45.23%)
Mutual labels:  cli, screenshot
Foxshot
Capture web page screenshots using headless Firefox!
Stars: ✭ 52 (-91.86%)
Mutual labels:  cli, screenshot
Page2image
📷 page2image is a npm package for taking screenshots which also provides CLI command
Stars: ✭ 66 (-89.67%)
Mutual labels:  cli, screenshot
Ffcast
Run command on rectangular screen regions
Stars: ✭ 478 (-25.2%)
Mutual labels:  cli, screenshot
Imgur Screenshot
Take screenshot selection, upload to imgur. + more cool things
Stars: ✭ 540 (-15.49%)
Mutual labels:  cli, screenshot

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.
  • Move started selection by holding down the space bar.

Practical Applications

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

#!/bin/bash
slop=$(slop -f "%x %y %w %h %g %i") || exit 1
read -r X Y W H G ID < <(echo $slop)
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
slop=$(slop -f "%g") || exit 1
read -r G < <(echo $slop)
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, glew, and glm.

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

Shaders

Slop allows for chained post-processing shaders. Shaders are written in a language called GLSL, and have access to the following data from slop:

GLSL Name Data Type Bound to
mouse vec2 The mouse position on the screen.
desktop sampler2D An upside-down snapshot of the desktop, this doesn't update as the screen changes.
texture sampler2D The current pixel values of slop's frame buffer. Usually just contains the selection rectangle.
screenSize vec2 The dimensions of the screen, where the x value is the width.
position vec2 attribute This contains the vertex data for the rectangle. Only contains (0,0), (1,0), (1,1), and (0,1).
uv vec2 attribute Same as the position, this contians the UV information of each vertex.

The desktop texture is upside-down because flipping it would cost valuable time.

Shaders must be placed in your ${XDG_CONFIG_HOME}/slop directory, where XDG_CONFIG_HOME is typically ~/.config/. This folder won't exist unless you make it yourself.

Shaders are loaded from the --shader flag in slop. They are delimited by commas, and rendered in order from left to right. This way you can combine multiple shaders for interesting effects! For example, slop -rblur1,wiggle would load ~/.config/slop/blur1{.frag,.vert} and ~/.config/slop/wiggle{.frag,.vert}. Then render the selection rectangle twice, each time accumulating the changes from the different shaders.

Enough chatting about it though, here's some example shaders you can copy from shaderexamples to ~/.config/slop to try out!

The files listed to the right of the | are the required files for the command to the left to work correctly.

  • slop -r blur1,blur2 -b 100 | ~/.config/slop/{blur1,blur2}{.frag,.vert}

slop blur

  • slop -r wiggle -b 10 | ~/.config/slop/wiggle{.frag,.vert}

slop animation

And all together now...

  • slop -r blur1,blur2,wiggle -b 50 -c 1,1,1 | ~/.config/slop/{blur1,blur2,wiggle}{.frag,.vert}

slop animation

Finally here's an example of a magnifying glass.

  • slop -r crosshair | ~/.config/slop/crosshair{.frag,.vert}

slop animation

It's fairly easy to adjust how the shaders work by editing them with your favourite text editor. Or even make your own!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].