We've moved!

TechKnack.blogspot.com has officially moved to TechKnack.net. You should be redirected in 3-5 seconds. Thank you.
Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

July 18, 2008

SecureSMB Script

Add this post to Del.icio.us. Del.icio.us (0 saved)

Do you have a wireless notebook with Samba shares that contain copyrighted materials? For example, your music collection? But you only want to share it with your Xbox Media Center while you're on the home network -- sharing anywhere else could result in copyright infringement. It's a hassle to disable your shares every time you go somewhere, eh?

Well, I've written a script which monitors your wireless connection and, should you hop on the wrong network, shuts down your Samba service. When you get back on your home network, it restarts the service. Isn't automation wonderful?

Alright, so maybe I have a little too much free time. Whatever. Download the script, try it out, leave your comments here or through email, and enjoy. Distribute it yourself if you feel like it, but leave the bylines intact. Oh, and the script does need sudo/root privileges, so you should probably put it in /etc/init.d or similar.

July 15, 2008

Konqueror's "Create new" Menu under KDE4

Add this post to Del.icio.us. Del.icio.us (0 saved)

A while ago, I posted how to edit Konqueror's "Create New" menu. Unfortunately, installing the KDE4 desktop seems to nullify this trick. This is because KDE4 redirects Konqueror from /usr/share/templates to /usr/lib/kde4/share/templates . Annoying, really. There are two solutions.

First solution is to copy your files from /usr/share/templates to /usr/lib/kde4/share/templates . Then either stop worrying about /usr/share/templates, or sync them whenever a change is made.

Second solution is to symlink (create a shortcut to) /usr/share/templates from /usr/lib/kde4/share. To do this, first move /usr/lib/kde4/share/templates to a "backup" state (like /usr/lib/kde4/share/templates.old ): sudo mv /usr/lib/kde4/share/templates /usr/lib/kde4/share/templates.old Then create the shortcut: sudo ln -s /usr/share/templates /usr/lib/kde4/share/ And voila, you are back to maintaining one directory.

July 9, 2008

Re-associate FireFox 3 with Thunderbird links

Add this post to Del.icio.us. Del.icio.us (0 saved)

After upgrading to FireFox 3, I noticed that ThunderBird was no longer opening links in FireFox. Unfortunately, there are no Preference entries to modify how ThunderBird opens links, which means going into the Advanced Config Editor (the ThunderBird version of about:config). Just Another Tech Blog (among others) details how to configure ThunderBird to open links in FireFox. My problem? I had pointed ThunderBird to /usr/bin/firefox-2 when FF3 came out (I was still using FF2 at the time). FireFox 3, however, is located at /usr/bin/firefox.

July 6, 2008

Fix Duplicate Collection Entries in Amarok

Add this post to Del.icio.us. Del.icio.us (0 saved)

While many people in this digital age prefer to buy music from iTunes (or other online stores) or, probably more commonly, pirate their music through torrents, I prefer to have the physical disc. I don't use the actual disc much; I rip the songs to my hard drive, and never see the disc again. The advantage is no DRMs on the ripped files (and the freedom to use them how I want), a physical backup should I accidentally delete the files, and, when I'm no longer interested in the music, something I can sell without worrying about a RIAA lawsuit.

With that background, I recently bought a bunch of CDs from BMG Music. When the CDs arrived, I went about doing the normal ripping process, with Amarok playing the last CD that I had ripped. After a while of "updating collection", I noticed that a few of my albums in my Collections pane had double tracks, in the form of "track 1, track 1, track 2, track2" etc. Since there were no obvious buttons in the interface to get rid of the duplicates, I turned to google and found a post on the Ubuntu forums regarding the problem. The first few posters found that deleting the ~/.kde/share/apps/amarok directory and restarting Amarok fixed the issue. Then RosenCrantz posted (and pointed to their blog article) saying that you need to delete "just the files collection.db, collection_scan.files and playlistbrowser_save.xml in case of duplicate playlists." While they mentioned duplicate playlists, it makes sense that deleting and recreating collection.db and collection_scan.files would fix the duplicate collection issue. Oh, and then ExBuM came in and said to go to Tools -> Rescan Collection. Whaddaya know, that one worked. :D

June 24, 2008

Linux-compatible wifi cards?

Add this post to Del.icio.us. Del.icio.us (0 saved)

If you're in the market for a wifi card (be it desktop or notebook) and you're an avid Linux user, you may be interested in knowing if a card will work with linux before you commit to the buy. The authors of passys.nl have set up a user-contributed list of wireless cards and their linux compatibility. You can search the database by manufacturer, chipset, or card interface, and the results are color-coded for easy skimming.

June 1, 2008

I thought only Windows did this?

Add this post to Del.icio.us. Del.icio.us (0 saved)

I ran aptitude dist-upgrade last night, and shortly after the update I received this surprising notification: I did notice that a kernel update was in the mix, so maybe installation reboots are exclusive to kernel updates, but it was a surprising notification nonetheless.

