Are there any command line tools that can draw simple graphics on the screen, then be able to later clear/erase those drawn graphics?

It would be useful to highlight a section on the screen or overlay an opaque rectangle on a window. Then be able to clear the graphics later on.

  • If you look at sloop github documentation at the MAIN page, there are some examples of slop commands like: slop -r blur1,blur2 -b 100 | ~/.config/slop/{blur1,blur2}{.frag,.vert}. Are you sure slop only works with a mouse? – user34720 Jun 6 '17 at 20:47
  • But, then slop blocks/waits for mouse actions. I removed slop from the question since that led to confusion. Sorry about that. – dgo.a Jun 7 '17 at 2:18
  • The thing is that the X model requires redraw on expose events, so you can't just draw anything and expect it to stay there. The application that draws it needs to be running all the time (and of course it'll have to wait for some kind of event to decide when it can finish). You need some way to communicate with a running application to modify what it does, and that's not very scriptable. It also sounds like an X-Y problem: What do you actually want to achieve this way? – dirkt Jun 7 '17 at 5:46
  • @dirkt The question was asked out of curiosity. But, thanks for clearing that up. – dgo.a Jun 7 '17 at 5:52

Lemonbar might be one way to do it. Even though it's meant to be used for HUD functionality, it can draw empty rectangles on the screen:

# Draw a rectangle on the screen,
#   then have it disappear after 3 seconds:  
{ echo "" && sleep 3; } | lemonbar -n "my_lemonbar" -g 200x200+40+40 -B '#88000000'

# or for something more persistent

( echo "" | lemonbar -p -n my_lemonbar -g 200x200+40+40 -B '#88000000' ) &
# Then, to remove the box:
pgrep -f "lemonbar .+ -n my_lemonbar"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.