- Mac OS X
20 November 2011
Workcuts is a simple per-project keyboard shortcut and menu manager with Ruby scripting for fast access to your projects' most repeated tasks. I wrote it mainly because I needed it but couldn't find something likewise and extra-handsome at the same time.
Excerpt from the help document
The Sainte-Force preaches laziness, so I won't repeat myself and paste the help document in this section.
- Download Workcuts 1.1 (Mac OS X 10.6+)
- Download Workcuts 1.0 for Tiger (Mac OS X 10.4.8 to 10.6.8)
- Grab the source on Github !
How to use Workcuts
Workcuts is a simple Mac OS X application that opens projects and gives access to the project's shortcuts. A project is simply a folder in your computer. A shortcut is a command which can be associated with a keystroke.
- Download Workcuts (see above) and install it.
- Open Workcuts.
- Open a project with the Project > Open… menu. Remember, a project is just any folder.
- If you press the global shortcut key (⌘⌥⌃Space by default), a menu appears in the bottom left corner of your screen. This is the shortcuts menu. Apart from the global shortcut key, you can find it in the Shortcuts menu (in the menu bar), in the Workcuts status item (if activated), or in the Workcuts dock menu.
- You can see there's only one element in the shortcuts menu. It is called Edit Workcuts.rb…. Once activated, it opens the file called
Workcuts.rbin your project directory, with your favorite editor. If no file has this name, Workcuts creates it automatically and fills it with example shortcuts. Yes, because it's the file that specifies what are the shortcuts for the current project. See below for a syntax description.
- Save your
Workcuts.rbfile and Workcuts will update itself automatically. If there's an error in the file, Workcuts will nag you about it.
- In order to use your shortcuts, show the shortcuts menu (for instance with the global keyboard shortcut) and then select the shortcut you want (for instance by pressing the shortcut's associated keystroke).
The project you're working on is kept across different executions of Workcuts.
Workcuts file syntax
The file must be called
Workcuts.rb and be placed in the root of your project folder. Here is a minimal example for one shortcut :
A shortcut is defined by the word
shortcut, followed by an identifier (an identifier is the colon character followed by letters, no spaces), followed by the word
do, followed by one or more lines specifying the shortcuts properties, followed by the word
end. You can have as many shortcuts as you want and you can specify a shortcut in several places, like this :
Please be aware that the entire
Workcuts.rb file is itself a Ruby script (hence the extension). Specifying a shortcut's properties can be done by using the methods
named (to tell its title),
press (to tell its associated keystroke),
will (to tell what command the shortcut will do in a Ruby block),
toggle (to set/unset the shortcut tickmark),
You can run any Ruby command you want, from simple calculations to shell commands. You can even create shortcuts dynamically.
Finally, Workcuts provides a special method,
terminal, that enables you to launch commands in a new Terminal window, with the settings set specified in Workcuts' preferences :
Now let's watch several examples !
Let's start with a simple (and useful) example. Note that calls to the shell are blocking !
Here is a slightly more complicated example.
I hope this tool will prove to be useful to you. Feel free to send comments, bug reports, death threats…
Looking forward to hearing from you,