Hack 22 Use Your Linux Desktop Settings

 < Day Day Up > 

figs/moderate.gif figs/hack22.gif

When you boot Knoppix on top of an existing Linux desktop, it is relatively easy for Knoppix to use files and settings on the system underneath .

If you've been a Linux user for some time and have your desktop application settings just right, you might be annoyed that the changes that you've already configured once (i.e., your bookmarks and email settings) must be redone under Knoppix. Trying to remember and recreate all your original tweaks and other settings can be a long, boring, and maybe impossible task, as anyone who has lost their home directory can attest to. However, if you boot Knoppix on top of your existing Linux desktop, you can easily import your application settings for use under Knoppix.

This hack covers how to copy settings from commonly used applications under Knoppix when you are booting on top of your normal Linux desktop.

3.3.1 There's No Place Like /home

The first step in exporting your desktop settings is to find your home directory. While the details vary depending on how your hard drive is partitioned, Linux installations generally have /home as a directory under the root partition or on its own partition. If you're uncertain how your hard drive is partitioned, you should still be able to find your home directory without much trouble. To start, click each hard-drive icon on the desktop in turn and see which directories exist within. You're looking for a directory with the pattern /home/ yourusername . Once you find the partition that has your home directory, make a note of how the icon was labeled; this is the partition name and should be something like hda3 .

Now that you have identified your home directory, the simplest method of importing your user's settings to Knoppix is to copy each application's hidden directory or configuration file. Most applications store their user-specific settings in hidden files in the home directory, and importing these settings is as simple as recursively copying the hidden directory to /home/knoppix/ . Details are provided below for some applications that require a bit of extra work to copy correctly. In all of these examples, I use /mnt/hda3/username as the home directory, but you will need to change the path to correspond with the location of your user directory.

While it might seem that it would be even easier to symlink /home/knoppix or individual configuration directories to your home directory, your Knoppix user would not easily have write access to the drive, due to the differing user IDs.


3.3.2 KDE

To copy all of your KDE settings correctly, including all KDE application settings, you must make sure that KDE is shut down so that session files aren't written to after you restart KDE. Session files are records of window settings and open applications that KDE keeps stored in memory until it shuts down. To do this, close all running applications, then open up a terminal window. To switch to console-only mode, type:

 knoppix@ttyp0[knoppix]$  sudo init 2  

Once you are in the console, move your current Knoppix KDE settings out of the way temporarily and copy your Linux user's KDE settings:

 root@tty1[/]#  mv /home/knoppix/.kde /home/knoppix/.kde.bak  root@tty1[/]#  su knoppix cp -a /  mnt/hda3/username    /.kde /home/knoppix/  

If you make use of a .kderc file, copy that as well. Now restart KDE to be presented with your Linux user's normal KDE desktop:

 root@tty1[/]#  init 5  

If you are content with the current settings, free up space by deleting the backup .kde.bak directory that you have created. If you want to switch back to how the KDE desktop was before, switch again to console-only mode:

 knoppix@ttyp0[knoppix]$  sudo init 2  

Then remove your new KDE settings, restore your old KDE settings, and start the KDE desktop back up:

 root@tty1[/]#  rm -rf /home/knoppix/.kde  root@tty1[/]#  mv /home/knoppix/.kde.bak /home/knoppix/.kde  root@tty1[/]#  init 5  

All datafiles and directories on a KDE desktop are stored in the /home/username/Desktop directory. If you want to just copy your Linux desktop over the top of the default Knoppix desktop, follow a similar procedure. First, drop to console-only mode by typing:

 knoppix@ttyp0[knoppix]$  sudo init 2  

Then back up your current desktop, copy the new desktop, and start KDE:

 root@tty1[/]#  mv /home/knoppix/Desktop /home/knoppix/Desktop.bak  root@tty1[/]#  su knoppix cp -a /  mnt/hda3/username    /Desktop /home/knoppix/  root@tty1[/]#  init 5  

After KDE starts, your user's desktop icons and files are in place of the default Knoppix ones. Similar to the KDE settings, to restore your old desktop, drop to console-only mode again by typing:

 knoppix@ttyp0[knoppix]$  sudo init 2  

