You can use the feh
image viewer to diplay a transparent image on black or white background in your defined size and position and without window decorations. And then use the wmctrl
command to make it stay on top of all other windows, as shown in this answer.
So an example command (here to hide Spotify visual ads on a 1280x800 screen) looks like this:
sh -c "feh --borderless --title hidemyads --geometry 980x95+302+643 \
--image-bg black /path/to/transparent.png & \
sleep 0.3 && \
wmctrl -r hidemyads -b add,above"
Annotations and explanations:
- To find out the geometry to use, position and resize any window where you want it, and find out its geometry from
wmctrl -lG
output.
wmctrl -r
selects the window where the title matches the supplied string, so we make that string unique by setting the window title in feh
before.
- We need to sleep a bit after
feh
, as there seems to be a short delay until the window manager knows about the new window. Usually 0.1 s is enough, but depending on system load etc. more might be required, so we triple it.
feh
does not yet support configuring the image background color beyond --image-bg black
and --image-bg white
, but if you really want, a patch is available.
- To configure the color, you can of course use an image in that color. But it's not flexible:
feh
always shows the image in original aspect ratio, so you would have to adapt the image aspect ratio to what you want to use in --geometry
.
- The wrapping in
sh -c "…"
follows this technique to make the command also execute in the Alt+F2 launcher (which would otherwise only execute one, at least in LXDE). Also, the wrapping detaches the command from a terminal (so that the feh
window stays open when closing the terminal window).