Tag Archives: XFCE

XScreenSaver without keyboard layout indicator workaround

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=644534

From: Ilya Sheershoff
Subject: A workaround for keyboard layouts

The following worked for me (Debian Jessie with XFCE 4.10 or Ubuntu 10.04 with GNOME 2.30):

1. Created folder: mkdir ~/.startup
2. And a file: touch ~/.startup/xscreensaver-reset-kbd-us.pl
3. Chmodded it: chmod 755 ~/.startup/xscreensaver-reset-kbd-us.pl
4. Edit (copy&paste the code below): nano ~/.startup/xscreensaver-reset-kbd-us.pl

#!/usr/bin/perl

my $blanked = 0;
open (IN, "xscreensaver-command -watch |");
while (<IN>) {
    if (m/^(BLANK|LOCK)/) {
        if (!$blanked) {
           system "setxkbmap -layout us";
           $blanked = 1;
        }
    } elsif (m/^UNBLANK/) {
        system "setxkbmap -layout us,cz";
        $blanked = 0;
    }
}

5. Add the script to startup applications.

It watches the events from xscreensaver and resets keyboard layout to english only on lock, and adds the cs layout back upon unblank.

For an unknown reason I can’t change the keyboard layout when xscreensaver prompts for password. This helps.