May 20, 2008

Must-Have Plasmoid: QuickLauncher

Add this post to Del.icio.us. Del.icio.us (0 saved)

KDE4 is great. I've always enjoyed the idea of widgets, ever since I discovered Konfabulator back on Windows. However, in the journey from KDE3.x (with panels) to KDE4 (with optional panels and plasmoids), one key component was lost: the quicklaunch menu.

For most plasmoids, you either get it with the default plasma installation, or you can install the extragear-plasma package. (As of Kubuntu Hardy Heron) Neither one of these has a replacement for the quicklaunch menu. The QuickLauncher plasmoid is available from the plasmoids section of KDE-Look.org. The author currently offers a source tarball as well as packages for Kubuntu Hardy (x86) and Mandriva (x86, amd64, and "source-RPM").

The plasmoid still has some quirks that require you to edit configuration files. Add it to your desktop, and it is initially empty, with no indication of its existence. I haven't tried using it with the panel, perhaps someone can enlighten me on that point. To initially populate it, open up a file manager to /usr/share/applications. This will have a bunch of .desktop files which link to various applications. It may also have one or two "kde" directories, which contain KDE3- or KDE4-specific applications. Choose your initial quicklaunch application and copy the .desktop file's path (like /usr/share/applications/kde/konqbrowser.desktop for Konqueror). Open a text editor, such as Kate, and open the file ~/.kde4/share/config/plasma-appletsrc . Don't edit it yet. Press Alt+F2 to bring up the application runner, type "kquitapp plasma", press the Launch button, and don't panic. This will shutdown the plasma desktop (causing the plasmoids and panel to disappear), but your windows (and window manager) should stay where they are. Click inside the Kate window, and Kate should tell you that the plasma-appletsrc file has changed. Choose to reload it.

If you haven't removed the "invisible" quicklaunch plasmoid yet, you should see a section near the bottom of the file that looks like this: [Containments][1][Applets][85] geometry=169,520,24,48 locked=false plugin=quicklauncher Note the plugin=quicklauncher line, telling you that this section controls the parameters for the QuickLauncher plasmoid. Paste the path to your .desktop file a couple of lines below this section, and add "iconUrls=" before it, like so: iconUrls=/usr/share/applications/kde/konqbrowser.desktop Copy the first line of the section you located, and paste it one line above the iconUrls line. Then add "[Configuration]" to the end. The final section should look something like this: [Containments][1][Applets][85][Configuration] iconUrls=/usr/share/applications/kde/konqbrowser.desktop Save the file, press Alt+F2 again, type "plasma", and click Launch. Plasma should load, and you should have the Konqueror icon sitting on your desktop, waiting to be clicked.

To add more shortcuts to QuickLauncher, simply re-open Konqueror to /usr/share/applications , and drag-and-drop any .desktop files on top of the existing icon(s) in the QuickLauncher. You can also drag-and-drop to re-organize the icons within the launcher. To remove an icon, right-click the icon and choose "Remove Icon" from the menu.

The configuration dialog for QuickLauncher allows you to choose how many rows it has and how many visible icons it shows. For a single-row quicklauncher, set "rows" to 1 (obviously enough). For a one-column quicklauncher (my current preference), set "rows" equal to or greater than the number of icons you have.

May 1, 2008

Maintain Your Linux Desktop Through a Fresh Install

Add this post to Del.icio.us. Del.icio.us (0 saved)

This article assumes, for the most part, a reasonable familiarity with sudo, cp, mv, and other simple command line commands. It also assumes that you backup your important data, as any experienced computer user will tell you to. In addition to your important data, you should backup the new versions of the discussed system files, for the simple case that you mistype something and your Ubuntu won't boot, you can go in with a LiveCD and restore the fresh-install-version without much trouble.

With the release of Hardy Heron, many X/K/Ubuntu users will upgrade to the new version. Many already have. While an actual upgrade is possible, my preferred method of "upgrading" is through a fresh install. This resets everything to "factory settings", as it were, getting rid of any junk left lying around from your various tweakings. A fresh start, so to speak. But what about your already carefully-crafted desktop experience? In my experience, I've found that there are a number of things you can do to maintain your desktop through a fresh install.

The main thing you'll want to do is create a /home partition. PsychoCats has an excellent guide on moving your existing home directory. On my system (60GB hard drive), I have allocated about 5GB to my root ( / ) partition, various small amounts to a couple of other partitions, and the rest to my /home partition. Currently (using Kubuntu Gutsy and after installing/uninstalling several programs), I use about 4GB of that 5GB. The benefits of a separate /home partition is that, since all your personal settings and files are stored there, you can safely leave that data untouched during the install.

The next thing to do is to backup all your system-wide settings. This includes your wallpapers (if you're into that sorta thing), sources.list, xorg.conf, fstab, and possibly your grub menu.lst. These are the main things that normally need reconfigured after a fresh install. You can create a new directory on your desktop (which won't be erased if you have a separate partition for it), and put all the backups in there, so they're easy to get to when you're ready to restore them.

