Telling the world about the genius of simplicity

Latest

LILO’s new look, revisited

I recently received an email from a follower of this blog, and it looks like my words regarding the existence of the website I mentioned in a previous post proved prescient. Consequently, I am making a follow-up post regarding this issue. I have uploaded the image to my Copy account, and it may be accessed with the following link: Slackware_Moonboot.bmp

Please refer to my previous post about modifying your lilo.conf file to accommodate the color .bmp file.

Happy Slacking!

The One True Keyboard!

Sorry if this sounds somewhat like a tech-religious title, but I just got to thinking about how to type better, since I use the F1-F12 keys quite a bit, and just got fed up with using the ‘F-Lock’ key to enable them. (I currently own a Microsoft Office Keyboard). I began thinking that since I was going to change keyboards anyway, why not go all the way and get a mechanical keyboard? As you may or may not know, the majority of keyboards made today are of the rubber dome variety, and force your hands to work harder, since you have to bottom out the key before a letter (or character) appears on the screen. The particular keyboard I’m thinking of is comprised of individual switches for each key, complete with springs that buckle when pressed. At the instant the spring buckles, a character is produced on the screen. Since this method is so reliable, one can use one’s ears for audible feedback on when a character has been entered, and thus does not have to look at the screen to verify. There have been reports that typists can hit high speeds when using this keyboard. Which keyboard am I rambling on about, anyway? I wrote a review of it on geekhack.org, and I’ll summarize the relevant parts of it here:

I remember the classic “Model M” buckling spring keyboard, when I was in high school back in the mid-to-late 80′s. I was taking some business class (can’t remember the name of the class, been too many years ago). The machine was a PS/2, and the keyboard was, of course, a Model M. At the time, I didn’t give much thought to the sound the Model M makes as one types on it; I just thought that was the way the keyboard was supposed to sound. How little did I know how right I was (although I can definitely empathize with the people who complain about the noise; this keyboard is definitely not silent, although that’s the trade-off you made for choosing a great keyboard).

Since proficiency in coding and writing essays has become somewhat of a “holy grail” for me, I have since revisited the topic of keyboards. Some time ago, I started researching what makes a keyboard great, and have come away with the impression that IBM did it right almost 30 years ago — great tactile feedback via buckling springs, extremely durable construction, completely standardized layout, and operating system agnostic.

I use Linux (Slackware to be specific), and after great deliberation, have come to the conclusion that the Model M (and its successors) follow the UNIX philosophy: Do one thing, and do it well. The keyboard is, above all, meant to be a text entry device, whether you are using it to compose essays, write web pages, or for programming. No more, no less.

 

If you want a quick bit of history on the Model M, you can read it here.

Since IBM (and Lexmark) are no longer manufacturing keyboards, Unicomp (a subcontractor to Lexmark) purchased the rights to the Model M, and are manufacturing modern replicas of them. I took the liberty of ordering one. Warning: If you want a well-made keyboard, expect to pay more than the piddly $20 or so you would at Wal-Mart or similar retailers. This one cost 4x that, and I consider it a bargain.

Here’s a picture of the black beauty, in case any of you are interested:

unicomp_model_m

For comparison’s sake, here’s a picture of the original IBM Model M:

ibm_model_m

Visually, they are quite similar, except for the brand name, color, connector (USB instead of PS/2), and other minor details.

Now, why did I not get a keyboard with the Windows key on them, you may ask? Because I despise the Windows key. I have never, in all my years of owning keyboards, make use of the Windows key. I despise Microsoft for taking the clean layout of the Model M, and messing it up.  That is purely a subjective opinion; you make take it as you will.

I can’t wait to get mine in the mail, sometime this week!

Make KDE’s Konqueror display man pages automatically

If you’re anything like me, if you’ve been around Linux for awhile, you find yourself referencing man pages quite a bit to learn how something works. The traditional way to display man pages is through a terminal session. The problem (for me, at least) is that navigating the whole of the man page is irritating, to say the least. You have to use the keyboard to go up and down the man page, and that gets old real quick when the man page is long, and the information you need is at opposite ends of the page (which tends to be the case more often than not, if Murphy has his way). Well, there’s a solution. The KDE developers, in their infinite wisdom, endowed their own web browser, Konqueror, with the ability to display man pages. There’s only one problem. There is no easy way to go directly to the man page of the command you want (at least none that I was able to discover). So, in the traditional Unix way, I set about looking for a solution using existing facilities. It did not take me long to find it. The ‘man’ command has an option switch which gives the location of the man page of the command that one wants, which Konqueror needs to display the page.

