Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

xdotools gives the ability to insert text at the current text insertion point, but it doesn't seem(?) to have an option which gets the actual screen x,y co-ordinates... Is there any such program? ... the reason is: I want the mouse to jump to the current text insertion point.. ie to the text-cursor..

share|improve this question
    
xev will do it, if you put it's little window, over the area ish that you want. Unfortunately this seems a poor way to do things. –  xenoterracide Apr 25 '11 at 17:27
    
@xenoterracide: It seems useful for dynamically following events, and could be suitable if my intention was to constantly follow the text insertion point, but I'm actually wanting the mouse to jump there on-demand via a shortcut key. I'm really after one-off current-status values; just like the mouse-pointer x,y stats... but thanks none-the-less; it's good to know about 'xev'.. maybe it is in some "X-goemetry" setting –  Peter.O Apr 25 '11 at 18:46
    
I notice the bash tag. Are you trying to use the mouse at the bash prompt? If so, what you want is xterm mouse reporting, i.e. the terminal transmits mouse click information to the application running inside it. (I think bash mouse reporting has been implemented already.) –  Gilles Apr 25 '11 at 21:03
add comment

1 Answer

up vote 1 down vote accepted

I'm pretty sure there's no way to do this in full generality, because text cursors are an application feature, not a server feature like mouse cursors. The application decides where to place input based on its internal data structures, and the text cursor is a way to tell the user what it's going to do with the input. As far as the X server is concerned, there's a focused window and that's it; the focused window does whatever it likes with the input.

Now I can't think of an application that actually has more than one text cursor, in an abstract UI sense (some have none, of course). But unless the application has an interface to tell others where the text cursor, or the text cursor is visually distinctive, I don't think you can get at it.

share|improve this answer
    
Thanks Gilles... That makes sense... Now that you've mentioned it, it seems quite "expected", because all xdotool does is send keystroke messages to the window, and then the app takes over and (I assume) would then tells X, "I'm want you to display "this text" in "this edit-field"... okay, I can let this on go now :) .... btw. a more appropriate tag may be "scripting" or "shell-scripting"; I did mean it for X apps in general... and I wanted to wrap an existing tool in a bash-script –  Peter.O Apr 25 '11 at 22:53
    
@gilles @fred given xev and a few other features of kwin, I'm sure it can be done... but I'm not sure it exists. might have to write the program to do it. –  xenoterracide Apr 26 '11 at 1:11
    
@xenoterracide: interesting, but I was after something that was directly hooked in to X, ie. generic... needing to rely on kwin would take me out of G into K ;) ... but you've got me thinking about it now, and I recall reading the other day about an app which moves the mouse directly to the active button (probably an acceddiblity app).. that's getting close to the mark.. I can't recall what it was called.. but maybe it too is desktop-manager dependent.. –  Peter.O Apr 27 '11 at 4:12
    
@xenoterracide: thanks, Needing to rely on a specific desktop manager won't really suit (especially as I don't use kwim ;)... Your comment has got me thinking about this again, and I recalll reading recently about an app which moves the mouse to the "current" button (possibly an accessibility app). It reminded me of somethin I tried in Windows once, but found it to be "un-settling"... That behaviour seems to put it into the right category, but I can't recall its name, and maybe it too relies on a particular desktop... –  Peter.O Apr 27 '11 at 4:20
    
@fred not saying you'd need to rely on kwin, I've just seen stuff it does that's similar. So i'm sure what you're trying to do can be done, I just don't know if anyone ever has. –  xenoterracide Apr 27 '11 at 6:34
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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