If you're into collecting wallpapers, you'll likely want to backup your collection. Whenever I switch to a new wallpaper, I first put it in /usr/share/wallpapers. If you do the same, you can simply copy this folder to the new folder on your desktop. For the rest of the backups, just copy /etc/apt/sources.list, /etc/X11/xorg.conf, /etc/fstab, and /boot/grub/menu.lst to the folder on your desktop. You can use the folowing commands to do it all relatively quickly: $ cd ~/Desktop/ $ mkdir backups $ cp -r /usr/share/wallpapers /etc/apt/sources.list /etc/X11/xorg.conf /etc/fstab /boot/grub/menu.lst ~/Desktop/backups/

A quick explanation of the files to backup: the sources.list tells apt-get where to search for available software. I use several programs which are not in the official Ubuntu repos, and this usually involves adding third-party repos to my sources.list file. I like to back this file up so I don't have to go hunting yet again for the repo info.

The xorg.conf file holds your display settings and other settings relating to on-screen display (such as mouse configuration). Every time I reinstall on my notebook, I have to go in and manually modify the xorg.conf file to enable horizontal scrolling on my synaptics touchpad. Backing up the file allows for quick and easy editing, instead of trying to remember my settings.

Fstab specifies automount details for various partitions. I have two partitions other than my root and home partitions that are setup to automount, as well as several Windows shares that are specified in fstab so as to automate mounting them.

You really only want to backup your grub menu.lst if you have manually modified it for whatever reason (for example, if you have a dedicated grub boot partition). If you normally let Ubuntu auto-config the boot options and don't touch it afterwards, you probably don't need or want to back it up.

Install X/K/Ubuntu as normal, specifying your home and root partitions, and ensuring that the installer does NOT format the home partition. You will be required to format the root partition. During the install, you will also want to create any user accounts that you had before, in the same order that you previously created them. User recreation can also be done after you boot into your fresh install, by using the useradd and usermod commands.

After the install, boot into your shiny new installation. Since you'll need to use root privileges (sudo) to re-integrate your files, you may want to log into a fail-safe desktop. This will give you a command line window, but no window decorations, panels, etc. You won't need them anyway, yet. To view the contents of files, use the "nano" text editor. Do not simply copy all the files back to their original positions. When a distro is upgraded (or reinstalled), system files have a tendency to get modified (case in point: your sources.list). What you want to do is compare the differences between the old and new files, and make changes as appropriate.

