Using the Keyboard to Switch Desks


Using 4DWM it's possible to bind custom keys to quickly switch between different desktops; this allows you to assigning desks to different tasks, for example one desktop for web surfing, another for editing, etc.

In this tutorial we'll create a series of four desktops that can be switched between by pressing <ALT-1> through <ALT-4>. More desktops can of course be added as needed.

To start, open Desks Overview by selecting Desktop -> Extra Desks in the Toolchest. By default, Desks Overview will contain two desks, the current desktop labeled 'Desk 1' and the Global desk. Create two more desktops by selecting Menu -> Desk -> New Desk.

Now let's rename the desks to match the tasks we're going to assign. For this example, we'll use 'System', 'Editing' and 'Web', leaving 'Global' alone as it is a special purpose desk (anything placed on Global is mirrored on the other desks). Rename each desk by first selecting it with the mouse, then right click to bring up the contextual menu. Select Desk -> Rename Selected and then type in the new name above each.

Now it's time to configure 4Dwm to use our custom hot keys. First we need to create a ~/.4Dwmrc file by copying /usr/lib/X11/system.4Dwmrc to your home directory as ~/.4Dwmrc:

cp /usr/lib/X11/system.4Dwmrc ~/.4Dwmrc

Open ~/.4Dwmrc with a text editor and find the following section:

!! SGI 4Dwm Key Binding Description
Keys 4DwmKeyBindings
# Same as the standard OSF Key Bindings
Shift<Key>Escape window|icon f.post_wmenu
Alt<Key>space window|icon f.post_wmenu
Alt<Key>Tab root|icon|window f.next_key
Alt Shift<Key>Tab root|icon|window f.prev_key
Alt<Key>Escape root|icon|window f.circle_down
Alt Shift<Key>Escape root|icon|window f.circle_up
Alt Shift Ctrl<Key>exclam root|icon|window f.set_behavior
Alt<Key>F6 window f.next_key transient
Alt Shift<Key>F6 window f.prev_key transient
Shift<Key>F10 icon f.post_wmenu
! Alt Shift<Key>Delete root|icon|window f.restart

# SGI added key bindings
Shift<Key>Escape root 4DwmRootMenu
Alt<Key>space root 4DwmRootMenu

Add the following lines after the # SGI added key bindings section, but before the closing brace:

#change desktops
Alt<Key>1 root|icon|window f.switch_desk "System"
Alt<Key>2 root|icon|window f.switch_desk "Editing"
Alt<Key>3 root|icon|window f.switch_desk "Web"
Alt<Key>4 root|icon|window f.switch_desk "Global"
#Alt<Key>5 root|icon|window f.switch_desk "Desk 5"
#Alt<Key>6 root|icon|window f.switch_desk "Desk 6"
#Alt<Key>7 root|icon|window f.switch_desk "Desk 7"
#Alt<Key>8 root|icon|window f.switch_desk "Desk 8"

Notice that desks 5-8 are commented out; if you need more desktops in the future uncomment these and change the description in the quotes to match your desktop title.

After restarting the X-server (logging out then back in will work) you should now be able to cycle through your desktops using <ALT-1> through <ALT-4>. I find that setting a custom background for each desktop makes it easier to tell them apart.


Pure Genius .. This is some good stuff. Collect all of these Pearls of wisdom and you'll have the beginning of a new and up-to-date "Cool things to do with your SGI" FAQ .

"If you're used to keyboard shortcuts for application switching, you might have noticed that IRIX doesn't have a provision for this; it's just not something that 4Dwm supports ..."

If your focus is explicit Alt-Tab will cycle between your apps. Sloppy-focus would be nice though.


This rocks, it was exactly the thing I was loking for and hadn't been able to find
Thanks Heaps


About this Entry

This page contains a single entry by nekonoko published on December 17, 2002 5:07 AM.

Wheel Mouse Support Under IRIX was the previous entry in this blog.

Gaim 0.59.6 for IRIX Released is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.