Archive for Linux

Remote Desktop: Remmina

A quick tip for Ubuntu users: install Remmina instead of (or alongside) the default Vinagre with sudo apt-get install remmina. It’s much better. Not only does it perform better (that is, it doesn’t hog CPU), but it has all the options Vinagre lacks.

Comments

Using Wine to Ease Migration from Windows

According to its about page, “Wine lets you run Windows software on other operating systems. With Wine, you can install and run these applications just like you would in Windows.” That sounds like a good enough description to me.

I have some applications that depend on a specific drive letter configuration, so to be truly able to share applications between Wine and Windows I’ll have to set up my drives in Wine just the way they are on Windows. I may write a post later about how to auto-mount Windows partitions.

Setting up drives is incredibly simple: you start the Wine configuration program and go to the drives tab. There you can set up certain directories or mount points to correspond to certain drives for Windows programs, but you don’t even have to use the GUI. The reason this is useful is because you can run your programs like you were on Windows and they wouldn’t know the difference. As far as the programs are concerned they’re reading data from the same location as always. This greatly simplifies my process of switching to Linux. Rather than having to set up replacement programs and configurations I can simply let Wine pretend to my programs that they’re running in the same (drive) configuration as they would on Windows. This way I can switch more completely to Debian without having to exert a lot of effort at once. I can move away from certain programs more slowly, or perhaps not at all.

I found a Gnome to Wine Color Scraper to improve the look of my Wine applications, but the registry file it generated didn’t work for my version of Wine. I enabled the debugging option and had to edit the parts where it speaks of HKEY_USERS\S-1-5-4\. For me the number was different. Check in regedit for specifics.

There are many more things you can do with Wine, including playing a fair amount of Windows-based games. Check the website for more information on compatibility.

Comments

Lossless Rotation with jhead and jpegtrans

I like my pictures rotated in such a way that I don’t have to depend on application support for them to be displayed correctly. jpegtran (pre-installed on most distros) is a wonderful application with many features, including lossless rotation, but it’s too laborious for my purposes. That’s where jhead comes in.

You can simply go into a directory, run a command like the following, and everything will be done automatically for you.

jhead -autorot *.JPG

Of course I wouldn’t run it if you don’t have a backup available. I always keep the pictures around on my camera until I’ve confirmed that all processing was successful and then I still don’t delete them until the adjusted files were also copied to my external HDD in my semi-regular backup regime.

Another utility that can perform the same task is exiftran, but despite being more or less dedicated to this very purpose it’s not even easier to use: I’d expect exiftran *.JPG to default to the equivalent of the jhead -autorot *.JPG command I posted above, but instead you have to use exiftran -ai *.JPG. All other things being equal for my purposes, I decided to go with jhead because it has many more features — although last year I decided that exiv2 is superior to jhead in ease of use for most of those features.

If you’re just looking for the occasional lossless rotation, you could also try the Geeqie image viewer and manager. It integrates calls to exiftran, but beware that you explicitly have to choose the lossless option, as there are also lossy rotate options.

Comments

Dolby Digital 5.1 Over S/PDIF With PulseAudio

This post describes how I got Dolby Digital 5.1 output working over S/PDIF on my onboard Realtek chip with other audio sources mixed in. Previously I was only able to achieve either 5.1 output by sending the data stream straight to my receiver, or 2.0 output with everything mixed in. The experiences detailed in this post originate in Debian Squeeze, but if what I wrote is specific to anything, it should be my hardware — not Debian and its derivatives. Before you read on, you might want to check out this forum post instead, which describes a method that didn’t work out for me.

PulseAudio 0.9.22 is required; it won’t work on older versions of PulseAudio. Debian Squeeze comes with ALSA 1.0.23; presumably that’s much less significant. On Debian getting this most recent PulseAudio can be done through the experimental repository.

If you’re on Debian ALSA is already setup, including the required libasound2-plugins, but to get the most recent version of PulseAudio you’ll want to add deb http://ftp.debian.org/debian experimental main to /etc/apt/sources.list, and then type apt-get update && apt-get -t experimental install pulseaudio in a superuser terminal (see the Debian Wiki for more information on the experimental repository). On many other distributions PulseAudio is already setup by default, but just like on Debian Squeeze that’s typically still PulseAudio 0.9.21 at present.

On Ubuntu you’d have to recompile libasound2-plugins yourself because it doesn’t include the a52 ALSA plugin by default. The link in the opening paragraph should describe that process sufficiently.

In the System Log Viewer you can keep an eye on syslog for (error) messages from ALSA as well as PulseAudio.

What follows is my /etc/asound.conf, heavily condensed from Johannes Bauer’s Dolby Digital with Linux and ALSA guide. It works quite nicely (with some minor adjustments), but it will only allow one application to utilize audio at a time. One could utilize PulseAudio for stereo while suspending it (with pasuspender) when you want to play a movie or some such with 5.1 audio, but I’d rather mix everything together in PulseAudio so I don’t have to think about it after the initial setup, just like in Windows.

pcm.a52 {
        @args [CARD]
        @args.CARD {
                type string
        }
        type rate
        slave {
                pcm {
                        type a52
                        card $CARD
                }
                rate 48000 #required somehow, otherwise nothing happens in PulseAudio
        }
}
pcm.pulse {
        type pulse
}
ctl.pulse {
        type pulse
}
pcm.!default {
        type pulse
}
ctl.!default {
        type pulse
}

Now that you've got the ALSA configuration in order it's time to make some slight adjustments to /etc/pulse/default.pa or PA won't detect the possibility for Digital Surround 5.1. According to various sources they had some kind of Digital Surround show up automatically, but I had to explicitly tell PulseAudio about its existence. Adjusted from a comment on Ubuntu bug 348353 (which incidentally is why you need PulseAudio 0.9.22).

load-module module-alsa-sink device=a52 rate=48000 channels=6 tsched=0 sink_properties=device.description=SPDIF sink_name=SPDIF channel_map=front-left,front-right,rear-left,rear-right,front-center,lfe

I initially added this line without the channel_map, but then PulseAudio thought I had something like front-left,front-left-of-center,front-center,front-right-of-center,front-right,lfe, which would be a strange setup indeed.

I'm not quite sure whether the channel map might be more appropriate in /etc/pulse/daemon.conf, where I uncommented default-sample-rate = 48000. I also added the appropriate settings for default-sample-channels = 6 and changed enable-lfe-remixing to yes.

pavucontrol is instrumental in quickly seeing what's going on and for application-specific volume settings. Not utilizing it would be a disservice for yourself if you've chosen to use PulseAudio.

Now that we've got all the configuration set up you could reboot the computer, but one of the great things about Linux is that you rarely have to do that other than to load a different kernel.

As user: pulseaudio --kill
As superuser/sudo: /etc/init.d/alsa-utils restart
(As user: pulseaudio -D, but that shouldn't be necessary)

I utilized the surround test ac3 file from Lynne Music (straight to directory). I played it with mplayer -channels 6 to make sure everything was working correctly and to adjust the channel map. At this point everything was finally working fine for me, but most applications still were not cooperating because they defaulted to ALSA. Again, in Ubuntu this shouldn't be an issue.

Various adjustments are still required in most applications. For instance, in Totem you have to explicitly set audio output to 5.1 in Edit > Preferences > Audio.
For MPlayer put channels=6 in ~/.mplayer/config (note that if you can't get PulseAudio to work you could add the equivalents of mplayer -ao alsa:device=spdif -srate 48000 -ac hwac3 file.avi if you so desire).
VLC works fine if Dolby Surround is set to Auto in Tools > Preferences > Audio.

To get the 6 channel output to work in applications that use SDL (Gnash, quite a few games) you'll need libsdl1.2debian-pulseaudio. This will replace libsdl1.2debian-alsa. Of course this won't be necessary if your distro is set up with PA by default.

On a separate note, I set PulseAudio up so it can play audio from all kinds of sources (most notably my laptop).

Comments (1)

Mouse Jail

One of the applications I like to use on Windows is Mousenitor, which enables advanced mouse control for users with more than one monitor. It was written by a friend. I haven’t yet figured out the best way to trap my mouse on one monitor in Linux, but a little application named Jail offers a rudimentary implementation. It was originally written by Sebastian Marion, but I picked up a slightly modified version from the Ubuntu forums.

If you want to compile it yourself you need to grab apt-get install build-essential libx11-dev libxtst-dev in Debian (and presumably the same for derivatives like Ubuntu). For good order I also uploaded the source, including my compiled x64 binary, to my own server lest the original source code might be deleted. Download jail.tar.xz if you want to test it. Edit .JailSwitch.sh to correspond to your system.

The Gentoo Wiki possibly describes more elegant, but more involved methods to obtain a similar effect. I’ll report back if I can get one of those methods to work successfully, and if they do indeed work more elegantly.

Comments

SVN

Just a quick reminder to myself: SVN is short for subversion, so to install it you need apt-get install subversion.

Comments

VLC: Control Clone Window With Devilspie

My basic use case: automatically output whatever video I’m playing in fullscreen on another monitor. If I were using Windows and an ATI card, I’d call it theater mode. nVidia cards also used to have a similar setting related to outputting pure overlay video on another screen, but it was removed from nVidia’s drivers around the time of the release of Vista (and had been made buggy aspect-ratio wise a few years prior to that). Long story short, nVidia’s drivers have really degraded an awful lot since 2006 and I don’t like it one bit.

My answer to this problem is the VLC clone filter coupled with Devilspie, but sadly it’s not quite as straightforward as I’d like. Devilspie is a wonderful daemon that can automatically do everything you can do to windows like pinning, moving around, resizing, moving to another workspace, et cetera. In order to do this you need to come up with matching rules for windows, and sadly it’s a tad more limited in that respect than I’d like. Anyway, you’ll want to grab gDevilspie with apt-get gdevilspie (or sudo apt-get gdevilspie, of course), which should automatically pull in devilspie as a dependency.

Since VLC is named VLC media player when it’s not playing anything, and clone video windows are also named VLC media player, I was having trouble coming up with a means of affecting clone windows without messing up my main window. Then I stumbled on the video-title setting in ~./config/vlc/vlcrc and changed it to VLC Clone Window (I couldn’t find this setting in the GUI). Now matching it in Devilspie was a piece of cake. The primary VLC window is still named VLC media player whereas the clone windows are now named VLC Clone Window.

# Video title (string)
video-title=VLC Clone Window

What follows is something I couldn’t have written as quickly without gDevilspie, but I had to switch some commands around (like putting geometry first instead of last) to obtain the precise situation I wanted, for otherwise VLC returns the window to the original monitor when exiting fullscreen.

( if
	( begin
		( is ( window_name ) "VLC Clone Window" )
	)
	( begin
		( geometry "+1280+0" )
		( maximize )
		( undecorate )
		( above )
		( pin )
	)
)

Now that I got the gist of the syntax I decided to also pin the smaller window on top and extended the configuration file. The official man page is rather lacking, so I recommend foosel’s unofficial documentation instead (via ruario). You can find the generated files, or make your own, in ~/.devilspie/.

( if
	( contains (application_name) "VLC")
	( begin
		(if
			( is ( window_name ) "VLC Clone Window" )
			( begin
				( geometry "+1280+0" )
				( maximize )
				( undecorate )
				( above )
				( pin )
			)
		)
		(if
			( contains ( window_name ) "VLC media player" )
			( begin
				( above )
				( pin )
			)
		)
	)
)

I think that’s fairly self-explanatory. My hope is that matching the application name to VLC will make sure that any other application with a window_name that contains VLC media player for some reason (or VLC Clone Window) will be unaffected.

If you didn’t find this quite as enlightening as you’d hoped, once you’re in gDevilspie everything’s pretty much explained in there, and otherwise the documentation I linked to should be of assistance. The only thing above I’d consider somewhat puzzling at a glance is the offset. The resolution of my monitor is 1280×1024, so the x offset of +1280 makes sure that everything’s on the correct monitor before maximizing. You can also set a window size, so then it’s xwidth x ywidth + xoffset + yoffset all mashed together (or instead of + I imagine you can also use -).

The only problem with this solution is that it’ll put all clone windows on the same monitor. Even though this satisfies my specific use case, I still want to match windows depending on the number of previous also-matched ones still active. For example I can imagine something akin to a tiling window manager on a particular workspace with terminal emulators, except driven by Devilspie and in just about any WM there is (although one might be able to work around that in this particular example with some bash scripting).

Comments

VLC: Make Clone Filter Default

VLC ignores some of its GUI settings. Luckily it has easy, plain text configuration.

Despite enabling the clone filter in advanced video settings, VLC doesn’t seem to want to start with the clone filter enabled. No problem, just open up ~/.config/vlc/vlcrc and look for:

# Video output filter module (string)
#vout-filter=

Replace it with:

# Video output filter module (string)
vout-filter=clone

That’s it. Now VLC will always start with a clone. If you want more clones than the default 2 and VLC ignores the GUI settings as well, or VLC is ignoring some other GUI configuration, now you know where to look for it.

Comments

Parcellite

A while ago I wrote about Glipper, but I seem to be affected by bug #213494, which means that about half the time Glipper crashes on startup; it didn’t use to do that.

There’s a proposed workaround on the linked bug report, namely to add a timeout to the beginning of the Glipper code. It seems to work alright for the most part, but Parcellite offers the same functionality without any of the downsides: it doesn’t depend on Gnome Panel and, of course, it doesn’t crash.

The easiest way to get it is, as always, sudo apt-get install parcellite. A more recent version can be obtained using the Web Upd8 PPA.

Comments

VNC Tunneling on Ubuntu for Safer VNC

ssh -L [local port]:localhost:[remote port] [user name]@[domain]

You can then run the VNC viewer like this:

vncviewer -LowColourLevel 1 localhost:[local port]

The color level setting here is what results in the best mix between speed and prettiness for me.

-LowColourLevel level
Selects the reduced colour level to use on slow links. level can range from 0 to 2, 0 meaning 8 colours, 1 meaning 64 colours (the default), 2 meaning 256 colours.

If you are connecting from Linux to Linux (as opposed to from Linux to XP), more efficient means may be available.

Comments

« Newer EntriesOlder Entries »