I opened a pico session, using pico /usr/local/bin/kman, and typed in the following:

#!/bin/bash

if [ -z "$1" ]; then

        echo “You did not enter a user command.”
        echo “Please enter a user command.”
        exit 1
fi

if man -w $1; then

        /usr/bin/konqueror man://$(man -w $1) &
else
        echo “There is no man page for your entry. Please enter a valid command.”
        exit 1
fi

For those of you unfamiliar with shell scripting, here’s a quick rundown: the -z option of the if statement tests for a null value; in this case, that would be $1, or the first character(s) after the command, which, in this case, would be the man page of the user command which we are interested in. The reason for this is to test for a null entry; that is, if one just entered the kman command and pressed <Enter>.

The second test may be a bit more obscure, and needs a little explanation. (I had to look this up myself). It tests to see if the man command was successful, which it will not be if one enters a command for which there is no corresponding man page, or just enters pure gibberish. If it is successful, the next line of code will be executed.

The -w option of the man command gives us the location of the man page in question; $(man -w $1) passes the location of the man page to the command line, right after the man:// portion. The ampersand (&) tells the shell to run the command in the background; otherwise, you would not be able to use your terminal session until after you closed Konqueror.

So there you have it, Slackware citizens; a quick and easy way to use Konqueror to display man pages on the fly, using built-in facilities. It really doesn’t get any better than that.

Happy Slacking!

P.S. I edited the kman script to add a test for an invalid entry, as well as for a null entry.

P.P.S – I found this great program that’s a part of KDE; kdialog is a program used for shell scripts that want to use a GUI as input, and output an error, also in a GUI. I used it, and found it to be much more useful; all I have to do is to launch it in the quicklaunch toolbar (after I set up the launcher manually, naturally), and up comes a dialog box asking for what I want, which is the command’s man page in this case, and if it’s not found, I use the error option of kdialog to tell the user so. Just what the doctor ordered!

For those who find the concept of using a GUI to interact with kman more appealing, here’s my new revised script:

#!/bin/bash

CMD_MAN=$(kdialog –caption “Kman” –inputbox “Please enter the command for which you want a man page:”)

if man -w “$CMD_MAN”; then

        /usr/bin/konqueror man://$(man -w $CMD_MAN) &
else
        kdialog –caption “Man Page Error” –error “There is no man page for your entry. Please enter a valid command.”
fi

Makes the program a bit simpler to read and understand, in my humble opinion.

Give LILO a new look!

Since the Slackware world has moved on from 14.0, and the world has not yet ended, I thought that a change in the LILO screen was in order. Problem was, there isn’t a whole lot of selection in /usr/doc/lilo-23.2/sample/, and I wanted something a little more snazzy. I was stumped for a solution, until I came across this little gem of a website. For posterity’s sake, I will post the gist of it here (The site mainly concerns Slack 10.0, which was released in the early 2000′s.  I’m concerned that this information will disappear before too long).

What follows is verbatim from the website:

This is a sample for my boot screen settings. I got the wallpaper from a slackware site and used it. I used GIMP to calculate the pixel settings. You can use any wallpaper. Just resize it to 640×480. In gimp choose Image>Mode>Indexed, then save your picture as a .bmp (bitmap).

Put this in the LILO global section.

# boot screen settings
bitmap=/boot/Slackware_Moonboot.bmp
bmp-colors=139,,0,255,,0
bmp-table=40p,384p,1,2
bmp-timer=513p,30p,255,0,0

If anyone wants the .bmp file, email me at mattallmill <at> gmail <dot> com, and I’ll get it to you.

BTW, the bmp-colors, bmp-table, and bmp-timer are already in the lilo.conf file. Just adjust their parameters, copy the .bmp file into /boot, and run lilo You’ll be good to go!

Happy Slacking!


					

Give KDE a Windows 7 Look!

I’m not a fan of Windows, mainly because I dislike the way Microsoft has handled development of it. The Registry, while it was intended to consolidate all of the configuration files of 3.x, has turned into a nightmare, because of the shoddy way software has been written for it; uninstall routines are not comprehensive, removing all the files that the installation put on the computer. Over time, this leads to a slowdown, which can only be remedied by a format and re-install. Which leads to the piracy problem. Microsoft, because of its paranoia concerning its software, elected to employ product keys in the days of Windows 95. While this was a nuisance, it was somewhat tolerable, until XP came along. Then activation was paired with the key. What is so nauseous about this combination is that it can (and has) failed in so many ways, hurting only the legitimate customer (real pirates are not bothered by this; they make cracks for this. Why copy protection has persisted for so long, given its essentially 100% failure record, is and continues to be a mystery to me. Oh, well. Only in the greedy mind could such a scheme make sense, even though its previous forms have not worked).

