8

I sometimes would like to have my cursor appear as crosshair lines going across the full screen (one vertical line, one horizontal line). I need it because I often look at statistical plots and would like to be able to quickly read an approximate value for a given point.

Is there a simple way of achieving this?

My current system: Ubuntu 16.04 LTS, with Unity.

4
  • That means you'd need to see x y values, right? Not sure how you can retrieve values from a plot by these coordinates though, which are relative to the plot itself. Nov 22, 2018 at 11:11
  • 1
    No, I don't need that. I just want to have two lines going across the full screen which cross at the position where the cursor currently is.
    – January
    Nov 22, 2018 at 11:13
  • What are the stat plot ? png file ? you can use gimp wich has this built-in. Otherwise, you need to look at your plot software to see if it offers the feature you are looking for.
    – solsTiCe
    Nov 22, 2018 at 15:14
  • Well, that's the point, really, all sorts of thing. Usually papers I read – so a PDF, either in a web browser or standalone. I could screenshoot and then use gimp, but the point is to do it quickly, without much ado.
    – January
    Nov 22, 2018 at 19:18

5 Answers 5

11
+500

There was a similar question a couple years ago.

The accept answer has four recommendations:

Best Choice

All four should be investigated but the third suggestion leads to a promising app: Zoom Options Dialog (Universal Access):

ZoomOptions_XhairsTab.png

Figure 2. Zoom Options Dialog showing the "Crosshairs" Tab.

Crosshairs Switch

The switch labelled Crosshairs toggles the display of crosshairs.

Overlaps mouse cursor

When the Overlaps mouse cursor checkbox is checked, the crosshairs intersect the mouse pointer. When unchecked, the crosshairs end before intersecting the mouse cursor.

Thickness

The Thickness slider determines the width of the crosshairs. The range is from 1 to 100 pixels.

Length

The Length slider determines the length of the crosshairs. The range is from very short, through fractions of the size of the screen, to a length that extends to the edges of the screen.

Color

The color button launches a color chooser dialog to set the color and transparency of the crosshairs.


Step by step instructions

Step by step instructions (using Gnome 2.2) were written by the BBC (British Broadcasting Corporation).

Here are a couple of screenshots accompanying the instructions from that site:

orca 1.jpg

orca 2.jpg


Ubuntu Wiki has instructions for installing Orca for Unity and Gnome desktop environments here. However Unity DOES NOT have the Assistive Technology features for Magnifier and Cross Hairs. You MUST use Gnome DE for these features. Source.

Zoom Options Dialog is part of the ÆGIS (Ontario) Project. It is funded and supported by the Ontario Ministry of Economic Development and Innovation and the ÆGIS (Europe) Project. You can also check these websites for more instructions.

4
  • Did you try it out? Which Ubuntu version?
    – January
    Nov 26, 2018 at 12:41
  • I have 16.04 with Orca installed and Unity desktop. However, no orca-magnifier present anywhere.
    – January
    Nov 26, 2018 at 14:51
  • 1
    The Orca version under Unity doesn't include the Gnome Assistive Technology apps for magnifier and mouse cross hairs. Reference: aegis-project.eu/… You need to install Gnome DE and use gsettings set org.gnome.desktop.interface toolkit-accessibility true if not already set. Then go to System Settings, Preferences to access the menu. Reference: ubuntuforums.org/showthread.php?t=1866118 Also Gnome 3.6 & 3.7 seem to have the best modern features that surpass Windows and Mac in many areas except expensive 3rd party stuff. Nov 26, 2018 at 23:45
  • OK, I think that this looks like a solution, even though I am to lazy to actually go through all of these steps. I think that putting an actual ruler against my screen seems simpler in the long run, and has the additional advantage of introducing a cheerful atmosphere in the otherwise bleak lab. Nonetheless, 500 reputation is yours.
    – January
    Nov 28, 2018 at 7:30
8
+500

This is not exactly what you asked but you can use screenruler.

Which is a ruler that you can move on your screen to measure things in pixels. You can rotate it of 90°.

So this is a "manual" method, but you will have what you asked, being able to look for values on plot, but to get both x and y values, you will have to manually rotate the ruler.

2
  • I have rewarded the other answer, because it actually appears to be the exact solution to my problem. However, I am to lazy to even try it, and your solution, good sir, is the simpler way which I decided to actually use. Therefore, you also deserve a bounty, which is why I started a second bounty just to reward you as well. Expect the bounty in a 23 hours.
    – January
    Nov 28, 2018 at 7:47
  • in KDE i found also kruler. screenruler works but bit different
    – SL5net
    Apr 17, 2022 at 9:47
