Slashdot Mirror


X With No Mouse Cursor

innocent_white_lamb writes "I am using an X-based menu that doesn't recognize a mouse. Keyboard input only. I load the menu with the command "startx -e menu", which loads the menu and gets stuff going without any need for a window manager. The problem is that the mouse cursor sits in the middle of the screen and, without a mouse attached, there appears to be no way to move it or get rid of it. I've asked around and nobody seems to have run into this situation before. So my question is, how do you get rid of the mouse cursor under X without using a window manager?"

46 comments

  1. XFREE 4.3 by YOU+ARE+SO+FIRED! · · Score: 2, Insightful

    Make a cursor theme that makes the cursor invisible or a single pixel or something. That's the easy way. And you're fired.

    1. Re:XFREE 4.3 by bugeye1959 · · Score: 1

      I work for a company that makes touchscreen based equipment that runs Linux. We used the cursor editor package xmbdfed-4.5-2 to create a new cursor that was invisible.

  2. Use the force Luke! by Ashran · · Score: 4, Informative

    Set the X/Y init position somewhere off the screen and recompile.

    --

    Before you email me, remember: "There is no god!"
    1. Re:Use the force Luke! by Henry+V+.009 · · Score: 4, Funny

      But it's still there. The entire time you're using the system, you know the pointer is there, just beyond your awareness, lurking. You can almost hear the phantom 'click-click' in your head as you work. Your mind creates false images, convincing you that you've glimpsed it from the corner of your eye. Finally, you take the monitor in your two hands and crash it into the wall, screaming: "I know you're in there!" You shake in rage as you rustle through the broken components looking for the little white group of pixels.

      Ah...let's just say that your suggestion didn't work for me.

    2. Re:Use the force Luke! by Permission+Denied · · Score: 1
      Set the X/Y init position somewhere off the screen and recompile.

      Not possible. Try it:

      #include <X11/Xlib.h>

      int main()
      {
      Display *dpy = XOpenDisplay(NULL);
      XWarpPointer(dpy, None, DefaultRootWindow(dpy), 0, 0, 0, 0, 500, 500);
      XFlush(dpy);
      sleep(5);
      XWarpPointer(dpy, None, DefaultRootWindow(dpy), 0, 0, 0, 0, 5000, 5000);
      XFlush(dpy);
      sleep(5);
      return 0;
      }

      You'll see it pause at (500, 500) for five seconds and then go to the bottom-right edge of the screen. You can't move the mouse cursor off-screen in X11.

  3. unclutter by halfnerd · · Score: 3, Informative

    unclutter does the job for you

    1. Re:unclutter by halfnerd · · Score: 4, Informative

      Even found you an url:
      http://packages.debian.org/stable/x11/unclut ter.ht ml

    2. Re:unclutter by yandros · · Score: 1

      Unclutter should certainly do the job. Another generally useful tool for this sort of thing is `xwit', the `X Window Interface Tool', which can change the pointer location (as well as [un]iconify, raise/lower, and resize windows, etc.) from the command line.

  4. change the cursor by dj.delorie · · Score: 5, Informative
    xfd -fn cursor

    then choose a cursor that's blank as the default. Or substitute a cursor font that's nothing but blanks.

  5. Moving the cursor without a mouse by ion_ · · Score: 5, Informative

    without a mouse attached, there appears to be no way to move it or get rid of it.

    You can move the cursor by pressing Ctrl-Shift-Num Lock and then using the numpad. You move the cursor with the keys around 5, click with 5, etc. A quick googling brought up this webpage.

    1. Re:Moving the cursor without a mouse by dotgain · · Score: 1
      Thanks for the tip, will come in handy next time my USB "intelli" mouse disconnects itself and reconnects itself 10E-12 seconds later, since Linux input doesn't support the "hotplugging" my mouse seems to do every 10 days or so.

      I actually put an adapter on it and plugged it into the ps2 port simply to avooid this problem.

      Anyway, this won't solve the posters problem immediately, but it would probably be trivial to allow a -nomouse feature in the next version of X. *NEWS FLASH* X4.3.0 released! D'oh. Oh well, maybe the next one then.

  6. Just write a small program by metalhed77 · · Score: 4, Informative

    that uses XWarpPointer[sic] to move the pointer wherever on boot.

    --
    Photos.
    1. Re:Just write a small program by sforman · · Score: 2, Informative

      or just use this one

  7. The obvious answer by WIAKywbfatw · · Score: 3, Funny

    So my question is, how do you get rid of the mouse cursor under X without using a window manager?

    Get a cat cursor to chase it away!

    --

    "Accept that some days you are the pigeon, and some days you are the statue." - David Brent, Wernham Hogg
    1. Re:The obvious answer by seann · · Score: 1

      cat "mouse" > /dev/psaux

      --
      I'm a big retard who forgot to log out of Slashdot on Mike's computer! LOOK AT ME.
    2. Re:The obvious answer by d3vpsaux · · Score: 1

      I will not accept this. At all.

      the REAL /dev/psaux - d3vpsaux

  8. Re:Unthoughtful... by xenocytekron · · Score: 0, Flamebait

    innocent_white_lamb writes "I am using an X-based menu that doesn't recognize a mouse. Keyboard input only. He can't "just plug in a mouse". RTFA

    --
    This is my .sig, if you don't like it, it will eat you.
  9. Re:Unthoughtful... by Anonymous Coward · · Score: 0

    What happened to choice is what makes Open Source/ Free Software/ Linux so great?

    Maybe you meant to say, choice makes it great as long as you use it in one of our approved ways.

    A big fuck you to everyone who tries to rewrite someone's problem instead of helping them solve it. Great community.

  10. Config by Apreche · · Score: 1

    Can't you go into /etc/X11/XF86Config (or /etc/X11/XF86Config-4) and comment out all the lines

    Section "InputDevice"
    Identifier "Mouse1"
    blah blah blah

    EndSection

    I think that might do it.

    --
    The GeekNights podcast is going strong. Listen!
    1. Re:Config by CableModemSniper · · Score: 1

      I believe that's his point. He has no configured mouse (intetional) yet X still sticks a cursor in the center of the screen.

      --
      Why not fork?
    2. Re:Config by dotgain · · Score: 1

      It won't solve the posters problem, because the pointer will still be there. His problem is not getting X to start, but getting rid of the pointer. BTW, I think you need an "AllowMouseOpenFail" or something similar in the ServerLayout section, to get X to start even if it can't find a mouse device. I only needed to use this one, a while ago.

  11. from XJ.cpp in the mythtv distribution by benwb · · Score: 4, Informative

    void XvVideoOutput::hide_cursor(void)
    {
    Cursor no_ptr;
    Pixmap bm_no;
    XColor black, dummy;
    Colormap colormap;
    static char no_data[] = { 0,0,0,0,0,0,0,0 };

    colormap = DefaultColormap(XJ_disp, DefaultScreen(XJ_disp));
    XAllocNamedColor(XJ_disp, colormap, "black", &black, &dummy);
    bm_no = XCreateBitmapFromData(XJ_disp, XJ_win, no_data, 8, 8);
    no_ptr = XCreatePixmapCursor(XJ_disp, bm_no, bm_no, &black, &black, 0, 0);

    XDefineCursor(XJ_disp, XJ_win, no_ptr);
    XFreeCursor(XJ_disp, no_ptr);
    }

  12. Answers (google is your friend) by mcelrath · · Score: 1

    First of all, hit ctrl-shift-numlock. Then you can use the numeric keypad to move the mouse cursor (probably to the lower right where it is not visible). Second of all, you might be able to find a way to change the cursor pixmap/bitmap to be transparent. It can be done via an X API call, but I don't know if there are any command line utilities that will do it for you. -- Bob

    --
    1^2=1; (-1)^2=1; 1^2=(-1)^2; 1=-1; 1=0.
  13. i do that all the time by zephc · · Score: 1

    whenever GDM crashes

    [/joke]

    --
    "I would say that 99 per cent of what my father has written about his own life is false." - L. Ron Hubbard Jr.
  14. how many cents? by gid13 · · Score: 1

    For the record, e^(i*pi)=cos(i*pi)+isin(i*pi) =-1+0 =-1 so e^(i*pi)+1=0... so why are you giving us zero cents? :)

  15. Re:Unthoughtful... by Anonymous Coward · · Score: 0

    I was just joking. But if you want to get technical... The article doesn't say that the system doesn't support the mouse, only that the menu doesn't.

    As in there is no need for a window manager because the system is dedicated to a single purpose. My guess is running the menu. That doesn't support a mouse.

    So he asks himself, "why connect a mouse if the application on my single-purpose computer doesn't even use one?" So then he doesn't. And then there's the mouse cursor in the middle of the screen. So he posts an article on Slashdot. On the same page so far?

    At no point does not system not support a mouse. Your reply makes no sense. Flame away if you don't see the humor, but please try to make sense.

  16. Problem solved by Permission+Denied · · Score: 3, Informative
    Start up the program "bitmap" that comes standard with XFree86. It starts with an empty bitmap. Save the empty bitmap to "empty.xbm." Click the "invert" button to set all the pixels in the bitmap. Save this bitmap to "full.xbm."

    Now type:

    xsetroot -cursor empty.xbm full.xbm
    This changes the root cursor to the empty bitmap you just created.

    Instead of "startx -e menu" write a shell script with two lines:

    #!/bin/sh
    xsetroot -cursor /path/to/empty.xbm /path/to/full.xbm
    exec menu
    Have "startx" execute this script, or simply make this script your .xinitrc.

    Problem solved.

    However, if the "menu" program you speak of does not simply inherit the root window's cursor (default behaviour), you will need either to modify the program to do so (eg, comment out the cursor-setting lines, grep for XSetWindowAttributes or XDefineCursor), or to modify your cursor font so the cursor it uses is the blank one you created. If the program creates its own cursor rather than using a standard cursor from the cursor font, you need to modify the source. It's probably much easier to modify the source anyway, since it only takes a grep and a recompile, whereas if you want to modify your cursor font, you have to find some font editing program and deal with someone's idea of a usable graphical interface.

    If you don't have source to your program, you'll need to break out the hex editor. If this is the case and you don't know i386 asm, post a URL to the program.

  17. Re:Problem solved - CORRECTION by Permission+Denied · · Score: 1
    Instead of:
    xsetroot -cursor /path/to/empty.xbm /path/to/full.xbm
    Use:
    xsetroot -cursor /path/to/full.xbm /path/to/empty.xbm
    My fault - should have tried it before I wrote. Also works the same if you use "empty.xbm" for both arguments (you want the mask to be empty so no part of cursor shows through).
  18. Check the mplayer sources. by Gadzinka · · Score: 3, Interesting

    Just check the mplayer sources.

    I don't know if what mplayer does is pure X stuff or if it talks window manager into hiding mouse cursor. But when you move mouse cursor into mplayer video window it disapears after a while.

    Just check the sources and see if you can implement the same in your menu program. But beware, mplayer is GPL so if you use this code directly you would have to license your program GPL too.

    You can of course check what it is doing and reimplement it.

    Robert

    --
    Bastard Operator From 193.219.28.162
  19. Invisible cursor by BESTouff · · Score: 2, Informative
    Here is your invisible cursor:
    • Create a file named emptycursor containing:
      #define nn1_width 16
      #define nn1_height 16
      static unsigned char nn1_bits[] = {
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
    • type this command:
      xsetroot -cursor emptycursor emptycursor
    • Profit !
    1. Re:Invisible cursor by dsb3 · · Score: 1

      If you just tried that (like me) and didn't realize your cursor *HAD* disappeared until you moved it out of your browser window, try this:

      $ xsetroot -cursor_name left_ptr

      ah. much better.

      --

      Slashdot? Oh, I just read it for the articles.
  20. pi i by jbolden · · Score: 1

    Why go to all that trouble using the trig expansion you can do this directly. pi radians on the unit circle is the point (-1,0) ~ -1 + 0i....

  21. a botched appleotomy by epine · · Score: 5, Interesting

    A long time ago, at a time in my life when I had more money than brains, I bought myself a Fat Mac with 512K memory and two floppy disk drives the day this model first hit the streets in Toronto.

    My girlfriend at the time (I guess there is an upside to having more money than brains) needed to conduct an experiment in cognitive psychogology to complete her undergraduate philosophy degree.

    She decided to conduct an experiment in reading comprehension. Both groups were asked to read the text, but with different reading instructions. One group was instructed to proofread the text, the other group was instructed to read for comprehension.

    We decided that programming this experiment for my new Mac would automate the timing controls, automatically measure the proofing reading results (how many words were marked with a mouse click), to collect the multiple choice results, and record the text of a written response question (in a dialog box roughly as feeble and distigusting as the web form input box used to compose posts for slashdot twenty years later).

    When I showed her the first version, her remark was this, "you have to remove the menu bar or I'll fail". I could see her point. For an experiment in reading comprehension you want to control every word of text presented to the subject. Her professor would see it the same way.

    At this point I should have pulled out a roll of duct tape, sliced off a half inch think strip, and covered over the top half inch of the display.

    But ego prevailed. Surely, I thought, I just need to read the big Apple developer guide phone book thing to find the right flag to the right system call to remove the menu bar.

    Thus began three weeks in hell.

    The only way I could find to suppress the menu bar was to skip the initial call to some of the Apple windowing subsystems. It seemed to work. But then my program began to crash in dozens of mysterious and different ways. Eventually I learned that the call I had skipped initialized data structures required by many other subsystems.

    Then I found other system calls that would hide the menu bar temporarily. But the nasty thing would reappear randomly as the user performed mouse actions. No matter what I tried, the cat came back.

    Within a few months I several other frustrating encounters with the Mac architecture. I grew to despise the architecture of the Mac windowing system. I thought I could escape from Pascal hell by installing the Aztec C compiler. I was instantly much happier, but it wasn't a productive situation because the underlying C to Pascal mapping was full of bugs.

    Then I was forced to buy an 8MHz PC for a programming contract. I put the hideously Fat Mac into a closet and I can barely recall using it since. I made one effort to salvage my investment by inquiring about the cost of a making a modification to install an internal hard drive, but the price was outrageous (almost as much as the entire turbo PC I bought instead).

    Thanks to Apple, I learned a extremely valuable lesson about decoupling policy from implementation. One man's policy (Steve's) is another man's hell (mine).

    Twenty years later, I never complain about X Windows. At least I know that this of kind of question *can* be answered.

    Gawd I hated that machine. And it turned out the girlfriend wasn't much better.

    1. Re:a botched appleotomy by Permission+Denied · · Score: 1

      Great story - made my day :)

    2. Re:a botched appleotomy by Anonymous Coward · · Score: 0
      And it turned out the girlfriend wasn't much better.

      Yea...I had her, too, and she sucked, or rather, didn't. I ended up having to forcibly face-fuck her.

    3. Re:a botched appleotomy by Mignon · · Score: 1
      A long time ago ... I bought myself a Fat Mac with 512K memory and two floppy disk drives ... [pain and suffering ensued] ... Twenty years later, I never complain about X Windows.

      Cool story, but let's be honest guys (and gals), it's too technical for a "Switch" ad.

  22. Alternatively... by leonbrooks · · Score: 1

    You could XWarpCursor it to a position off the screen.

    --
    Got time? Spend some of it coding or testing
  23. NOT OFFTOPIC by Anonymous Coward · · Score: 0

    quite a relevant anecdote actually...

    1. Re:NOT OFFTOPIC by Anonymous Coward · · Score: 0

      Actually it is off topic. Evidently you proofread it and I read for comprehension. That message was praise for X being modifiable and the topic is how to hide the cursor.

  24. Re: your sig by twiztidlojik · · Score: 1

    Wouldn't it be:
    |1|=|-1|; 1=1
    ?

    Just curious how you got -1^2 = -1.

    --
    I will now redundantly add my name to the end of my post. You know, in case you forgot me or something.
  25. Re: your sig by mcelrath · · Score: 1

    Well it's sqrt(1) = +/- 1. And that is the error.

    --
    1^2=1; (-1)^2=1; 1^2=(-1)^2; 1=-1; 1=0.
  26. Re: your sig by twiztidlojik · · Score: 1

    But...but...square roots are always positive!

    NOOOOOOOOOOOOOO! /me self destructs in a cloud of high school algebra II

    --
    I will now redundantly add my name to the end of my post. You know, in case you forgot me or something.
  27. Re:a botched appleotomy (hiding the menu bar) by big_pianist · · Score: 1

    It can be done. Obviously.

    If, god forbid, you ever find yourself playing with an old mac again, this may be of some use:

    There is a system-wide global variable which holds the menu bar height on 68K macs and maps to $0BAA, part of the non-volatile PRAM. It determines how many scanlines the menu bar will occupy on screen.

    Unfortunately it is not as simple as setting this to zero (like the toolbox calls does). Although the menu manager will not draw beyond that line, the window manager is not aware that is it allowed to draw where the menu bar used to be. The dirty solution is to just union the old menu rect with the desktop "GrayRgn" (Of course this doesn't preserve those "cute" rounded screen edges. Ugh.)

    After that, you'll need to fire off a paint event to every window on the screen. (Although a paintone/paintbehind event pair to the foreground window will work just as well.)

    *sigh* What useless knowledge...

  28. Re:Problem solved - Better still - camouflage by p4ul13 · · Score: 1
    Change the background image of your application / destop to a repeating image of a mouse cursor. Sheesh, lets keep it simple here...

    =)

    --
    Paul Lenhart writes words!