Code Monkey home page Code Monkey logo

pixelchanged's Introduction

pixelchanged

GitHub Release

pixelchanged is a simple bash script to detect changes in a region of your screen and execute commands when the change happens.

pixelchanged.mp4

pixelchanged works in linux (wayland and x11).

Installation

Dependencies

Install the dependencies:

Wayland

On debian based operating systems, install with:

sudo apt install slurp grim awk

X11

On debian based operating system, install with:

sudo apt install imagemagick slop awk

Install script

curl -LO https://raw.githubusercontent.com/revelaction/pixelchanged/master/pixelchanged.sh 
# make it executable
chmod +x pixelchanged.sh
# copy it to your path
cp pixelchanged.sh ~/bin

Usage

⤷ pixelchanged.sh
Please select a region of the screen
Selected region: 100x101+2346+397. Desktop type: x11

📡 Starting monitoring for changes of the selected region each 10 seconds.

Examples

Desktop notification

Per default, the script creates a desktop notification when it detects a change in the selected region.

change_handler()
{
    # put commands here that are executed when a change in the pixel happens
    notify_desktop
    # play_sound
}

Play sound

To play a sound when the selected region changes just substitute the path to a music file in the play_sound function.

play_sound()
{
    check_command "cvlc"
    cvlc --play-and-exit <your-path-to-a-sound-file>.opus
}

and uncomment the call to the function in change_handler

change_handler()
{
    # put commands here that are executed when a change in the pixel happens
    # notify_desktop
    play_sound
}

Customize

Modify the script to run arbitrary commands by first creating a bash function:

my_commands()
{
    # my commands
}

Add the function call to the change_handler function:

change_handler()
{
    # put your commands function here 
    my_commands

    # notify_desktop
    # play_sound
}

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.