- LJDT: RPM Package Verification and Repair
- LJDT: iSCSI for Shared Storage
- LJDT: Taking Advantage of Screen
- LJDT: Installed RPM Size
- LJDT: Workspaces
- LJDT: Base64 Encoding
- LJDT: The ‘watch’ command
- LJDT: Reliable Service / Connection Tests; netcat, not ping, is the correct tool
- LJDT: LDAP Data and Schema Comparisons
- LJDT: KVM, Snapshots, and Disk Resizing
For a while now I have taken for granted the marvelous functionality commonly referred-to as “workspaces” in the X window system. Anybody using a graphical interface with X already probably has this functionality present by default and in many distributions the feature of multiple workspaces is even enabled by default The idea behind this article is to show how efficiency in the GUI can be improved using this feature and the ease of adopting the technology to suit your needs out of the box, because Linux Just Does That.
Many users of Linux and Unix area familiar with the ‘X Windows System’ at some level. It is the backbone behind graphical applications for most platforms, gives a common interface for window operations, and at times can be an interesting thing to configure. Wikipedia has a bunch of information on the history of ‘X’ which may be interesting to some and that is found here: http://en.wikipedia.org/wiki/X_Window_System. Some of the highlights of the article include that X was created in 1984 and the current version of the X (X11) protocol has been around since 1987, so the technology is fairly solid in that regard. X by itself does not implement sound at all and leaves that to other applications which is fairly standard for graphical interfaces. X, as many know, is network-enabled so you can have the “client” be your main interface while sitting at the X server (which could be a “server” or “workstation” as far as the entire box is concerned) or you can have your X client be on the other side of the planet remotely pulling up applications and displaying them from eighteen-thousand kilometers (or so) away (as the cable runs, anyway). X is built upon principles of keeping things simple and not becoming a giant application that does everything in the world for everybody, leaving some of the niceties we have come to expect as end users to window managers (the most popular ones including Gnome and KDE). So now that we’ve heard about X, the actual Workspace functionality is provided by the window manager, though as that runs on top of X its implementation can be very customized for your own desires (read context-specific information about Window Managers at the ‘Virtual Desktop’ topic on Wikipedia located here: http://en.wikipedia.org/wiki/Virtual_desktop.
So in the end what are Workspaces really? In *nix they are one or more virtual spaces within a physical space. For example the physical space is typically your monitor or monitors, and within that area you get so many pixels with which to play, but sometimes combining all of your favorite applications into that space is tricky and cluttered. Sometimes you want more virtual space so you can have room to drop millions of documents and shortcuts that otherwise evade your most-sincere attempts at organization (you know who you are, Mr. I-Must-Delete-Two-Year-Old-Junk-Just-To-See-A-Critical-Document-Typed-Yesterday).
When you have a few dozen applications open then the taskbar invariably becomes a nightmare to use regardless of the amount of consolidation the environment provides for you. Pressing Alt+Tab to switch among applications only makes sense when there aren’t twenty applications to switch through to find the one you want. Workspaces let you overcome this by having more “desktops” (flat things on your monitor) than you have monitors. They also let you have more space on a monitor than your monitor can display though personally this feature is not as useful to me as it must be to others so I won’t be touching on that.
In my own environment I primarily use four (the default for most systems) workspaces to group applications by what they do so that I do not need to switch through twenty applications to find what I want, or move to the mouse and find it in the taskbar. In many cases this saves me dozens of clicks or keystrokes and this is without providing much (if any) additional overhead to my system. Any additional work done on the system is overcome several times by my ability to get where I need to be reliably without watching the computer draw every window I could go through to reach my destination. I’ll provide some examples to illustrate my point.
Some of you may remember a few years about when XGL and Beryl (now Compiz Fusion) came out providing flashy 3D effects like the Cube and wiggly windows among many others (nice effects when windows were created, destroyed, minimized, maximized, etc.). While these are not part of the basic Workspaces functionality I’m discussing the “cube” feature is essentially a flashy way to show changing from one workspace to another. Normally, without Compiz the change between workspaces is just a flicker when the old windows are replaced by the new ones, so the 3D effect is neat and fun and may even be a way to help you stay situated among dozens of workspaces, but that’s all it is (aside from a way to entertain friends). If you have a relatively-new system setup with Linux it may be that you have the 3D effects setup automatically so feel free to tinker with those or the older non-3D versions mentioned here.
So on to how I have this setup to show worth in the technology. On my system the four workspaces are broken up by type of application, and “type” is based on the randomness in my head so organize your own desktop however makes the most sense.
First, workspace ’0′ (as I’ve labeled it) is specifically for my browser, e-mail client, and other things that I need to use as the day goes on and that do not have a better place to go. Since it is where I am first and by default it is also where I spend most of my time and most applications that do not have a better place to live hang out here. Firefox and the GroupWise e-mail client are always open here; Tomboy notes are typically typed here (like this one); other web browsers are opened here if/when I use them unless I feel the need to move them. Sometimes I’ll start out with something here and move it elsewhere to declutter (for example, to workspace 2) but more on that later.
Workspace ’1′ (the second one) is dedicated to my shell, and I (despite being a Gnome person mostly) use ‘konsole’ for my shells because its Tab-handling is superb. I have exactly one Konsole open on my system at any given time and it is maximized to fill the entire workspace, which is fine because I have anywhere from four to twenty tabs within it for each shell I actually need. A coworker once pointed out that the only reason to have a Graphical User Interface on a computer is so you could have more shells, and this is my way of maximizing that statement. Having a workspace dedicated to shells in some other way is also possible but this lets me have the most real-estate per shell and the most shells possible without constantly readjusting things. Having the shell(s) between other workspaces that deal with communication (e-mail and browser on ’0′, IMs and other clients on ’2′ with NNTP on ’3′) also allows me to easily get data to the shells from other places (and vice versa) without Alt+Tab for everything; remember that my primary reason for using Workspaces is to decrease the time required for me to do regular stuff.
Workspace ’2′ (the third one) is for Pidgin and other non-SMTP communication clients (except for Thunderbird). For example Skype is open here as needed, Pidgin lives here with its gigantic window of tab-arranged conversations, and anything else I need to do to hassle other people will happen here. Whenever I receive a message from somebody I do not need to sort through hundreds of windows to find my messages as they are always in one place. When a new application needs to stay open longer term (for example, an administration program for eDirectory like ConsoleOne or iManager, or Designer for Novell Identity Manager, or LDAP Browser/Editor (LBE)) they often get sent to this workspace in order to free up room on my primary workspace (0).
The last workspace (’3′) is devoted to NNTP, because I believe strongly in information sharing and doing so via forums works well for me. Thunderbird resides here 24×7 doing just my NNTP-based stuff so that section is otherwise quiet (not cluttered) most of the time.
So with that in mind the ways to move among workspaces (in the non-fancy-Compiz world) becomes important. Most people know that Alt+Tab is used to change from one application to another so another method is needed to change from one workspace to another, and the easiest way I know (the default way) is to use Ctrl+Alt and an arrow key (left or right). This requires a slight shift of hands but after a week or so of using it the movement is second-nature and in any case is faster than reaching for the mouse to make the same change. With Ctrl+Alt pressed using the Left arrow will take you to the next workspace to the “left” from where you are (unless you’re at the end, and then you go nowhere except in Compiz which wraps around). Holding Ctrl+Alt and pressing the Right arrow will take you to the next workspace to the “right” from where you are. If you press the Up or Down arrow keys a little display shows a quick summary of where you are as well as what is on each display with a little icon of the applications and where they are. Most of the time I remember where I am because I group applications by what they do and only go places when I need to be there but this is still useful from time to time.
Some additional information about Workspaces should probably include that they are, like most things, user-specific so when I login to my computer I can have my four workspaces while anybody else may have one, several dozen, or some number in between. Also there is an add-on called the Workspace Switcher for the various panels of your environment (the taskbar at the bottom or top is usually a common place for this to be kept if it is a feature the user enjoys) so that besides using the quick Ctrl+Alt method to change workspaces you can also click on a representation of the workspaces and navigate that way. One feature about the Workspace Switcher that is sometimes fun is that, as it is mouse-driven and shows a summary of the other workspaces (same view as Ctrl+Alt with Up or Down), you can drag and drop windows from one workspace to another. Moving windows is also possible multiple other ways but if you already have the Workspace Switcher right there that can sometimes be easy as long as the application you want to move is visible in the switcher. The switcher lets you show the workspaces in multiple ways or in a single line or multiple lines depending on your preferences. It also is the way to rename your workspaces so they can be remembered more-easily.
Going back to window management there are some other ways to move things around, or to even have a window appear on multiple workspaces simultaneously. For example, from the little icon on the left-hand side of an application’s Title bar (big blue thing at the top typically that has Minimize, Maximize, Restore, Close, etc.) there are options to ‘Move to Another Workspace’ and then you are able to choose which workspace to use by name. There are also options to move to the workspace to the right or left of where the window is currently located, or even to always show the window on the visible (currently active) workspace so it is always there no matter where you are. Another way to move windows around, the same as with Compiz/XGL, is to add the Shift key when changing workspaces. When you combine Ctrl+Alt+Shift and the Left arrow key the application that is currently in the foreground (the one that currently has focus) is moved wherever you go (in this case, to the workspace to the left). This means it is fairly easy to move your windows without moving your hands from the keyboard. In XGL/Compiz land you can also have your windows move from one workspace to another by dragging them if you do not mind using your mouse a bunch for that.
Originally when I mentioned Workspaces and the advantages thereof I mentioned the lack of clutter in the taskbar, which is one of the biggest reasons I enjoy this particular feature. By default, though, all windows from all workspaces show up in Gnome’s taskbar, and that is not my preferred way. If you feel similarly and want only the current workspace’s applications in the taskbar then right-click on the little dotted line (not intuitive I know) next to the Computer Menu or Tomboy note icon next to the Computer menu. This is (per my understanding) the point where you can access the preferences for the ‘Window List’ (yet another option to be added to that bottom panel, and an understandable default), which is the section of space where applications show up on the bottom (or top, or side) of your desktop. Once in the Preferences there are two options and the one I use to keep only the current workspaces windows visible is labeled, ‘Show windows from current workspace’, and the other option is ‘Show windows from all workspaces’ for the curious. There are also options in there about Window Grouping that are disabled by default but will have the Window List group applications in the taskbar. If you are using a distribution that does not have workspaces setup you can add the ‘Workspace Switcher’ to a panel by right-clicking on the panel and choosing ‘Add to Panel…’ and then choosing the Workspace Switcher. Right-click on the Workspace Switcher once you add it to set your preferences such as the number of workspaces and their arrangement on the panel.
With the steps above you should be able to take advantage of a truly useful feature, and if you have the OpenGL capabilities you can also use the flashier Compiz functionality to get the same benefits plus some visually appealing components. At first when using workspaces it took a few days to get all of the keystrokes worked out but once learned they have been invaluable in everything I do and I cannot imagine going back to an environment without the functionality. As an aside to those of you who may have stumbled upon this but who are using (or otherwise use) an Apple computer (Mac OS X 10.5 or later I believe) the ‘Spaces’ functionality they have added is essentially the same thing and is worth exploring.