#!/usr/bin/perl
# vmkbfix: a script to reset the keyboard layout after switching out of
# a virtual machine.
use strict;
use warnings;
my $orig_kb_model = "pc101"; # The keyboard model
my $switch_kb_model = "pc104"; # The model to switch to briefly
my $SETXKBMAP = "/usr/bin/setxkbmap"; # location of setxkbmap
# briefly switching to a different keyboard model, then switching back
`$SETXKBMAP -model $switch_kb_model`;
`$SETXKBMAP -model $orig_kb_model`;
Showing posts with label perl. Show all posts
Showing posts with label perl. Show all posts
Sunday, May 11, 2008
VMware keyboard annoyances on Ubuntu 8.04 (Hardy)
Like several other people I've had issues with my keyboard modifiers (shift, alt, ctrl, etc.) when switching from the guest OS (Windows) back to the host (Linux). Apparently, the easiest fix for this is to use the gnome keyboard layout gui to briefly switch the keyboard map to something random, then back to the original layout. So, here is a short perl script that does the same using the setxkbmap utility. If you want to use it, make sure to change the $orig_kb_map variable to match your keyboard model. You can create an application launcher on your Desktop or panel and simply click it regain control of your keyboard modifiers. Until there is an official fix for this bug, this is at least bearable.
Saturday, May 10, 2008
sqlite rocks!
I feel like I'm late to the party on this one, but I just discovered sqlite and the associate Perl module, DBD::sqlite. For those that are later than me, it is an implementation of SQL that resides in a single file, with no setup of any kind involved. I'm using it to store data that I frequently need only portions of in my Perl program. This provides a powerful & elegant way of doing just that. I hope you find it as useful as I do!
Subscribe to:
Posts (Atom)