Archive for December, 2012

On My Header Image

In what is probably the biggest visual change since I first created this theme back in ’05 — yes, it’s that old! — on June 2, 2011 I replaced the header image with a picture I took a month prior in the Keukenhof.

The opportunity presented itself to experiment slightly with decent JPEG compression, rather than simply depending on GIMP’s output, which unfortunately is virtually guaranteed to be suboptimal. Since all I did was crop and resize, I used PNG as my working format. I might’ve been able to use jpegcrop and jpegtran, but since I was going to re-encode in a lossy manner afterward that would have been nothing but needless extra effort.

First I tried cjpeg, which doesn’t support a lot of input filetypes, so I had to save a copy as BMP.

cjpeg -quality 80 -optimize -progressive -dct float -outfile test80.jpg head.bmp

Then I discovered that imagemagick can do the exact same thing, optimized by default and everything. It also uses libjpeg under the hood, so the resulting image is exactly the same.

convert -quality 80 -interlace plane head.png test80.jpg

That results in JPEGs that are about as small as they can get without enabling options that might not be readily supported by all viewers. I wrote a (very) simple shell script to aid with a quick overview of size versus quality.

convert -quality 30 -interlace plane $1 ${filename}30.jpg
convert -quality 40 -interlace plane $1 ${filename}40.jpg
convert -quality 50 -interlace plane $1 ${filename}50.jpg
convert -quality 60 -interlace plane $1 ${filename}60.jpg
convert -quality 70 -interlace plane $1 ${filename}70.jpg
convert -quality 80 -interlace plane $1 ${filename}80.jpg

My rationale is that any quality under 30 is most likely too ugly and anything over 80 will result in a file size that’s too large for my intended purpose of using lower quality — but not low quality — images on the Internet.

I also decided it was time to get rid of my half-hearted concessions to Internet Exporer. This in no way inhibits readability of the content.

Comments (1)

VLC: Control Clone Window With Devilspie2

This is mostly the same post as that one in early 2011, but updated a little for Devilspie2.

My basic use case for combining VLC and Devilspie2 is to automatically output whatever video I’m playing on another monitor in fullscreen. 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 Windows 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 Devilspie2, which is a daemon that can automate all window manipulations, like pinning, moving around, resizing, moving to another workspace, et cetera. In order to do all this, you need to come up with matching rules for windows and put them in LUA scripts.

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 initially 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. In the GUI this can be found if you show all preferences and go to video. Matching these clone windows in Devilspie2 is easy. 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

To understand how Devilspie2 works, reading the manual should get you started. You can normally start creating scripts in ~/.config/devilspie2/. Rather than repeating the simple examples given there, I will simply give you my finished VLC-clone-window script right now.

-- Make sure the clones counter is defined; do nothing if it is
-- This feature requires at least devilspie2 0.22
if (clones==nil) then clones=1; end

debug_print("application_name: " .. get_application_name());

-- VLC clone window
if (get_application_name()=="VLC clone window") then
	debug_print("clones: " .. clones);
	debug_print("Window Name: " .. get_window_name());
	debug_print("Application name: " .. get_application_name())
	if (clones==1) then
	-- Reset clones counter when it reaches two
	if (clones<2) then
	-- I'm not entirely sure what's going on here, but VLC seems to override this setting shortly after creating the clone window.
	os.execute("sleep .1");

-- VLC main (control) window
if (string.find(get_application_name(), "VLC media player")~=nil) then

I think that’s fairly self-explanatory. The clones variable counts the number of clone windows and resets itself when it reaches two (which is how many I use). You might wonder why I didn’t simply count to three, which is mostly for historical purposes. However, when I see VLC clone window on my taskbar that makes things a little more straightforward for myself. The hardest part is probably the fact that unlike in most languages I know, ~= is used instead of !=. Additionally, nil is used instead of null. If you have even a passing familiarity with a C-based language like ECMAscript, Java, or PHP, you should have no trouble with this very straightforward language.

Comments (1)