Day-to-day thoughts, technical information, a random grab-bag of thoughts, discoveries, and interesting little tidbits.

Friday, July 8, 2011

The Simple Linux Desktop

These days, there are a number of major desktop environments out there that can make the Linux desktop behave like a Windows or Mac desktop.  This is a good thing, where people from those environments are concerned, as they won't have to do a lot of learning right away.  Everything they expect, such as icons, the taskbar, desktop menus, and other common items are right where they would normally look for them.

But what about those of us who prefer the spartan way of computing?  Those who find the window manager shouldn't have gained any more features than drawing borders around windows, and where the desktop is just the screen where windows appear often finds the presence of start menus, taskbar, eye candy, and icons an unnecessary distraction, while the number of programs required to run in order to produce those visual elements robs the simple performance of whatever app is being used at the time.

In an effort to remove the complexity of the desktop environment, I've found the use of several tools work just as well for a desktop, provides a flexible user interface, and still gets the work done.

One thing I would like to note: originally, I cursed the existence of the "useless" Windows key, but since working on this desktop project, I've  come to love it for its one major benefit... the very uselessness I originally hated it for.  Since it's useless, I can make a use for it, and not have to use any of the other keys that more frequently already have uses in other software packages.



Before we begin, I will make a point of noting here: This is an advanced setup process.  Compiz will probably be the easiest part to set up due to its graphical setup and reasonable defaults once the plugins are enabled.  The rest of the tools, while having GUI tools for setup, are much better handled in their text configuration files, where the flexibility of this desktop will shine.

With that being said, however, keep in mind that once the tools have been configured, they don't need to be modified again unless you plan to redecorate. Constant tweakers need not apply, this is for those folk who just want a simple desktop to set up and use without worries that it's going to change on them.



The Desktop

The desktop itself needs to have all the elements necessary to create windows, borders, and just enough interaction to do things with those windows and borders.  Older hands prefer classic window managers like twm, fvwm, or *box, but we can actually have a lot of eye candy from a much more flexible (and potentially-pleasing) window manager, Compiz.

Unlike the classic window managers, Compiz lacks most of the desktop elements one would expect with a window manager, such as desktop buttons, icons, or even a root menu (a sort of "start menu" that appears when clicking on the wallpaper).  Any additional features will need to be added by other specialized programs later.  But don't think this makes it too simplistic.

Compiz has a configuration program called "ccsm", which means "Compiz Configuration Settings Manager."  This application has a GUI interface to a whole host of settings, which include both special effects, such as the desktop cube and wobbly windows, as well as the more important stuff, such as which keys and mouse buttons can affect windows in which ways.

To save you some trouble, here are the basic Compiz plugins to activate to have a completely usable standalone desktop with Compiz:
  • In the "Effects" section:
    • "Window Decoration" actually draws the window borders.  Yes, you really do need a plugin for that feature.
  • In "Window Management":
    • "Application Switcher" allows the standard ALT-Tab window-switching behavior.
    • "Move Window," which allows windows to be moved around on the desktop.
    • "Place Windows," which determines where brand new windows appear on the desktop.  I prefer "Smart Placement," which places new windows in areas with little window covering.
    • "Resize Window," which allows windows to be enlarged or shrunk.

Now, I would be lying if I said I didn't want some of the more awesome effects of such a nice window manager, and since I'm saving massive amounts of resources by not using a full desktop, I can have several extra toys running:
  • In "Desktop:"
    • "Desktop Cube," which is like virtual desktops on steroids.  Despite the name, it does not necessarily need to be a cube; the number of faces are actually flexible, although they all need to be placed in a horizontal arrangement... no complex "desktop multihedrons" unfortunately. 
    • Rotate Cube, which allows you to switch "faces" on the cube using the mouse and/or the keyboard.
  • In "Effects:"
    • "Animations;" opening, closing, minimizing, maximizing, restoring, and shading windows all have special effects assigned to them.  If you have a task bar, they usually interact with that.  If there is no taskbar, windows usually "disappear" into the mouse, regardless of its actual location on the desktop.  It looks pretty slick to watch windows just get "sucked" into the mouse pointer.
    • "Animations Add-ons" add more animations for the windows to perform.
    • "Wobbly Windows" can give the windows a stretchy, rubbery feel.  Also, if you hold down Shift while moving a window, it will snap to the nearest window or desktop border.
  • In "Extras:"
    • "Screenshot" is a useful option; instead of taking a full-screen snapshot, you can hold down the Windows key, drag the mouse using the left mouse button, and the screen will show an outline.  Let go of the mouse button, and everything in that line will become a screenshot in the chosen directory, and can even be shown in your preferred image program.
  • In "Window Management:"
    • "Group and Tab Switcher" essentially allow you to "glue" windows together.  Grouping windows will mean that if you move one window in a group, they will all move as one.  Tabbed windows are even slicker; if you set up a group of windows into a tab session, then holding the mouse over the border will show all the tabs in that group; clicking on any of the tabs (or using Windows-Left or Windows-Right) will cause the window to visibly "flip over," revealing the desired window on the back of the previous window.
    • "Maximumize" works similar to "maximize," but instead of the window filling up the whole screen, it simply grows to fill the available unused space it's in.  Unlike Maximize, however, it does not return to its original size; "Minimumize" will simply shrink the window down to its absolute minimum size possible.
    • Shift Switcher allows Windows-Tab to change windows, but unlike the Application switcher, which treats the windows like a slide show, this one shows the windows as if you were flipping through records.