Then restore the settings, and start KDE:

 root@tty1[/]#  rm -rf /home/knoppix/Desktop  root@tty1[/]#  mv /home/knoppix/Desktop.bak /home/knoppix/Desktop  root@tty1[/]#  init 5  

3.3.3 Other Applications

To copy the settings of most other applications, you don't need to drop to console-only mode. Simply make sure that the application itself is closed, which ensures there aren't any related temporary files open. Most program settings can be copied with a single, recursive copy of the configuration file or directory. For instance, to copy Gaim settings, run:

 knoppix@ttyp0[knoppix]$  cp -a /  mnt/hda3/username    /.gaim /home/knoppix/  

Or drag-and-drop the directory to /home/knoppix from a file manager. The following table lists some other common applications and the commands to copy their settings:

OpenOffice.org

cp -a / mnt/hda3/username /.OpenOffice.org/* /home/knoppix/office/

The GIMP

cp -a / mnt/hda3/username /.gimp* /home/knoppix/

Xine

cp -a / mnt/hda3/username /.xine /home/knoppix/

XMMS

cp -a / mnt/hda3/username /.xmms /home/knoppix/

Xchat

cp -a / mnt/hda3/username /.xchat2 /home/knoppix/


By now you've probably noticed a pattern in the commands used to copy program settings. Most programs use the convention of naming their settings directory after the name of the program itself. If you are unsure of the name of the hidden directory that an application uses, before and after running an application for the first time, check the hidden files in your home directory by typing the following command:

 knoppix@ttyp0[knoppix]$  ls -a /home/knoppix  

Any new hidden directories that were created likely belong to that program.

One program that requires a bit of extra work to import settings from is Mozilla. While Mozilla does create a .mozilla directory when it is run, the directory containing the actual settings for a profile is inside the .mozilla directory and is given a random name that is unique to each user on each machine. This is a security measure that prevents a malicious script from easily target a known settings directory. If you simply copy the .mozilla directory to /home/knoppix , you will discover Mozilla ignores your settings.

To copy the settings properly, identify the random directory name Mozilla used for your settings by running Mozilla at least once under Knoppix. After you run Mozilla, the settings directory appears under /home/knoppix/.mozilla/knoppix/ xxxxxxxx .slt , with xxxxxxxx being replaced with random characters . Here is an example:

 knoppix@ttyp0[knoppix]$  ls /home/knoppix/.mozilla/knoppix  ujixazk6.slt 

Find the same directory for your Linux user under /mnt/hda3/username/.mozilla/username/ yyyyyyyy .slt or, if you don't have a profile named after your user, check /mnt/hda3/username/.mozilla/ for a directory named DefaultUser or something along those lines. As an example, here is the output for my Linux user:

 knoppix@ttyp0[knoppix]$  ls /  mnt/hda3/greenfly    /.mozilla/  default/   3sd9n0b8.slt 

Once you have identified both directories, copy your Mozilla settings with the command:

 knoppix@ttyp0[knoppix]$  cp -a /  mnt/hda3/username    /.mozilla/  username/yyyyyyyy    .slt/* /home/knoppix/.mozilla/knoppix/  xxxxxx    .slt/  

Replace yyyyyyyy and xxxxxxxx with the directory names you have found. Now you can start Mozilla, and your bookmarks, mail and news settings, and all other settings should appear.

If the version of Mozilla installed on your machine differs from the version installed on Knoppix, you may find that your theme does not get moved. This is because most Mozilla themes depend on a specific version of Mozilla.


When copying your settings, be conscious of any major version differences between your local application and the application that ships with Knoppix, as sometimes configuration file formats change with major version releases. If you've spent all this time copying your settings and making the Knoppix desktop exactly how you like it, you should make use of [Hack #21] and make your settings persistent. Otherwise, all of your hard work will disappear the next time you reboot.

 < Day Day Up > 


Knoppix Hacks. 100 Tips and Tricks
Knoppix Hacks. 100 Tips and Tricks
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 166

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net