13

For making documentation/tutorial videos, I need to highlight the mouse, for example with a yellow translucent corona around it:

enter image description here

The marker should be active when clicking and moving, but if it's on all the time, that's just as fine.

It can obscure the view on what is behind it to some degree but it may not disable being able to click what is behind it or take focus away from windows.

Compiz seems like a thing of the past, find-cursor isn't tied to any actions (clicks/movements) and blocks interaction (while it's drawing, you can't click "through" it) and key-mon doesn't draw correctly, disables interaction as well and is generally buggy when it comes to the mouse highlighter, at least with a tiling window manager.

I'm using Arch Linux and awesome wm.

Thanks!

  • For the record, I've had similar issues with key-mon on a non-tiling wm (openbox). – gandalf3 Mar 8 '16 at 3:30
  • Install a custom mouse theme. Works all the time. More details in my answer below. – clearkimura Mar 13 '16 at 18:51
5
+50

Use a custom mouse theme that follows the XDG specification.

This could be the easiest way to introduce the marker. I suppose this just adds a translucent circle layer to the cursor or simpler. Even better, this approach will most likely applicable for both X11 and Wayland cursor themes, as noted in this ArchWiki.

How to create mouse theme

Do we have to create the custom mouse theme? Yes, if the user prefers to create one by own. This could be time consuming and most users will need to do some readings.

The most recent discussion on "creating icon themes" is circa 2015, which is found in this thread on Linux.org. It covers little bit on cursors and generously provides more links for further reading.

Several older tutorials circa 2010 mentioned this GIMP plug-in for creating X11 mouse cursor (XMC). Another approach is using Xcursorgen program, which is explained in this article on ehow.com.

Or without creating theme

Then again, do we need to create one? No, because some users already created such themes. Most users will just have to search, download and install it.

I found that DMZ-Highlight by MBOSSG is a simple and elegant solution.

It is a custom mouse theme for Ubuntu/Linux that has translucent yellow circle below the cursor, which is almost exactly what the question had described. As the name hints, DMZ-Highlight (left) is based on DMZ white variant from DMZ cursor themes.

DMZ-Highlight and DMZ white compared

Does DMZ-Hightlight work?

  • highlighted marker: Yes
  • translucent yellow: Yes
  • active marker: Yes, when clicking and moving ^1
  • disable clicking: No ^2
  • steal focus: No ^2

^1: visible all the time for most UI elements, except text input will show the usual I cursor

DMZ-Highlight against Mousepad

^2: the mouse theme neither obstructs nor takes focus away from windows, just the usual cursor with a highlight under it

DMZ-Highlight against UI elements and desktop

Disclaimer: This answer is intended to suggest the easiest way to introduce the marker on cursor. As such, this answer shall not explain on "how to install mouse theme" (This should be covered by a separate question and answer).

The author of DMZ-Highlight had provided install and uninstall scripts, which are convenient for Ubuntu users. In my case, the cursor was manually installed and configured via sudo update-alternative commands, as I prefer this way.

Tested DMZ-Highlight in Xubuntu 14.04 (Xfce 4.10).

