Hot key to move cursor to center of screen (Solved)

Using applications, configuring, problems
Message
Author
User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#31 Post by Flash »

Okay, okay. Since xbindkeys didn't work in Racy I tried adding to /root/.jwm/jwmrc-personal as you suggested, but I didn't want to have to use multiple keys so I stuck with F10 for this test:

Code: Select all

<!-- Key bindings -->
<Key key="Up">up</Key>
<Key key="Down">down</Key>
<Key key="Right">right</Key>
<Key key="Left">left</Key>
<Key key="h">left</Key>
<Key key="j">down</Key>
<Key key="k">up</Key>
<Key key="l">right</Key>
<Key key="Return">select</Key>
<Key key="Escape">escape</Key>	
<Key key="F12">root:3</Key>

<Key mask="A" key="Tab">next</Key>
<Key mask="A" key="F4">close</Key>
#<Key mask="A" key="F10">maximize</Key>
<Key mask="A" key="F6">minimize</Key>
<Key mask="A" key="#">desktop#</Key>
<Key mask="A" key="F1">root:3</Key>
<Key mask="A" key="F2">window</Key>
<Key key="F10">exec:xdotool mousemove --polar 0 0</key>

</JWM>
This worked after I saved to the DVD and rebooted!

I'd use the *otherwise wasted* Windows key or one of the so-called multimedia keys but how do I put it in there? Using xbindkeys I get this code for one of the multimedia keys: NoSymbol | m:0x0 + c:178. Can I enter that somehow in jwmrc-personal in place of F10?

User avatar
ETP
Posts: 1193
Joined: Tue 19 Oct 2010, 19:55
Location: UK

Hot key to move cursor to center of screen

#32 Post by ETP »

Flash,
1. Backup your savefile just in case of unintended consequences.
2. Open a urxvt terminal, type xev & press enter
3. Briefly press & release the desired windows key.
4. Note the keycode that appears in the two events (press&release)
- In my case this produced 115 - YMMV -
5. Using the keycode that you obtained, if it differs from 115, remove your
code:
ie

Code: Select all

<Key key="F10">exec:xdotool mousemove --polar 0 0</key>
and substitute

Code: Select all

<Key keycode="115">exec:xdotool mousemove --polar 0 0</Key>
6. Restart X
Regards ETP
[url=http://tinyurl.com/pxzq8o9][img]https://s17.postimg.cc/tl19y14y7/You_Tube_signature80px.png[/img][/url]
[url=http://tinyurl.com/kennels2/]Kennels[/url]

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#33 Post by Flash »

That worked! Thanks, ETP and Semme.

Since I run from a multisession DVD I don't need to bother with backing up my Save file before I experiment. It is already backed up, on the DVD. If I do something that breaks my Puppy, I don't save that session and when I reboot, Puppy reverts back to the way it was. :)

Xev reported keycode 115 for my Windows or "super" key, so the entry I added to my jwmrc-personal looks exactly like ETP's, above.

Now I have two keys I can press to center my cursor. :lol: The F10 key works through xbindkeys and xdotool, and the Windows key works more directly, through /root/.jwm/jwmrc-personal and xdotool.

So if you're using JWM, you can just install xdotool and make an entry in jwmrc-personal. If you're using a different window manager from JWM, then you may have to also install and use xbindkeys.

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#34 Post by Semme »

Great! Now get rid of that :wink: *mostly* bit..

User avatar
ETP
Posts: 1193
Joined: Tue 19 Oct 2010, 19:55
Location: UK

#35 Post by ETP »

Flash,
Très bien. Take a pew, break out the virtual pizza and chill out to the following video with your personal theme tune!

http://megaswf.com/serve/1201787
Regards ETP
[url=http://tinyurl.com/pxzq8o9][img]https://s17.postimg.cc/tl19y14y7/You_Tube_signature80px.png[/img][/url]
[url=http://tinyurl.com/kennels2/]Kennels[/url]

User avatar
charlie6
Posts: 1230
Joined: Mon 30 Jun 2008, 04:03
Location: Saint-Gérard / Walloon part of Belgium

Ctrl+Shift+m stands for Ctrl+Shift+? on belgian keyboards

#36 Post by charlie6 »

Hi all, :)
just discovered this post:

- using vividdpup OOTB on a hp2530 laptop: pressing Fn+F4 keys moves the cursor to the center of the screen.

-using tahrpup64 + xdotool + edited .jwmrcpersonal as above (Ctrl+Shift+m keys) does not work BUT as i'm using a be-latin1 keyboard ... the «m» key stands for the «?» on my belgian keyboard: so i have to press Ctrl+Shift+? to get the above working... :)

Thanks again !
Cheers !
HTH the french as belgian users !
Charlie

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

Re: Hot key to move cursor to center of screen (Solved)

#37 Post by MochiMoppel »

A recent link brought me to this old and solved thread. I just want to add another idea
Flash wrote: I'm forever running my mouse in circles to find the cursor. Maybe it would save time if I could move the cursor to a known location with a function key.
To me the question is not how to move the cursor to the center. Flash's real problem is to find the cursor.

Somewhere someone (drunkjedi?) mentioned the Windows accessibility tool that would draw circles around the curser to make it more visible. This would not move the cursor and still would help to locate it.

It doesn't need special tools like xdotools to place a window at the current cursor position.
This little script (let's name it findmouse) places an icon at the cursor position. Doesn't look like a window, but it is. It closes when the user moves the mouse. Alternatively closing with Alt+F4 wouldn't require to move the cursor at all.

Code: Select all

#!/bin/sh
echo '
<window type-hint="6" skip_taskbar_hint="true"  window-position="2">
<pixmap><input file>/usr/local/lib/X11/pixmaps/info.xpm</input></pixmap>
<action signal="leave-notify-event">exit:</action>
</window>' | gtkdialog -s
Assuming that the script was saved in /usr/bin it can then be called with a keyboard shortcut, e.g. Alt+Spacebar:
In /root/.jwm/jwmrc-personal this keybinding works for me:

Code: Select all

<Key keycode="65" mask="A">exec:findmouse</Key>
Attachments
findmouse.jpg
(89.8 KiB) Downloaded 123 times

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#38 Post by Flash »

Thanks, MochiMoppel. You're right; my problem was finding the cursor. The easiest way I could think of to do that was to move it to the center of the screen. Easy to find it there. Your way is probably better or at least as good. I'll give it a try. :)

Jeez, I started this thread seven years ago? :shock:

Post Reply