5
  1. Make an image with a transparent background, and a crosshair, sized to fit your screen.
  2. Open it in your favourite image presentation app, or possibly display crosshair.png (display is part of ImageMagick, sudo apt install imagemagick to install it). Use qiv -p YourImage.png to display the image above your other windows. display worked but not as well.
  3. Move by Alt+LMB [LeftMouseButton] clicking on part of the image (you might want to make a handle in the image to make this easier, with my image you have to click on the actual crosshair itself.

Now, bring the image to the foreground by clicking to maximise the window; hide by minimising. Move the image with Alt+mouse. If you get a checkerboard instead of transparency make sure you have compositing enabled in your WM, and that you used the -p flag when launching qiv.

The image: my screen is 1650x1080 so I should use an image that is 3301x2161 this way I have a full screen in each quadrant separated by a 1px crosshair. (Probably you want to make it double that, and have a 3px crosshair to account for anti-aliasing; it can be greyscale and filesize should compress to virtually nothing?)

I made my image as a 96dpi (my screen resolution) PNG, in inkscape, with a 3px wide crosshair at 80% opacity.

Works for me. You could make a shortcut to open the image (running qiv -p /path/to/image). You could also add a pixel scale for measuring.

In use: using this method to display a crosshair over this entry

PNG file: actual PNG file I made for this answer

3
  • xdotool would probably let you move the center of the window with the mouse too.
    – pbhj
    Nov 28, 2018 at 23:35
  • Nice idea! Moving is a bit annoying (I am bad at aiming the pointer, and to move the window I need to grab it with alt-mouse1, which means: hitting this 3 pixels wide area, not easy when you are me)
    – January
    Nov 29, 2018 at 10:08
  • 1
    That's what I meant about adding a "handle" to the image, add a block of colour and you can then target that with your alt+mouse to move it around.
    – pbhj
    Nov 30, 2018 at 15:10
1

If you familiar to create themes and cursors you can try do that. For example, create transparent png file bigger than possible screen resolution x4 times. Then draw in on the middle vertical one-two pixel line and same width horizontal crossing line. Should get something like a huge and thin plus sign "+". Then need to "export" it like cursor file with target in center. If your current dist have no restriction on cursor resolution must work.

2
  • Unfortunately, I have no idea how to create themes and cursors.
    – January
    Nov 14, 2018 at 8:53
  • This was my first thought when I first saw this, I tried, it didn't work: came back (much later) to document that. When I tried to modify a current cursor theme, the cursors were X11 Cursor files (.xmc) and the max size was 256px. GIMP wouldn't save a bigger image as a XMC file. Maybe SVG based cursors would work though.
    – pbhj
    Nov 28, 2018 at 22:27
0

This is something I've wanted for a while. Here's an implementation I wrote today after being inspired by this question (requires Tcl/Tk):

#!/usr/bin/env wish

# Full-screen crosshairs

wm withdraw .

# We use four toplevels as line segments. The horizontal and vertical crosshairs are split to allow click-through.
toplevel .hlineL
toplevel .hlineR
toplevel .vlineT
toplevel .vlineB

set ::period 16 ;# polling period in milliseconds
set ::colour #7F7F7F

foreach line {.hlineL .hlineR .vlineT .vlineB} {
    wm overrideredirect $line 1
    wm attributes $line -topmost 1
    $line config -bg $::colour
}

proc every {ms body} {
    uplevel 1 $body
    after $ms [info level 0]
}

proc moveOffscreen {} {
    foreach line {.hlineL .hlineR .vlineT .vlineB} {
        wm geometry $line 0x0+-1+-1
    }
}

every $::period {
    lassign [winfo pointerxy .] x y
    
    # Handle being on another screen (-1,-1)
    if {$x == -1 || $y == -1} {
        moveOffscreen
    } else {
        # Note special handling of the (literal) edge cases of being at x=0 or y=0 (Tk will draw a pixel there otherwise):
        wm geometry .hlineL ${x}x1+[expr {$x <= 0 ? -1 : 0}]+${y}
        wm geometry .hlineR [expr {[winfo screenwidth .] - $x}]x1+[expr {$x + 1}]+${y}
            
        wm geometry .vlineT 1x${y}+${x}+[expr {$y <= 0 ? -1 : 0}]
        wm geometry .vlineB 1x[expr {[winfo screenheight .] - $y}]+${x}+[expr {$y + 1}]
    }
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .