...making Linux just a little more fun!

<-- prev | next -->

# LG Tips

## 2-cent-tips

2-cent tip: Desktop Icon Text Color under KDE
2-cent tip: Using two computers with one kbd/mouse
2-cent tip: Using your text consoles from remote locations
2-cent tip: Recording live playback using ALSA
2-cent tip: vpac for Vim

### 2-cent tip: Desktop Icon Text Color under KDE

Brian Bilbrey (bilbrey at orbdesigns.com)
Sun Apr 9 14:19:33 PDT 2006

Answered by: Brian, Thomas

Google didn't help. Usually when I go to find these things, Google takes me to one of my own posts, so I can smack myself around as I gripe that "I used to know that". Even though I've put myself through this in prior iterations, I must never have posted it. Now it's time to get this information out there so that I won't be insane (over this particular issue) ever again...

Setting KDE's desktop icon text color has always, always made me insane. It's not in the same place with all the other color settings, oh, no! To set most item colors in a KDE setup, you use the Control Center, select Appearance & Themes, then Colors. A simple easy-to-navigate interface for setting almost every foreground, background and select color under KDE. But if you want to set Desktop text color ... well, that's not listed. I always end up poking and prodding for a considerable while. I found it again, today, and wanted to put it up for me and others to find. So, to set the KDE (versions 3.4 and 3.5, at least) desktop icon text, from the Control Center select Appearance & Themes. Choose Background from the sub-menu. Yeah, Background. Who knew? Then, click on the Advanced Options button. There are three sub-panes in the resulting dialog. The first, Background Program is usually all I see before bailing out of that dialog. But keep looking. Further down, there's Background Icon Text. Not Desktop, oh, no. And that's not to be found in the general color settings tab, for heaven's sake, no! Now I understand the reasoning behind where it is. But since for all the rest of the world, that's the Desktop, why not call it that, or make it easy to find using the Desktop term. And, praise Baal, why not let people change that text color in the standard tool as well as in the special secret place!

PS: Also "published" on my own site, on Monday, April 10, 2006. No worries!

[Thomas] - (Quoting Brian) Setting KDE's desktop icon text color has always, always made me insane.

> Hehe. And in FVWM all that would need is one or two colorset definitions and then:

>         Style * IconTitleColorset <n>, HilightIconTitleColorset <n>

> ... never mind, though. :)

[[Brian]] - Yes, I know. And when I get tired and need things simplified, there's always *box (most often fluxbox). I often don't know why I keep dropping back to KDE - I think I like the kicker. I know that I use those icons on the desktop once in a blue moon, and really should just turn off "Background Icons". That would be another solution to my dilemma.

> I even dabble in FVWM from time to time, and have a carefully saved FVWM configuration someplace safe (safe == well hidden). Find and locate are my friends, though.

> Bottom line, however, was that finding that setting was a PITA, and I'm glad I did it, and documented it. I also bugged it as a wishlist item with the KDE team.

### 2-cent tip: Using two computers with one kbd/mouse

Kapil Hari Paranjape (kapil at imsc.res.in)
Sat Apr 29 20:58:37 PDT 2006

Answered by: Kapil

Hi,

If some of you are unlucky(:)) enough to get confused because you have two computers on your desktop and you forget which keyboard/mouse is connected with which computer then this tip may help.

You need to choose "master" which is the computer connected to the keyboard/mouse you will actually use. You can later put away the mouse and keyboard of the other computer in order to avoid getting confused. The "master" must be an X-window machine(*) but the "slave" can be anything.

After you execute these steps and "go west" off the screen on the master your keyboard and mouse events will be directed at the slave. (**)

You need to install "x2x" and "x2vnc" on the master.

"slave" is also X-window.

       From the slave log in to the master using ssh X forwarding

    		slave:$ ssh -X luser at master

    	Then run "x2x" on the master via this ssh session as follows

    		master:$ x2x -from :0 -to $DISPLAY -west &

    	Here you replace west with the appropriate direction (west
    	equals left and north equals up) in which the monitor of the
    	"slave" is.

"slave" is Linux in "console" mode.

    	On the slave you run "linuxvnc"

    		slave:$ linuxvnc &

    	This will give you a port number (usually 5900) which you
    	must use below. I'll use 5900 as the port since that is
    	standard. Next start an ssh tunnel to the master.

    		slave:$ ssh -f -N -R 5900:localhost:5900 master

    	Finally on the master you run

    		master:$ x2vnc -west localhost:0 &

"slave" is "OtherOS".

    	On the slave you need a VNC server like "WinVNC" for Windows
    	and "OSXVnc" for Mac OS X. You also need "ssh" unless you allow
    	the VNC server to accept connections over the net (bad
    	security). You then follow the same sequence:
    		(a) start the VNC server on slave
    		(b) start the ssh tunnel on slave
    		(c) start x2vnc on master.