Desktop Components

Now that the window manager is active, let's next focus on the visual elements of the desktop.  The basic tools are the toolbar and the task tray; items that are needed for one to be able to switch between windows, and to hide items that don't need to be displayed to function.  Additional items can be found in simple notification widgets, such as a system monitor.

Task Bar

Tint2 is probably the most lightweight and simplistic taskbar I could find, especially as it includes a task tray, doesn't include a start menu, and even has a clock included.  Additionally, this toolbar has alpha blending, meaning it can be translucent without being transparent.  Finally, it does not interact with windows on the desktop, which means it isn't going to reduce the desktop size one iota (toolbars should only be seen when needed).  If you activate the "Widget Layer" feature of Compiz, you can then set a hotkey to show it only when you actually need it, leaving the desktop entirely empty for other uses when you don't.

System Monitor

Conky  is a system monitor widget with a lot of optional extras, from temperature monitor, to music player information, to RSS Feed reader.  In my case, I just use it to function as a desktop clock, performance monitor, and disk space notifier.  It sits in the background, translucent, and doesn't interfere with the rest of the windows, which works for me.  Some tips: enable argb_visual features to allow Conky to interact with Compiz's transparency, enable double-buffer to prevent the annoying flickering seen in the default setup, and browse other peoples' configurations via Google for ideas on how you can use it.

Launching Applications

Of course, a good-looking desktop that is unusable is a waste of time and effort, right?  Of course.  Two tools will be useful for launching applications.

Keyboard Launcers

xbindkeys is a simple tool with a simple purpose:  Wait for special keyboard combinations, and then run the specified program.  This allows me to set up Win-F1 through Win-F12 (and combinations including Win, Alt, Ctrl, and Shift) to launch programs.

Now, there is not a lot of documentation regarding which codes are assigned to which keys.  However, if you launch xbindkeys with the "-mk" switch, the program will sit and give you the exact keypress names it expects as you press the keys themselves.  This can be a boon to making the configuration files as needed.

The only downside to this program is that it does not also detect mouse activity.

Mouse Menu

Some people prefer the old start menu.  Nothing wrong with that, although it seems like more trouble than its worth... but that's just me.  For those who really need a good standalone root menu (remember, Compiz does not have one), there is myGtkMenu.  This program is simple: it reads a text file you make, and shows a menu.  The configuration file is just a list of three-line entries, separated by spaces, consisting of item name, program to launch, and path (if any) to the program's desired icon (or else just NULL).  Submenus can be created, all you need is a name, and the icon name, following which all items in that menu have an additional tab before they're entered (if you're familiar with Python, this should be pretty simple to understand).

Now, keep in mind that XBindKeys won't detect mouse presses, but Compiz will.  If you plan to set this menu up, you can use the "Commands" plugin in Compiz settings to add the command to open the menu, and assign a key/mouse binding for it.



Now, it wouldn't be much of an explanation without some screenshots, would it?  So, here are two.



The first one is a screen in normal mode; note that aside from the browser, there is no task bar.



Now, we see the window is darkened, and the task bar is present.  The screen is in "Widget Layer" mode, which is what the task bar is assigned to.



At this point, I've described my own desktop (plus the menu; I prefer using xterms to launch programs). It's simple, but immensely flexible, and I doubt I'll be seeing it mucked about by upstream authors anytime soon, so I can forget about fighting the interface, and just use my computer as I want to.

I hope you enjoy this, and find inspiration with it!