Gratuitous Window Dressing, Part 4
It's 2001! That mystical year we've all been waiting for since 1968 when Clarke and Kubrick wowed us with that majestic station spinning to the Blue Danube waltz has finally arrived! Heck, believe it or not, a large, black monolith has even appeared in Magnuson park in Seattle. While it's not quite what we were hoping for, we've finally got an international space station and all you webcammers know that video phones have been around for a while now. We're doing okay!
We had a New Year's Eve party at the house (as lots of people had) where I just had to do something silly in reference to the fact that 2001 had arrived. Becasue I can't simply have signs that say "Welcome 2001" (and yes, we did have a couple of those), I also made up a poster with "O D C " written out 2001 times. Get it? 2001 spaced ODC's! Okay, fine. I got about the same response from my wife, Sally, and our guests. I thought it was funny.
So far, in this series, we've talked about X and how it works underneath the surface. We've also looked at the mysterious ".X" files and found that a little tweaking here and there can drastically change your default X environment. What we haven't talked about yet are the various window managers. Well, we won't do that this week either. Instead, I am going to show you around and tell you about some X applications you may not be aware of. We're going to start this column with a tour of X, the unknown. Then, we'll go back and explore other ways to tweak X. For now, let's play.
Odds are you have already played with xeyes ("Hey, they follow my mouse cursor all over the screen!") and xcalc ("Cool! A free scientific calculator."). You might use xbiff to keep an eye on your maibox and alert you when new mail comes in. If you've got mail, the little flag goes up. Then, there's xmag, a tool that lets you magnify a section of your X window screen. Type xmag and your mouse cursor will change to a top left-hand corner icon. Place that icon on any part of the screen and your hi-res icons look somewhat clunkier (the default magnification is 5 times). Click the "replace" button, and you can start over again with another part of the screen.
It's also quite possible that you use xman to look up commands rather than just the man command itself. It doesn't look like much when it comes up--just a box with the words "Help", "Quit", and "Manual Page" written in little oval buttons. Click on "Help" if you need help navigating with the tool. For those who haven't tried xman, you can get a list of the man page sections by clicking on "Manual Page", then choosing the "Sections" button at the top of the window. Click on "(1) User Commands" for a list of (you guessed it) user commands. Then, you can click on the command you want and it too, will appear in the graphical window. Incidentally, hitting "f" (or the space bar) will move you a page forward, while hitting "b" will move you a page backward.
Since this is the new year and we have time on our minds, let's talk clocks (nice segueway, huh?). Haven't you always wanted a clock that chimed the hours and half hours? Sure you have. A nice X clock, of course. You start your xclock with this command.
Actually, the chime is just a beep, but hey. Last year was ages ago, but think back. Every application that runs during an X session has a number of parameters associated with them. We covered some of these when we talked about X Resources. These include geometry, colormap, and others. Using the command xwininfo you can find out all sorts of information about the current running application. Simply type xwininfo -all then click on the window you are curious about (like that xclock for instance).
Back in the resources discussion, I had you modify things in a .Xresources file. Actually, many X applications allow you to modify their resources right on the command line. Let's use that silly xclock for an example. When it starts, you get a gray background with black hands. One of the resource flags or modifiers that I can give an X application is "-reverse" (or "-rv" for short). Let's try that.
xclock -reverse &
Now, the hands are white instead of black. Other parameters that you might want to experiment with include "-title" which lets you change the title text on a window. The "-iconic" parameter starts a window iconified. Don't like the color? In that case, use "-foreground" or "-background" and use a different color. Size matters, so adjust it to your tastes with the "-geometry" flag. Try these for fun.
xclock -iconic & xclock -title "RoundClock" & xclock -background "SteelBlue" & xclock -foreground "Red" & xclock -geometry 250x250 &
When it comes to tweaking your X environment, one fascinating program you should be aware of is xvidtune. xvidtune gives you an interface through which you can adjust the video modes, making your display wider, taller, narrower, or whatever. There are two sides to the xvidtune display. One shows your vertical settings while the other shows your horizontal settings. To make display tweaks with xvidtune, simply click any of the adjustment buttons (left, right, wider, taller, etc), then click "Test" to see the results on your screen. If you like what you see, then click "Show". This will give you an updated ModeLine configuration which you then add to your XF86Config file. A quick tour through the file (usually at /etc/X11/XF86Config ) will show you several defaults.
If you want to tweak your X display settings, then try this. Immediately after starting xvidtune from the command line, click on "Show" and make a note of those settings. Here's what mine look like.
Vendor: Unknown, Model: Unknown Num hsync: 1, Num vsync: 1 hsync range 0: 30.00 - 70.00 vsync range 0: 50.00 - 180.00 "1024x768" 85.00 1024 1032 1152 1360 768 784 787 823
The last line is the result of me clicking "Show" after starting xvidtune. The lines before are printed out when xvidtune starts. Now, have a look in your XF86Config file. Do any of the ModeLine parameters look familiar? One of them should be an exact match. After fiddling with the horizontal numbers a bit, then hitting "Test" followed by "Show", I get this modified version of my settings.
"1024x768" 85.00 1024 1032 1152 1396 768 784 787 823
What this does by the way (since my screen looked just fine before I started to muck about) was make it narrower. I took the above line, and added it to my /etc/X11/XF86Config file just below the original line and commented out the original line (always have a backup). Since my system was working just fine, I didn't want to lose my settings. The point of this is that not every X window configuration looks perfect and not every screen lets you modify its settings via those little buttons. Furthermore, even on a physical screen, tuning it via the buttons may mean that your X window display looks great, but your text screens are out of whack.
We'll stop here for today. But before I go (since I am still somewhat in New Year mode), I want to take a moment to thank everyone who has been following these articles for the last year. Your comments and ideas are always appreciated. Furthermore, if there is something you would like to see covered, don't be afraid to ask. I may not get to it right away, but it's fodder for future Corners. So, Happy New Year to everyone and Happy New Millenium! Until next time, remember that a little gratuitous window dressing never hurt anyone. X needs no warning labels.
Free DevOps eBooks, Videos, and more!
Regardless of where you are in your DevOps process, Linux Journal can help!
We offer here the DEFINITIVE DevOps for Dummies, a mobile Application Development Primer, and advice & help from the expert sources like:
- Linux Journal
- Android Candy: Google Keep
- Readers' Choice Awards 2014
- Handling the workloads of the Future
- How Can We Get Business to Care about Freedom, Openness and Interoperability?
- diff -u: What's New in Kernel Development
- Days Between Dates?
- Synchronize Your Life with ownCloud
- Computing without a Computer
- December 2014 Issue of Linux Journal: Readers' Choice