Create keyboard shortcuts that use the Windows key

If you've tried to define your own keyboard shortcuts using the program on the System ^ Preferences menu, you'll have noticed that it doesn't let you use the "Windows" key (the keys to the left and right of (Space) that usually have the Microsoft Windows logo on them). The Keyboard Shortcuts program sees the Windows key as just any other key, like a letter and number, so you can't combine it with any other keys to create a combination.

But a solution isn't far away. Click System ^ Preferences ^ Keyboard and then click the Layouts tab in the window that appears. Then click the Layout Options button and, in the new dialog that appears, click the small arrow alongside Alt/Win Key Behavior. Then select the radio button alongside Super is mapped to the Win-keys, and click the Close button, and then the Close button in the parent dialog box.

You can now use the Keyboard Shortcuts program, as mentioned at the start of this tip, to define new shortcuts involving the Windows key.

You can also make certain programs start on key combinations, including the Windows key, and/or the [Alt] and [Ctrl] keys. Let's take as an example having Nautilus open in Computer view when [Wi ndows]+(¥) is hit, a useful keyboard shortcut you might be familiar with when using Windows. The first thing to do is define the command we want to run in this instance, so start gconf-editor and navigate to /apps/metacity/keybinding_commands and double-click the command_1 key on the right. In the Value text field of the dialog that appears, type nautilus computer://.

To define the actual keyboard shortcut, switch to /apps/metacity/global_keybindings in gconf-editor and double-click the run_command_1 key. In the dialog box that appears, type <Super>e.

Following this, you can quit gconf-editor and test your new shortcut— Nautilus will open in Computer display mode whenever you hit [Wi ndows]+e].

Create a text file without a text editor M 235

Any command can be used typed into the command_1 key in gconf-editor, as described above, with virtually any arguments or options. Additionally, up to 12 command keys are available in gconf-editor, as described above, along with corresponding run_command keys, where keyboard shortcuts can be defined.

You might notice that, even though you enable the Windows key as described earlier, some options in the Keyboard Shortcuts program just don't seem to work when a Windows key is used in their shortcuts, even though using [Ctrl] or [Alt] seems to work fine. It's not clear why this is, but you can use gconf-editor to alter existing keyboard shortcuts so they work with the Windows key. Most can be found by navigating to /apps/metacity/global_keybindings and /apps/metacity/windows_keybindings— just double-click the key relating to the shortcut, delete the contents, and type the new keyboard combination. <Super> can be combined with <Shift>, <Alt> and <Control>, in any number of combinations.

If you want to include the cursor keys in any shortcut combinations, just type Left, Right, Up, or Down. For example, to cause Nautilus to start in Computer mode, as described above, whenever [Windows]+[Cursor Left] is hit, you would change the value of run_command_1 to read <Super>Left. <Home>, <End>, <Insert>, <Delete>, and <Pause> are also available for use, and correspond to the keys above the cursor keys on a standard desktop PC keyboard. [Page Up], [Page Dow^ and [Scroll Lock] must be written as <Page_Up>, <Page_Down> and <Scroll_Lock>.

Often creating a quick text file is necessary. The following will do the job without running any external programs other than those built into the command-line. You can type what you want, including line spaces. Obviously, replace textfile.txt with any filename you choose. Once you've finished entering the data, hit [Ctrl ]+d to save the file:30

30. [Ctrl ]sends an "end of file" (eof) message, thus ending input and causing the file to be saved. Some other commands use [Ctrl |+d) too, and if you read their man pages they will say something like, " terminate input, send eof." Because it effectively tells BASH that you've finished your input, [Ctrl ]+d)

is also a quick way of logging out of a

Create a text file without a text editor

To subsequently process the words you've typed, see Tip 221, on page 256.

Was this article helpful?

0 0

Post a comment