1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
#!/usr/bin/perl
use strict;
my %funcs;
open(ACCELS, "<$ENV{HOME}/.geeqie/accels") or die "No accel file";
while (<ACCELS>)
{
if (/gtk_accel_path "([^"]*)" *"([^"]*)"/)
{
my $name = $1;
my $key = $2;
$name =~ s/.*\///;
$key =~ s/</</g;
$key =~ s/>/>/g;
$funcs{uc($key)} = $name;
}
}
close(ACCELS);
open(ACCELS, "<hardcoded_keys") or die "No hardcoded_keys file";
while (<ACCELS>)
{
if (/"([^"]*)" *"([^"]*)"/)
{
my $name = $1;
my $key = $2;
$name =~ s/.*\///;
$key =~ s/</</g;
$key =~ s/>/>/g;
$funcs{uc($key)} = $name;
}
}
close(ACCELS);
open(IN, "<keymap_template.svg") or die "No svg file";
open(OUT, ">keymap.svg") or die "Can't write output file";
while (<IN>)
{
if (/>key:([^<]*)</)
{
my $key = uc($1);
my $name = $funcs{$key};
s/>key:([^<]*)</>$name</;
delete $funcs{$key};
}
print OUT;
}
close(IN);
close(OUT);
for my $key (keys %funcs)
{
if ($key)
{
print STDERR "not found: '$key'\n";
}
}
|