(*) I know that I should use the term "machine which is running an X-server" instead of X-window machine but I hope the nomenclature is clear enough. (**) There are other options like clicking in a window to switch the focus but this "trick" of going west seemed the neatest.

Hope this magic helps someone.

[Kapil] - Here is another way to do this---synergy. You can find this at

> http://sourceforge.net/projects/synergy2

> There are also Debian packages.

> The simplest possible config.

> On the master you create a file called (say) synergy.conf that contains:

>     	section: screens
>     		center:
>     		lefty:
>     	end
>     	section: links
>     		center:
>     			left = lefty
>     		lefty:
>     			right = center
>     	end

> you then run:

>       synergy -c synergy.conf &

> On the slave you run:

>     	ssh -f -N -L 24800:localhost:24800 master
>     	synergyc -n lefty localhost

> This is simpler than x2x or x2vnc and the master can also be a machine other than Linux.

### 2-cent tip: Using your text consoles from remote locations

Kapil Hari Paranjape (kapil at imsc.res.in)
Thu May 4 02:06:29 PDT 2006

Answered by:

Hello,

You may be on an Xsession that has disabled switching to "console" mode or you may want to access the text console of a remote machine. Whatever it is two programs may be useful. One is "conspy" and the other is "linuxvnc".

"conspy":

> Say you have access to the machine as root. Login and run "conspy 1" where you can replace 1 with the number of the
> console you want to access (don't try this with the vt on which X is running!). http://www.stuart.id.au/russell/files/conspy/

"linuxvnc":

> Suppose someone with root access on the machine is kind enough to run "linuxvnc 1" where 1 has the same meaning as above. You can then connect your favourite vncviewer to "machine:0" and access the console. http://libvncserver.sourceforge.net/

The latter has some advantages in that anyone can be given access without root priviledges. The former is distinctly "faster".

### 2-cent tip: Recording live playback using ALSA

Kapil Hari Paranjape (kapil at imsc.res.in)
Wed May 31 08:57:52 PDT 2006

Answered by:

Hello,

Have you ever felt the urge to record some "live" music while you are listening to it? The following procedure might do what you want.

Prerequisites: The sound on your computer should use a 1.x release of the ALSA drivers and you have alsa-lib (Debian's libasound2) installed.

Assumptions: You don't already have a $HOME/.asoundrc file. If you do, then you need to edit it suitably. You also should not have a
script/program called "recording" :-)

Result: You run "recording -on" to start recording. You then start your live playback. After you have had enough you stop the live playback. You then run "recording -off" and are left with a (large) file containing the recording.

Method:

1. First create a file called "$HOME/.asoundrc" like the one enclosed.

2. Create the links.

       ln -s /dev/null /var/tmp/null.raw
       ln -s /var/tmp/null.raw /var/tmp/record.raw

3. Next install the script "recording" somewhere in your path (download it here.)

4. That's it!

Caveats:

a. This only works for digital live playback through the PCM device of your soundcard. You can use "arecord" for the other devices since these can usually be "captured".

b. Don't forget to copy/convert your recording /var/tmp/sound.raw to a safe location.

c. This only works with audio players that support alsa-lib. To get it to work with other players like "realplay", install alsa-oss
and use "aoss realplay" instead of "realplay".

d. You usually cannot run "recording -on/-off" while the player has the audio device open. For many players (in particular those like (c) above), you must quit the player before and after recording.

e. The supplied .asoundrc converts the incoming audio to CD format. This may lead to a loss in quality but I prefer it to "guessing" the real format of the raw data in each case.

### 2-cent tip: vpac for Vim

Mike Lear (mikeofthenight2003 at yahoo.com)
Tue Jun 6 03:07:02 -0700 PDT 2006

Answered by:

As a Linux and Vim user, I like to use Vim to write programs and subroutines in various programming languages. I developed 'vpac' as a series of programming aids for Perl, gcc, g++ and asm, using Vim as the focal point.

'vpac' and its related files allow you to compile, debug and run programs all within one Vim session. Another feature is the ability to comment/uncomment existing code with a single keystoke.

'vpac' works like a global makefile in that you can build several small files into one executable file. It detects the programming language that you are using and selects the appropriate compiler/assember. 'vpac' can also carry out mixed language builds, i.e. c/c++ and asm.

It is easy to use - all the commands are run from function keys.

'vpac' comes as a tar-gzipped package which includes various 'Howto's and all of the source code.

Regards,

Mike Lear

Talkback: Discuss this article with The Answer Gang

Copyright © 2006, . Released under the Open Publication license unless otherwise noted in the body of the article. Linux Gazette is not produced, sponsored, or endorsed by its prior host, SSC, Inc.

Published in Issue 128 of Linux Gazette, July 2006

<-- prev | next -->