Since the mouse pointer usually only hits the tip, I thought it would be better to make it transparent. In particular, I make the pointer larger than usual, so when I put the pointer on a link etc., I sometimes have trouble seeing the letters below.
I thought that if the pointer was translucent, it would be comfortable to read the letters below even if the mouse pointer was made so huge.
The overall flow for making the mouse pointer translucent is as follows.
To carry out the content of this article, you will need the following:
Mousecape is a tool for easily changing the mouse pointer. I will download and use the latest version 0.0.5.
Unzip the downloaded file and open the app file that appears, and the following window will appear.
Click ** Capes-> Dump Cusros .. ** on the toolbar to dump the current settings. When completed, it will look like this:
Right-click on this blue area and select ** Show in Finder ** to see the dumped cape file in the Finder, copy it to get the cape file. This becomes clear when you open it with a text editor, but inside it is a huge XML file that stores the image of the mouse pointer in Base64 encoding.
Run the Python script that processes the cape file you just got. However, this Python script requires the following libraries:
$ pip install Pillow
You can install it with.
Then save the following script somewhere.
convert.py
from base64 import decodestring, encodestring
from xml.etree.ElementTree import ElementTree
import sys
import io
from PIL import Image
inputfile = sys.argv[1].strip()
outputfile = sys.argv[2].strip()
opacity = sys.argv[3].strip()
tree = ElementTree()
tree.parse(inputfile)
imagedata = tree.findall("dict/dict/dict/array/data")
for i in imagedata:
img = decodestring(i.text)
img = Image.open(io.BytesIO(img))
img = img.convert('RGBA')
data = img.getdata()
new = []
for p in data:
new.append((p[0], p[1], p[2], int(p[3] * opacity)))
img.putdata(new)
img.save('temp.png', 'PNG')
result = open('temp.png', 'r')
base64 = encodestring(result.read())
result.close()
i.text = base64
tree.write(outputfile)
Execute as follows.
$ python convert.py /path/to/dumpfile.cape output.cape 0.5
This script takes command line arguments like this:
After waiting for a while, a file such as output.cape will be created.
Click ** File-> Import Cape ** on the toolbar to import the cape file you just generated. It looks like this:
You can delete the dumped truck at this point. You can remove it by right-clicking and ** Remove **. Then select the transparent one, right-click and select ** Apply ** to apply.
Install the Helper Tool to make the mouse pointer transparent when the computer starts up. You can start Mousecape and install it from the toolbar with ** Mousecape-> Install Helper Tool **.
I made the mouse pointer larger, but when I restarted it returned to its original size. It seemed difficult to analyze the source code and find the bug from now on, so I made an AppleScript to increase the size and started the script when logging in to the computer to avoid it.
set_cursor_size.scpt
tell application "Mousecape"
activate
end tell
delay 0.1
tell application "System Events" to tell application process "Mousecape"
click (menu item 3 of menu 1 of menu bar item 2 of menu bar 1)
set theSlider to slider 1 of window 1
set value of theSlider to 3.0
end tell
quit application "Mousecape"
You can change the size by replacing the 3.0
part with your favorite number.
Paste this code into a script editor and export it as an application with ** File-> Export ** from the toolbar and save it in a suitable location.
When executed, Yosemite will ask for permissions as follows:
Open system preferences and grant permissions.
Then select ** System Preferences-> Users & Groups-> Login Items ** to register the application so that it runs at startup.
I think this will make the mouse pointer translucent. I've only tried it on Yosemite, so maybe it won't work on other versions.
Recommended Posts