First, move your wallpapers back. You can do this without deleting any new, "official" wallpapers by running the command $ sudo cp -r ~/Desktop/backups/wallpapers/* /usr/share/wallpapers/

For the sources.list...well...I don't know of any good way to check for updated repos, other than to change the "gutsy" to "hardy" for each repo line, and run "apt-get update". If the repo doesn't exist, you'll get some output like: Ign http://repo.freecreations.info hardy Release.gpg Ign http://repo.freecreations.info hardy/freeverse Translation-en_US Ign http://repo.freecreations.info hardy Release Ign http://repo.freecreations.info hardy/freeverse Packages Err http://repo.freecreations.info hardy/freeverse Packages 404 Not Found From there, you could try to pull software from your previously-used gutsy repos, but I really have no clue how stable that would be :)

Moving on to xorg.conf. Simply look into your backup file, find out the settings you want, and add those to the appropriate places in the new xorg.conf. You will need to use sudo to edit /etc/X11/xorg.conf with root privileges. The same goes for your grub menu.lst.

For fstab, unless you made some change to your partitions between backing up and reinstalling, you should be able to simply "sudo cp" your old fstab over your new fstab. Of course, you should backup the new fstab, just to be safe, and compare all the numbers afterwards to make sure everything will work after your next reboot.

Now that you've restored all your settings, you should be able to reboot, log into your normal session, and enjoy your familiar desktop experience under the new distro. After reinstalling all your software, of course :)

If you find any part of this guide to be lacking in detail, first use Google, secondly email me at eternicode at gmail.com or post in the comments. As of this post, I have not, myself, aupgraded to Hardy, but I did use this very method to upgrade from Feisty to Gutsy, and I believe this process to still be good for the current distros.

April 28, 2008

Compiz: The Ultimate in Useless Eyecandy?

Add this post to Del.icio.us. Del.icio.us (0 saved)

That's right, it's time for a technologically controversial post. :)

Compiz is the ultimate in eyecandy. Seriously. With wobbly windows; various window-switching mechanisms such as shift-switcher, ring-swither, and regular tab-switcher; a multi-desktop cube; Mac Expose-style effects; some wicked screensavers; and a whole array of window opening, closing, minimizing, focus/unfocus, etc animations, it clearly outshines Vista and OS X combined. It's also pretty darn efficient - as I type this, Compiz is using no more than 12MB of memory, and I rarely reboot my machine. :D

However, as cool as it is, I find myself using very, very few of the available plugins in my daily workflow. With my current setup, I have all three window switchers; a four-desktop cube; wobbly windows; open/close "glide", minimize/unminimize "genie", and focus/unfocus "fade" animations; current-desktop and all-desktop Expose effect; show desktop; and the spinning cube screensaver enabled. Of all these functions, though, I only use the cube regularly. I have it setup so that Alt+Ctrl+Left/Right arrow spins the cube, and I use that for switching between desktops. For switching between windows? I use Avant Window Navigator. With an icon for each window, I just click on the one I need to go to. And, of course, the animations, screensaver, and wobbly windows are ever-present and fairly unobtrusive. I just find that the majority of the available effects aren't useful in my everyday workflow. I mean, fish inside my cube? Drawing on my screen with fire? Not only not useful, but a nonproductive use of resources. :)

I suppose the purpose of having so many effects, other than sheer amount of eyecandy, is choice. However, choice or not, a lot of the effects are just plain useless, such as the aforementioned Aquarium plugin.

What plugins do you use on a daily basis, if any? And which plugins do you have enabled that merely gather dust? :)

April 25, 2008

Hardy Heron Up For Download

Add this post to Del.icio.us. Del.icio.us (0 saved)

Ubuntu version Hardy Heron (8.04) was officially set loose yesterday. Existing users can upgrade (instructions available for Xubuntu, Kubuntu, and Ubuntu), download (X/K/U), or torrent (some on LinuxTracker, as well as the official Xubuntu, Kubuntu, and Ubuntu downloads [Xubuntu link was not working last I checked; for Kubuntu, select a mirror site like OSU Open Source Lab to find the torrents]).

Also available from the Kubuntu side is the Kubuntu-KDE4 remix.

Edit: Newly seeded by yours truly, Kubuntu 8.04 and Kubuntu 8.04 KDE4 remix ISOs. Both i386-desktop versions with MD5SUM files.

April 22, 2008

Character Maps for Linux

Add this post to Del.icio.us. Del.icio.us (0 saved)

Ever had to make use of special characters? For example, to put an equation like ∫x² dx in an OpenOffice document? How do you get at those characters, anyway?

In Windows, there's the Character Map, via Start Menu -> Accessories -> System Tools -> Character Map. For KDE users, check out kcharselect. Gnome users should look at gucharmap. I've not had experience with gucharmap, but kcharselect has a very good search feature, "categories", and a description of the selected character.

April 16, 2008

Easy Linux-to-Windows File Sharing

Add this post to Del.icio.us. Del.icio.us (0 saved)

Samba has long been the defacto standard for accessing Windows file shares from Linux. However, there is also a Samba daemon (background service) that, if configured correctly, plays the reverse role -- sharing Linux directories to Windows machines. Unfortunately, proper setup requires you to edit the /etc/samba/smb.conf file, which, like most configuration files, can be rather cryptic.

Enter the GUI solution: system-config-samba. That's the package name in the Ubuntu universe repositories, I don't think the program itself has a proper name other than "Samba" (also check out the Fedora project wiki for the app). It's a sparse little app that gives you GUI access to the settings of the smb.conf file. Once you get the behind-the-scenes details set, though, adding shared directories is a snap.

First make sure you have samba installed (package "samba" in Ubuntu repos). Next, install the samba config package - "sudo aptitude install system-config-samba". The installation should put an entry called "Samba" in your Ubuntu menu (for me, using Kubuntu, it's under "Settings"). If you can't find it there, you can start it from a command line by running "system-config-samba &". Before the program starts, it will ask for your administrative password (same as your sudo password, unless you've changed something around).

Once at the main window, You can begin to appreciate how simple SCS makes configuration, using three main buttons that are very self-explanatory, along with a simple list of currently shared directories.

Before you start sharing, you'll want to setup the basic, general details. Open Preferences -> Server Settings. In the Basic tab, set your Workgroup (the default for Windows machines is usually "MSHOME" -- make sure all your computers use the same workgroup name, to avoid issues) and the computer description. In the Security tab, you set the sharing settings. For my home network, which sits behind a router, I use the "Share" authentication mode and set the guest account to my account, to allow open access to my shared directories. Once that's done, click OK. The program may seem to hang for a second or two - this is just the program restarting the Samba daemon for you, and happens everytime you change the settings for Samba or for a share. Next, setup a new share. I have a separate partition that contains all my music ripped from CDs. Within Kubuntu, I mount this partition as read-only, and remount it as read-write only when I need to modify the files (for example, add new rips or coverart). Here I'm sharing it to "everyone", read-only, under the name "music". Check out nixCraft for a quick rundown on Samba permissions.

If everything is right, you should now be able to access the Samba share from a Windows machine on the same network. I haven't tried this method for accessing the share from a Mac, but presumably you can use the same methods you would use for accessing a Windows share.

April 6, 2008

Put intrusive KDE4 apps in their place

Add this post to Del.icio.us. Del.icio.us (0 saved)

If you've installed KDE4 -- the whole shebang in one fell swoop with "sudo aptitude install kde4" (on Ubuntu) -- you'll have noticed that the environment insists that you use the new-and-improved "KDE4-ready" apps. These apps have package names like "kopete-kde4" and "ark-kde4". However, newer is not always better. Maybe the new version, using the new Qt4 widgets, doesn't have as "clean" an interface as the old version -- Konqueror a case in point, though more due to its changed interface than the use of Qt4. Or another small example: kopete (kde3 version) supports IRC chat, while kopete-kde4 seemingly does not. Yet whenever I type "kopete" at the command line or, more commonly, when it opens at startup, kopete-kde4 pops up. Either way, gimme my old app!

Turns out that part of the KDE4 install process adds a path to the beginning of your PATH variable, /usr/lib/kde4/bin. This is where all the "xxxxxx-kde4" apps reside, ready to spring to life when you type their name. Putting the KDE4 apps aside and bringing the older, more familiar versions to the forefront is a simple matter of renaming and symlinking.

For this example, we'll use Kopete. First, move the offending KDE4 version out of the way; execute the following command: $ sudo mv /usr/lib/kde4/bin/kopete /usr/lib/kde4/bin/kopete-kde4 This renames the program to "kopete-kde4", so you can still start the program if you need to. Next, we symlink (create a shortcut to) the "standard" kopete: $ sudo ln -s /usr/bin/kopete /usr/lib/kde4/bin/ This basically says "create a soft link to /usr/bin/kopete in the /usr/lib/kde4/bin directory". The resulting link file will also be named kopete, letting you call the KDE3 version normally.

While this method works well for smaller apps (Kopete, Konsole, etc), I haven't been able to trust it with more essential programs, such as KDM. KDM has been especially annoying; supposedly you can configure it to use the old KDM by running "sudo dpkg-reconfigure kdm" and choosing "kdm" from the menu, but this hasn't worked for me, and I've tried several times.

March 19, 2008

Search Apt package descriptions

Add this post to Del.icio.us. Del.icio.us (0 saved)

On Ubuntu (or Kubuntu, Xubuntu, etc), the command line package manager is Apt. Many people use the apt-get command to install and uninstall packages. I prefer to use the Aptitude command line program, which is a more robust front-end to apt; it allows you to search packages for keywords, and it gives a bit more human-readable information when managing packages. The usual method of searching packages is to issue the command "sudo aptitude search keyword". Here's an example using the keyword flash: $ sudo aptitude search flash p flashplugin-nonfree - Adobe Flash Player plugin installer p flashrom - Universal flash programming utility p flashybrid - automates use of a flash disk as the root filesystem p libflash-dev - GPL Flash (SWF) Library - development files p libflash-mozplugin - GPL Flash (SWF) Library - Mozilla-compatible plugin p libflash-swfplayer - GPL Flash (SWF) Library - stand-alone player p libflash0c2 - GPL Flash (SWF) Library - shared library p libroxen-flash2 - Flash2 module for the Roxen Challenger web server p m16c-flash - Flash programmer for Renesas M16C and R8C microcontrollers p mobile-basic-flash - Home applet for Hildon p vrflash - tool to flash kernels and romdisks to Agenda VR This method only searches the package names for the search term. To search package descriptions, you can pipe aptitude's output through grep, like so: $ sudo aptitude search . | grep flash p amideco - Decompress flashfiles equipped with an AMI p awardeco - Decompress flashfiles equipped with an AWA p flashplugin-nonfree - Adobe Flash Player plugin installer p flashrom - Universal flash programming utility p flashybrid - automates use of a flash disk as the root p ftdi-eeprom - Tool for reading/erasing/flashing FTDI USB p granule - flashcard program for learning new words p kwordquiz - flashcard and vocabulary learning program p kwordquiz-kde4 - flashcard and vocabulary learning program p libflash-dev - GPL Flash (SWF) Library - development file ...etc... Here we use aptitude's search "dot" wildcard, which effectively lists all available packages. We then pipe this output through grep, which filters out the input to show only lines which contain the search terms.

Unfortunately, grep truncates the input lines, chopping off part of the description. If you find something interesting, though, you can always use aptitude to search for the package name to get the full description.

March 2, 2008

Add entries to Konqueror's "Create new" menu

Add this post to Del.icio.us. Del.icio.us (0 saved)

This has been a point of frustration for me since I first wanted to add "Create new .doc file" to Konqueror's context menu. To the best of my knowledge, there is no GUI method of adding filetypes to Konqueror's "Create new" menu, and there is little or no online documentation that details how to go about adding filetypes, or even how the system works. Grr.

The good news is that it is possible, even easy, to add filetypes to Konqueror's "Create new" menu. Best of all, it only requires adding a couple of files to an existing directory.

The entries in the "Create new" menu are actually called "templates". Which makes sense, since the newly created file is nothing more than a blank template to which you add content. The files that make up the menu entries are .desktop files located at /usr/share/templates/. The .desktop files point to template files located at /usr/share/templates/.sources, a hidden directory inside the templates directory. For my example, I'm going to add a .doc file template, since it is so often used in school. The basic idea can be applied to any file type, though.

First, open the program which can create the file you want to add (in this case, OpenOffice Writer). Create a new, blank document, and "Save as" the appropriate file (be sure to choose the .doc extension, not .odf) in an easily-accessible place (meaning user-accessible, a good place would be your desktop). I believe the name of the template file is used as the default name of the new document, though it will ask you for a filename before creating the file; I simply named my file "MS Word 2003 Doc.doc". After the template is created, fire up a command line and use

sudo mv "~/Desktop/MS Word 2003 Doc.doc" /usr/share/templates/.sources/

to move the template into its new permanent residence. Now go up a level to /usr/share/templates/. You will need root privileges of some sort (either a konqueror instance running under root, or sudoing at the command line). Copy one of the existing .desktop files (I recommend a filetype-specific file, such as the HTMLFile.desktop or TextFile.desktop files) to something like MSDoc.desktop. Open the new file for editing with root privileges (from a command line,

kdesu kate /usr/share/templates/MSDoc.desktop &

). Now you can either delete all the nonessential lines of foreign language code (keeping one line of each of Encoding, Name, Comment, Type, URL, and Icon instructions), and edit the remainder to fit your preferences, or you can copy my file's contents and paste it into your file:

[Desktop Entry] Encoding=UTF-8 Name=MS Word 2003 Document... Comment=Enter Document name: Type=Link URL=.source/MS Word 2003 Doc.doc Icon=document

I leave the Encoding line as-is from the HTMLFile.desktop file I copied it from. Name is the text that will show up in the menu. Comment is the text that will prompt for the new file's name. Type=Link specifies that this file is a link to another file (leave as is). URL points to the template file (which resides in the .source directory). Icon specifies what icon will be used in to identify the file type in the "Create new" menu. For Icon, "document" gives the file the icon associated with document files. The Icon for TextFile.desktop is "txt", and for HTMLFile.desktop, "html". I don't know how to go about finding the correct word form other filetypes, other than experimentation. A couple that seem to work for me include "spreadsheet" for a spreadsheet icon, "openofficeorg23-oasis-presentation" for the Oasis icon for OO Impress. One thing to try would be to open KControl, go to KDE Components -> File Associations, click on any mime type, and click the filetype's icon on the right. You should be taken to the Icon chooser. Select "Mime types" from the dropdown, and search for portions of keywords that match the icon you're looking for. Do not click any icons. To get the name of an icon, hover over the icon, and the chooser should give you a tooltip with the icon's name. Use that name in the .desktop file, and it should present that icon in the "Create new" menu.

If you followed everything correctly, you should now have an entry in Konqueror's "Create new" menu for creating a new .doc file. To recap:

  1. Create a blank template file
  2. Move the template file to /usr/share/templates/.source/
  3. Create a .desktop file in /usr/share/templates/ with the appropriate values
  4. Enjoy your new file-creation capabilities!

To extend functionality, you can, obviously, add template content to your template files. For example, if you develop websites and you're tired of always looking up the correct doctype declaration, you can build an html template file, complete with doctype, and simply create it from the Konqueror context menu. In fact, the existing HTMLFile.html file in my .source directory already has the basic structure of a standard web page. Of course, this isjust an example, and could be applied to other filetypes.

February 7, 2008

KDE4 Update: A Turn for the Worse?

Add this post to Del.icio.us. Del.icio.us (0 saved)

I recently wrote a post about KDE4 and Plasma, and my first impressions about it. Yesterday, I ran aptitude dist-upgrade to find out that KDE4 had an upgrade available. KDE 4.0.1 is here.

The main changes I've noticed since the update is some changed and some missing functionality. The "Add widget" area is no longer; it has been replaced with a "zoom zone". When hovered over, the area expands and gives you a "Zoom out" button. This zooms the desktop out to show all four (or however many) desktops on the screen. To zoom out, you must hover over the corner area again (which is now half as large and in the corner of each "desktop"), though this presents two buttons: one to zoom in by another factor of two, and one to zoom back out to normal. I tried the second zoom factor, and was scared I might not be able to get back :D. Seriously, though, it doesn't work (at all) with compiz; as such, I have no use for it. Fortunately, the "retracted" form of the area is grayed out and unobtrusive. To add plasmoids, you must first unlock them (right-click the Desktop > Unlock widgets), then call up the "add widgets" dialogue (right-click desktop > Add widgets...).

Some of the widgets seem to have had an update as well; most notably, the Digital Clock widget, which I use daily. The change: I no longer have the choice to view a 12-hour clock rather than the default 24-hour clock. Oops.

One nice thing I just noticed: in 4.0.0, whilst dragging plasmoids, if your mouse moved behind a window, the plasmoid would lose focus. You had to go around the open windows to move the plasmoids around. No longer; the plasmoid will continue moving unless you let go of the mouse button. Even behind windows.

Another small plasmoid change, affecting all widgets, is that the per-plasmoid rotate/resize button has been split into individual resize and rotate buttons. It makes sense, but it's slightly annoying for me, since I was used to using the both-in-one button. And it adds clutter to the plasmoid interface. But, it's livable.

I haven't noticed any other changes yet (other than the kde4 apps taking over the kde3.x apps), but I haven't exactly dug deep into the bowels of the available settings.

Overall, the change isn't too drastic (what'd I expect -- it's only a .0.1 update). I miss the 12-hour clock, but that's a fault with the plasmoid's developer(s), not the Plasma devs. The change in functionality of the corner area (the "zoom zone" at the moment) is slightly disturbing -- does the KDE team not know what to do with this area? I would suggest making it a button for the Ctrl+F12 feature (an OS X-style "bring widgets to top and darken the background" feature) and bringing back the "Add widgets" button. The plasmoid resize/rotate button split is the tiniest bit annoying, but livable.

And I eagerly await the day I can choose which widgets are always below and always on top :D

Update: I'm afraid I must apologize for being a bit hasty in my "judgments", as it were. Like my first KDE4 article, this was a "first impressions"-style writeup, detailing the first things I noticed after updating. I have since (at the prompting of my commenters :) ) delved a bit deeper into the update to do what I want to do. while the 12-hour switch in the digital clock plasmoid is a missed feature, ravencrow kindly pointed out that you can switch time modes through the "Regional & Language" section of the KDE System Settings. Select the "Time & Dates" tab, and enter "pH:MM:SS AMPM" for the "Date Format" field. You'll have to restart the X server for the change to take effect, but this will let the clock plasmoid display 12-hour formats again. Yay! As pdx and Sokraates mentioned, and as I so hastily overlooked, the "add widgets" button is still present in the upper-right-hand corner, though you must "unlock widgets" before it will display.

Additional links:
Tux Enclave: KDE 4.0.1 Is Now Available

January 26, 2008

Cleaning a FireFox profile

Add this post to Del.icio.us. Del.icio.us (0 saved)

I'm an avid user of FireFox. I've set my installation up to sync across dual-boot, mainly as part of the Widows-to-Ubuntu crossover process. I can't pinpoint the exact date I started using FireFox, but it's been years...and in those years, I've certainly gathered a fair bit of junk.

Most of that junk is leftover configuration data and files from extensions that I've tried and subsequently gotten rid of. For some reason, the uninstall process of most (if not all) extensions leaves all the about:config preferences. In the case of GreaseMonkey (yes, I do not use GreaseMonkey), it leaves a gm_scripts directory in your profile, containing all the script files you've installed. At the worst, this is simply developer oversight. "Why would they want to uninstall this great extension?? They don't need an uninstall routine!"

At any rate, I've found a short and simple way to clean your FireFox profile. The only things I did differently was 1) leave my bookmarks.html file behind (I use Netvouz :D ) and 2) copy over various tweaks from my old prefs.js to my new prefs.js. A final note: You don't want to copy the entire prefs.js file over; it'll contain all the about:config junk mentioned earlier. Either open both old and new prefs.js files and copy over specific tweaks, or google them up again and re-apply them in the new profile.

Cleaning a FireFox Profile

January 18, 2008

KDE4 - First Impressions of Plasma

Add this post to Del.icio.us. Del.icio.us (0 saved)

The KDE world got noisy last week when KDE4 was released. KDE4 RC2 is easily available to K/Ubuntu Gusty users; simply add the required line to your /etc/apt/sources.list , install the kde4-core package, logout, select KDE4 as your session manager, and log back in to a shiny new desktop. The best part: the KDE4 packages are installed separately from your old KDE3.x packages, so you can switch back and forth between the two with a simple logout/login.

KDE4 is a complete rewrite of the K Desktop Environment: a new hardware abstraction layer (Solid instead of HAL), a new multimedia layer (Phonon instead of aRts), and, with a new desktop shell (Plasma), a radically different desktop experience.

The first thing you'll notice is that all of your icons are suddenly...plasmoided. In Plasma, everything on the desktop is a plasmoid (read: shiny widget). Everything. Well, except for the desktop itself and the panel, which are both plugins. But your icons, clock, taskbar, system tray, even your kicker menu, they're all plasmoids. Unfortunately, this means that deleting a plasmoided icon from your desktop doesn't delete the corresponding file from your desktop directory. To do that, you'll have to fire up the new file manager, Dolphin.
The other change you'll notice, though not as obvious, is a small "icon" in the upper-right of the screen, used for bringing up the "add widgets" dialogue. Strangely enough, the full splendor of plasmoids isn't shown by default; all the default plasmoids (other than your icons) are embedded in a panel at the bottom of the screen.
Oh, yeah, one other thing: the Oxygen theme. The KDE artwork team has come up with a new KWin theme, called Oxygen, which seems to be strangely Vista-esque. The Oxygen icons, however, are very nice and unique. To add a plasmoid to the desktop, open the "Add widgets" dialogue, find your plasmoid from the list, and drag it from the list to your desktop (or to the panel, if you wish). To remove a plasmoid from the desktop, simply hover over it and click the red X that pops up (if you don't see a red X, make sure your plasmoids aren't locked [right-click desktop->unlock widgets]). To remove a plasmoid from the panel, right-click the offending plasmoid and select "Remove this [plasmoid name]".

A right-click on the desktop, though not currently as robust as KDE3.x's, gives you the option to "Configure desktop...". This brings up a fairly simple dialogue that allows you to change wallpapers, wallpaper positioning, background color, and whether or not to show desktop icons. I've found that disabling the "Show icons" option simply closes all currently open icon plasmoids; anytime you add a file to your desktop directory, a trusty plasmoid pops up on your desktop for it.

I've also heard that Plasma has in-built compositing support. I wasn't able to get all the effects to work, and the ones I could get working weren't customizable to my liking. Thankfully, Compiz still works pretty perfectly.

Overall, it's a nice new desktop experience. It's a bit lacking in features at the moment, but that's because it's still in "beta mode"; the 4.0 feature cutoff left "a lot of 90% done stuff". The next release, 4.1, should bring a lot more functionality and customizability.

Additional links:
My January Desktop Screenshot
KDE 4.0.0 Emergency FAQ
KDE4 Visual Guide
Remove the KDE4 panel
LifeHacker: Design Your Own Desktop With KDE4

October 9, 2007

Virtual Desktops - not just for *nix systems

Add this post to Del.icio.us. Del.icio.us (0 saved)

Wikipedia:
In addition to what is provided by the computer's physical hardware display, virtual desktops provide a "virtual" space, in which the user can place their applications' windows. Each virtual desktop occupies a defined portion of the screen arranged in a matrix or grid. Application windows and icons can be moved between desktops, increasing a user's ability to organize their windowed applications that are currently running by reducing clutter.
According to Wikipedia (the biggest source for popular knowledge), Virtual Desktops were first introduced in 1985 by the Amiga operating system. I've never heard of Amiga, but Linux systems have had "native support" for virtual desktops since the GNOME and KDE environments introduced the idea (date unknown). Boot up almost any Linux Live CD, and you are guaranteed at least two virtual desktops to play around with. Apple recently integrated virtual desktops as "Spaces" in Mac OS X Leopard. Complete with a shiny interface for switching back and forth between spaces. Windows...has yet to catch up. Per usual. On the bright side, however, there are many third-party programs that allow the Windows user to have VDs. Most of these programs are free, many are GPL, and all have at least one problem. You can try out the entire list from Wikipedia until you find one that works for you, but my preference is Compass. Compass is "dead" since 2001, as the author puts it, but its code is available under GPL. This is very fortunate, since I believe it could still use some work. But before I go on, here's the feature list from the webpage:
  • Themeing - 3 themes and a template included
  • Multi-desktop support - Not limited to 1 pager
  • Multi-quadrant support - Have as many virtual desktops as you want
  • Want your pager to be always on-top? on-bottom?
  • Move windows around using the pager window
  • Mark sticky windows
  • Hotkey support
Theming capabilities are always a plus (and the template is a PSD file, compatible with GIMP). I haven't tried the multi-desktop support, but it sounds like a nice feature for those with dual-monitor setups. As many desktops as I want? Nice. The always-on-top-or-bottom feature is nice, but this can cause problems. Move windows from desktop to desktop using the interface - very useful. Sticky windows; good for keeping WinAMP, various Yahoo! widgets, and RKLauncher on every desktop. Hotkey support; what keys do you switch with? Ctrl+Alt+Arrow? Win+Arrow? F? Spacebar? While the app still works under Windows XP (dunno about Vista), it is lacking in a few features that would make it near-perfect:
  • Autohide: the always-on-top feature is nice, but without an autohide feature, it tends to get in the way at times.
  • Any-desktop window moving: you can only move windows from the current desktop to another desktop; inactive desktops are automatically switched to when you click, there is no way to drag windows amongst inactive desktops.
  • It touched my registry! While I don't mind a program storing settings in my registry if I've installed it, an app like this should be getting its settings from a file (which would also make it perfect as a portable app!). If you want more than the default of two virtual desktops, you have to merge a reg file.
In spite of these shortfalls, Compass is probably the best Windows VD manager I've come across. No fancy 3D cube effects, but it works. Better yet, my feature requests shouldn't be too hard to add, given that "the code is straightforward C and Win32". This'll probably be a good summer break project for me ;) So, do you use a VDM under Windows? If so, which one? And what do you want in a VDM that isn't offered by Compass? Leave a comment!