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).
Install the dependencies:
On debian based operating systems, install with:
sudo apt install slurp grim awk
On debian based operating system, install with:
sudo apt install imagemagick slop awk
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
⤷ 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.
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
}
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
}
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
}