Commit 848532a5 authored by Aral Balkan's avatar Aral Balkan
Browse files

Initial add.

parents
.DS_Store
\ No newline at end of file
#!/bin/bash
# Make sure that errors abort the script.
set -e
######################################################################
#
# High Contrast I-Beam Cursor for Dark Xcode Themes
#
# Options:
#
# -m: Installs medium cursor (32×32 pixel)
# -l: Installs large cursor (64×64 pixel)
# -o: Reverts to the original Xcode cursor
#
# By default, will install a 16×16 cursor (the same size as the
# original one that comes in Xcode.)
#
# Copyright © 2015 Aral Balkan. License: MIT
# Released with ♥ by Ind.ie
#
######################################################################
cursorIsSet=false
revertingToOriginalCursor=false
printf "\n"
while getopts ":mlo" opt; do
case $opt in
m)
printf "Installing medium (32×32 pixel) high-contrast I-beam cursor…" >&2
cursorToCopy="DVTIbeamCursor-medium.tiff"
cursorIsSet=true
;;
l)
printf "Installing large (64×64 pixel) high-contrast I-beam cursor…" >&2
cursorToCopy="DVTIbeamCursor-medium.tiff"
cursorIsSet=true
;;
o)
printf "Reverting to the original Xcode I-beam cursor (from 6.1.1)…" >&2
cursorToCopy="DVTIbeamCursor-original.tiff"
cursorIsSet=true
revertingToOriginalCursor=true
;;
\?)
printf "Invalid option: -$OPTARG" >&2
;;
esac
done
if [ "$cursorIsSet" = false ]; then
printf "Installing regular (16×16 pixel) high-contrast I-beam cursor…" >&2
cursorToCopy="DVTIbeamCursor-regular.tiff"
fi
printf "\n\n"
# Copy the new cursor.
sudo cp $cursorToCopy /Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Resources/DVTIbeamCursor.tiff
printf "Cursor installed.\n\n"
if [ "$revertingToOriginalCursor" = false ]; then
printf "Note: You can always revert to the original cursor by running: ./install -o\n\n"
fi
printf "\e[33mPlease restart Xcode to see the new cursor.\e[0m\n\n"
# High Contrast I-Beam Cursor for Dark Xcode Themes
Replaces the default, hard to spot, Xcode I-beam cursor (used to mark the position of the mouse when over text) with a sharp, high-constrast one.
_For use with dark themes only._
## Installing
1. ```./install```
2. Enter your account password when asked by ```sudo```
3. Restart Xcode
## Uninstalling
Run ```./install -o``` to revert to Xcode’s original cursor (as backed up from Xcode 6.1.1).
## Why?
I use the [EGOv2 theme](http://developers.enormego.com/view/ego_xcode_theme_for_xcode_4_egov2) in Xcode and the default dark I-beam is almost imperceptible.
### Original I-beam
<img src="https://aralbalkan.com/images/old-ibeam.png" alt="Original Xcode i-beam cursor on the EGOv2 theme." style="width:494px">
### High-constrast I-beam
<img src="https://aralbalkan.com/images/new-ibeam.png" alt="High-contrast Xcode i-beam cursor on the EGOv2 theme." style="width:494px">
## Further accessibility
If the cursor is still hard to see, you can increase the system-wide cursor size via:
System Preferences → Universal Access → Mouse & Trackpad → Cursor Size
When you do this, the original cursor will look blurry. So I’ve created two other sizes (medium; 32×32 pixel, and large; 64×64 pixel) that will look crisper. You can install those with ```./install -m``` and ```./install -l```, respectively.
(Thanks to Julian Richardson for [the tip](http://stackoverflow.com/a/7210916/253485).)
## Limitations
This is not a smart cursor. It will remain white and become hard to use when, for example, you’re renaming a file in the Project Navigator on Xcode’s ambient light background. However, given how much time I spend editing code vs. editing text in other parts of the interface, it’s a tradeoff I’m happy to make.
Ideally, of course, Apple should implement a cursor that automatically adapts to the colour of the background.
## Credits and acknowledgements
This is based on [Better Xcode ibeam cursor](https://github.com/egold/better-xcode-ibeam-cursor) by Eric Goldberg, with thanks to [Chris Dragon](http://stackoverflow.com/a/12030806/253485). Released under the [MIT license](http://opensource.org/licenses/MIT).
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment