« I, Newbie | Main

Cocoa Keyboard Coolness

One of the things that I've found difficult about adapting to OSX is the behaviour of the keyboard. It seems that each application requires different keystrokes to move the cursor to the end of a line or to scroll to the top of a page. The thing that annoyed me the most was that the page up key (ctrl-up or fn-up in the text editor application) does not move the cursor back by one page in the text editor. It scrolls the view buffer by one page, but doesn't move the cursor.

In my search for a solution to this problem, I learnt about a very cool feature of the Cocoa UI controls that newer OSX applications are built with: the key bindings can be altered system wide (or on an individual user basis). Just by editing some simple files, I have been able to make my Mac move the cursor up and down by a page in all applications that use a Cocoa text editing control - the text editor application, mail, and others. That's a nice fix, but what's even better is that I can add new functionality to all applications by describing sequences of actions to take on certain key presses. If you are a keyboard user with a Mac, I strongly recommend reading the following pages to learn how to do this:

I really don't like to have to reach for the mouse to perform a simple operation, especially on a laptop where the mouse pad is a nuisance to use. Eventually I'll learn shortcuts for all the things I do regularly, but in order to do this it helps to be able to explore the menus. In MS-Windows, Gnome, or KDE, I can always access application menus by holding down the ALT key and pressing the first letter of the menu item name. This doesn't work in OSX. The closest I've been able to find is to use Ctrl-F2 to move focus to the menu bar, then letter keys or the arrow keys to navigate around. Ctrl-F3 moves focus to the Dock, and Ctrl-F8 moves focus to the status menus at the top right of the screen.

The trick to enabling this behaviour on a new Mac laptop is to open the Keyboard & Mouse part of the System Preferences application, select the Keyboard tab, and select the checkbox labeled 'Use the F1-F12 keys to control software features'. You may need to press Ctrl-F1 to switch on this type of keyboard access. Having done this, you'll then need to use the fn key in conjunction with the function keys to access their hardware specific role, e.g. fn-F5 to increase sound volume. While you've got the System Preferences application open, you can also switch over to the Keyboard Shortcuts tab and select the radio button labeled 'All controls' at the bottom of the dialog. This will enable you to move between controls using the Tab button. When a dialog with buttons is presented, for example, you can tab to a button then use the space bar to press it.

Post a comment

About

This page contains a single entry from the blog posted on June 14, 2006 12:23 AM.

The previous post in this blog was I, Newbie.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.33