The preceding paragraph was not meant to be a rant; contrariwise, it serves to help you, the reader, understand that although I do not like Windows, that does not mean that I do not like its looks. I think that Microsoft, for all its faults, designed a kick-ass UI in Windows 7, with 3 new elements to make it stand out from the previous generation (not counting Vista):

1) An icon-only taskbar

2) A new window decoration

3) A new mouse cursor theme

I have found visual and functionally equivalent elements for all 3 of these elements in the open source world. For brevity’s sake, I will only cover how to find the program (or element, as the case may be) and leave it to the reader to find out for himself/herself how to turn all of that into a visually appealing desktop.

1. Although KDE comes with an icon-only task manager, for me it doesn’t come close to the functionality that I have seen in 7. You can download the program, called smooth-tasks, here, and although the webpage says it requires KDE 4.8, that does not mean that it can only run on that version. It runs just fine on current versions of KDE (as of this writing, it is 4.12.1, and you can download it from Alien BOB’s repository here ). The procedure for compiling it is similar to that found in SlackBuilds meant for earlier versions of Slackware (The latest version I could find was 13.37, and you can find it here. ). Be aware, however, that minor modifications will have to be made to make it compile cleanly with the newer version of smooth-tasks. The link given for the SlackBuild will not work with newer versions of KDE (The version of KDE shipped with 13.37 is 4.5.5. A great deal has changed since that time).

2. You will need Compiz for this one. Slackware ships with Compiz by default, but for some strange reason, the user has to supply additional programs that Compiz needs in order for it to work at its fullest potential. You can download the programs here, and after installing them, use the procedure outlined here to implement it properly. (The downloads offered on that webpage are not compiled for Slackware 14.1, and you will run into trouble if you try to use them directly.) As you may or may not already know, Compiz uses Emerald as its window decorator. The Windows 7 decoration does not come with Emerald by default. You can download it here, and import it manually into Emerald. You can adjust the decoration to your liking.

3. Here is the easiest one to implement. You can download the aero cursor theme here. Although the program is under the xfce/ directory, it will work with KDE. Simply download and install it, then select it via KDE’s System Settings panel.

And there you have it. All of Windows 7′s visual appeal with none of the sludge of its internal workings, to say nothing of product keys and activation schemes. Good luck!

And, as always, happy slacking!

How to specify a monitor for full-screen gaming with multiple monitors

OR: HOW TO MAKE KDE REMEMBER MULTIPLE MONITOR SETTINGS

Some months ago, I purchased a 32″ LCD TV to use as a secondary monitor to augment the output of my laptop’s screen; first of all, because it is cheaper to buy a 32″ TV than it is to buy a 32″ monitor, and second, because it is based on the same technology, but with a few changes to make it more suitable for viewing cable. However, I was encountering problems with KDE forgetting the settings I had made when I specified how I wanted my multiple monitors set up.

I had been running KDE 4.10.5, (the version that comes with Slackware 14.1) and came across a very annoying problem. No matter what I tried, KDE would always treat the LCD TV as a clone of my laptop monitor, and not as an extension, which is the very reason I wanted the extra monitor for. I was very frustrated with having to manually reset the monitors every time I started up my computer, so, in Internet fashion, I Googled for a solution and found this.

The article mentioned using xrandr to automatically set resolution, position, and even to disable output, if I so desired. This, I thought, has possibilities. I looked in my ~/.kde/share/config/krandrrc file, and found this:

[Screen_0_Output_DFP1]
Active=true
Rect=0,0,1600,900
RefreshRate=59.9402008056641
Rotation=1

[Screen_0_Output_LVDS]
Active=true
Rect=0,900,1600,900
RefreshRate=60
Rotation=1

Obviously, this could not be copied and pasted directly into a xrandr command, although it contains all the information needed to make what I needed to happen happen. After some diddling around, I came up with this (I put the script in my home directory under the monitor sub-directory, because I had similar scripts which I found useful, but didn’t want scattered in the home directory’s main listing):

~/monitor/default_multiple_monitor_above.sh:

# Set multiple monitor positions
xrandr –output “DFP1″ –pos 0×0 –mode 1600×900 –refresh 59.9402008056641
xrandr –output “LVDS” –primary –pos 0×900 –mode 1600×900 –refresh 60.0405082702637

All I had to do in the system settings is, under the ‘Startup and Shutdown’ category, is to specify this script when I clicked on ‘Add Script…’, and voila! No more manually fiddling around with the settings for the monitors. I would always have the monitors the way I wanted them every time I started up my computer.

