mouse

How to jump to a screen location using a mouse click with iTerm2?

When using iTerm2, if you’re editing a file with vim and want to jump to a specific location in the file using a mouse click, just hold down the [Option] key when you do a normal left mouse click. That will take you to the location directly under the mouse cursor. (Unless the mouse cursor is beyond the end of the line. In that case the text cursor will be moved to the end of that line.)

I mention vim here because I just learned about this when using vim, but you should be able to use this with any app when using iTerm2. This is an iTerm2 feature (not a vim feature).

A Scala shell script to move your mouse cursor

I’m currently trying to automate a GUI task, and as a part of that, one thing I need to do is move the mouse cursor.

In short, the solution I came up with was to write a Scala shell script that uses the Java Robot class to move the mouse. Here’s the source code for my script, which I named MoveMouse.sh:

Lightsaber

Lightsaber is a free, open source application for Mac OS X systems that plays “lightsaber” sound effects as you move your mouse. Once Lightsaber is running, you can switch to any other application, and Lightsaber will play the sound effects when you move your mouse.

Note: Lightsaber has been tested on Mac OS X 10.9 (“Mavericks”) and 10.10 (“Yosemite”) systems. (It may also run on OS X 10.7 and 10.8, but I don’t have any computers running those older operating systems, so I can’t verify that at this time.)

Mac OS X mouse cursor/pointer size

I haven’t figured out the exact issue yet, but ever since I (a) switched to Mac OS X 10.9 and (b) added a second monitor to my old iMac, the mouse pointer/cursor seems to disappear from time to time. Actually, I can’t tell what it’s doing, so I move the mouse around frantically until it reappears.

To help resolve this problem, I just made my mouse cursor larger. You do this on your Mac by going to System Preferences, then Accessibility, then Display, and then adjust the “Cursor Size” slider until you get the mouse pointer size that you want. You can see in the image shown here that I’ve made mine a little larger than normal. (I was surprised that this is under “Display” and not under “Mouse”, but there it is.)

Java xeyes - Follow the mouse cursor location outside a JFrame

A Java xeyes solution - I started working on my Java speech recognition app again today, and in the process I saw some source code I thought I should post here. When I was developing this app, I thought it would fun to put a GUI on it, and when I thought about what sort of GUI it should have, I thought of the old X-Windows xeyes app. I looked around to see if anyone had written a "Java xeyes" application, but from what I've seen, nobody has.

Mac mouse and keyboard battery levels (How to check)

Mac mouse/keyboard battery FAQ: How can I check the battery level of my Mac mouse or Mac keyboard?

The easiest way I know to see the Mac keyboard/mouse battery level is to put the Bluetooth menu on your Mac menu bar, and check it from there. This menu will be in the upper-right corner of the Mac menu bar, and it looks like three small dashes with some other figure behind those dashes. (This is something like the normal Bluetooth icon, but a little different.)

Java - Getting the mouse cursor location (current mouse position)

Java mouse cursor location FAQ: How do I get the location of the mouse (mouse cursor) in Java?

I just ran into this problem in my Java Robot programming, and the short answer is, to get the current mouse cursor location/position, use the getPointerInfo method of the java.awt.MouseInfo class, like this:

Point p = MouseInfo.getPointerInfo().getLocation();

A custom Java mouse cursor that displays the mouse XY coordinates

Java mouse FAQ: How do I create a custom Java mouse cursor (mouse pointer)?

For my Java/Swing XY mouse position/coordinates application I finally dug into Swing and figured out how to create a Java mouse cursor that shows the X/Y position (coordinates) of the mouse cursor at any moment in time. I can't figure the right way to word that, so it may not make sense, but hopefully this picture of what I've done will help demonstrate my custom Java mouse cursor:

Java - custom mouse cursor - show X/Y coordinates/position/location

A Java Robot class mouse and keyboard/keystroke example

Java Robot class FAQ: Can you show me an example of how to use the Java Robot class?

Answer: Um, yeah, sure ... I say that a little jokingly. Okay, what really happened is that while developing this Java Robot example code on my Mac, I had to reboot it about 10 times. When you use the Java Robot class, you're poking your head out into the native operating system, and if you mess up with your GUI events -- at least on a Mac OS X system -- a lot of bad things can happen.