TL;DR Install a custom mouse theme, which will highlight the cursor. Zero scripts, works all the time.

  • Strangely that theme doesn't display the transparent yellow circle for me, but does change the mouse cursor. Not sure what's going on there.. This looks perfect, but I am worried that it won't be captured by some screen recording programs that don't support capturing the cursor (one of the main reasons I'm looking for this). – gandalf3 Mar 14 '16 at 23:29
  • I have confirmed DMZ-Highlight works in both compositing/non-compositing Xfce 4.10; The highlight is translucent and visible when screencast using vokoscreen 1.9.0 (using libav-tools), Xubuntu 14.04. – clearkimura Mar 15 '16 at 9:30
3

While the DMZ-Highlight theme suggested above works for the basic arrow pointer, non of the other cursors are highlighted.

Frustrated by this I wrote a short program that applies a similar highlight to all cursors for a given theme.

For those who don't want to compile and run it I've also included the results of running the program against the DMZ-White cursors, creating so to say an updated version of the DMZ-Highlight theme where all cursors are highlighted

Highlighted cursors

  • Thank you for your sharing. Without your permission first, I adopted your provided theme to make it easier for installation at github.com/iPAS/DMZ-White-Highlighted. – iPAS Apr 7 at 7:29
  • @iPAS happy to see that my work inspired you! – DhatGuy Apr 10 at 10:09
0

After looking for the same functionality (because of some VNC-like software that doesn't show the cursor), I used the solution from the answer https://unix.stackexchange.com/a/228674 and added the functionality (https://github.com/arp242/find-cursor/pull/15).

-1

Did you try what is detailed in this answer to a similar question? https://unix.stackexchange.com/a/183941/141220

You have Arch and an uncommon wm so you probably knew you had to do some hacking on your own.

reposting here, this comes from the link above, if it works don't forget to thank the user mikeserv too, as I'm mostly a messenger here.


The following will probably work for you:

#!/bin/sh
unset X Y; sleep 1
eval "$(xdotool getmouselocation -shell 2>/dev/null)"
for n in X Y; do  : "$(($n-=$n>25?25:$n))"; done
xwd -root -silent |
xv -    -crop "$X" "$Y" 50 50 \
        -geometry "50x50+$X+$Y" \
        -nodecor -viewonly -rv -quit

It depends on the three utilities xv, xwd, and xdotool. The first two are very common X utilities, and the third I'm reasonably sure you already have.

After sleeping one second, xdotool writes the mouse's current coordinates to its stdout in an eval-friendly -shell format like:

X=[num]
Y=[num]
windowID=[num]

eval sets the shell variables accordingly, and the for loop subtracts half of the soon-to-be-displayed image's size from each of $X and $Y's values or, if either value is less than 25, sets them to 0.

xwd dumps the root window over a pipe to xv, which crops around the mouse location to an image size of 50x50 and displays a negative of the image under the current mouse cursor in a little window sans any window manager decorations.

The end result is something like this:

enter image description here

...though I guess my mouse cursor doesn't show-up in screen shots. Rest assured, though, it was right over the white box there when I took the picture.

You can see in the image how I also wrote it as a shell function and backgrounded it. It is mainly for that reason there is a sleep in there at all - pressing the RETURN key will scroll the terminal if you're already at the bottom, and xwd was fast enough to grab its picture of the screen before the terminal scrolled - which would offset my negative in the image a little and I didn't like it.

Anyway, because xv is run with both the -viewonly and -quit switches, it will disappear as soon as a mouse-button is clicked or a keyboard key is pressed - but will remain until you do either.

Undoubtedly you could do much more elaborate things with ImageMagick or even xv alone as well - but I just did a little negative box under the mouse cursor. You can find the xv docs here and the docs for xwd in man xwd.

  • 1
    Interesting, but doesn't seem to meet the OP's requirements. The window this makes blocks clicks, and doesn't follow the cursor as it moves. – gandalf3 Mar 9 '16 at 21:19
  • this script has to be put in a loop with a suitable 'sleep', probably. As it is now of course it does only print a single image, duh. – bobafetthotmail Mar 11 '16 at 9:03
  • as for the blocking clicks, I think you need to play with the -root option in xv, as that forces it to not open its own x window on top of stuff. But then it cannot sense clicks (the whole point here), so you will need to have the script terminate it and restart it manually in a loop. Look into the "Root Window Options" in the docs structbio.vanderbilt.edu/chazin/wisdom/xv-3.10a/… – bobafetthotmail Mar 11 '16 at 9:21
  • 1
    I can't imagine performance will be very great when just dumping the whole script into a loop.. Even without the sleep the window takes nearly half a second to appear on my machine. – gandalf3 Mar 12 '16 at 3:48
  • Drawing to the root window doesn't allow drawing on top of other windows AFAIK.. At least that appears to be the case after a quick test. – gandalf3 Mar 12 '16 at 3:49

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.