At around the same time, I was wanting to play an old favorite game: Unreal Tournament 2004.  I wanted to specify that  my secondary monitor be utilized instead of my laptop’s screen. At 32″ and 1920×1080, I thought the game would look absolutely glorious; more so than on my laptop screen. After having been introduced to xrandr in the process of solving KDE’s shortcoming, I decided to delve into xrandr’s man page, especially after seeing that one of its options was to disable a specific output. Combining this option with xrandr’s ability to set a specific resolution, I thought that maybe I could write a shell script that would, in effect, disable the laptop’s screen, set the LCD TV’s resolution to 1920×1080, launch the game, and then, after the game was finished, return the settings to what they were before. Because I had read some time ago about the shell script’s behavior of waiting for all the programs to finish before terminating, I thought: “Why don’t I just put all of these elements together and see what comes of it?”. Here is the result of my cognitive rumblings:

From /usr/bin/ut2004:

xrandr –output “LVDS” –off
xrandr –output “DFP1″ –pos 0×900 –mode 1920×1080 –refresh 59.9402008056641 –primary
sleep 2
cd /home/mattallmill/.wine/drive_c/UT2004/System/
./ut2004-bin-linux-amd64
xrandr –output “DFP1″ –pos 0×0 –mode 1600×900 –refresh 59.9402008056641
xrandr –output “LVDS” –primary –pos 0×900 –mode 1600×900 –refresh 60.0405082702637

Look through it, and you’ll see what I did. Note, however, that I added the ‘sleep’ command. This is necessary to give the xrandr command time to set up the monitors before UT2004 launches.

Note also that this method will work for any full-screen game, not just UT2004. I used it only as an example. I also have used the above script for Quake I combined with the Darkplaces engine and the appropriate graphics mod (You can find the SlackBuild for Darkplaces here, and the mod to fully bring out the abilities of the engine here).

I hope this helps others who have had trouble with full-screen gaming  and/or having KDE remember multiple monitor settings  under Linux in the past.

Happy Slacking!

Play Blu-Ray discs on Slackware Linux

I was casually browsing Linux news today, and happened to come across an article on Phoronix which discussed the recent release of libbdplus, a library that’s designed to decrypt the Blu-ray disc DRM. (More information about DRM can be found here and here). As I continued reading, I realized that more than that one package would have to be installed to enable Blu-Ray disc playback: namely, libbluray and libaacs. Also, I would have to find the database key which VLC, the multimedia player front-end, would need to have in order to play Blu-Ray. Armed with the Phoronix article, I set about finding the source code for all three packages: libbdplus, which, as mentioned beforehand, is designed to defeat the evil DRM; libaacs, which is designed to implement the Advanced Access Content System specification; and finally, libbluray, which is an open-source library designed for Blu-Ray Discs playback for media players, like VLC.

Since I object strongly to the implicit requirement of Hollywood, MPAA, Microsoft, and various commerical software producers that I install that other OS in order to play, on my own computer, a Blu-Ray disc which I legally bought, I decided to look into how to enable Slackware, via VLC, to play Blu-Ray discs.

I don’t believe in just giving away the Slackware packages. Besides, the versions could change, whereupon any downloads I could make available here would become irrelevant. As the old saying goes: Give a man a fish, and you feed him for a day; teach a man to fish, and you feed him for a lifetime. So now I’m going to teach you how I enabled VLC to play Blu-Ray.

If you wish (as I did) to make formal Slackware packages out of the following sources, Alien BOB’s SlackBuild Toolkit may be of use to you. Be sure to read the tutorial on SlackBuilds.org if you’re unsure about building your own Slackware packages. Slackware’s packages are stored in tarball format, which is far simpler to work with than other distributions, in which the independent creation of packages is not encouraged. Also, the tutorial on slack-desc files is worth a read, if only to ensure that the description will display when installing the package.

First, you’ll need to make sure to have the latest version of libaacs (or  upgrade it if you have an older version installed),because libbdplus depends on it. You can download the source here.

Second, you can build and install libbdplus, the source for which can be downloaded here.

Finally, the source for libbluray can be downloaded here.

The Phoronix article also mentioned needing to have a multimedia database key. This one was a bit of a challenge because, to the uninitiated, a Google search would be fruitless unless you gave it proper search parameters. When I did so, this website popped up, which will tell you everything you need to know where to download the key file to.

I hope this little tutorial will get you started on the path to Blu-Ray nirvana.

Happy Slacking!

Follow

Get every new post delivered to your Inbox.