• You are not logged in.

    Keyboard layout preview tool?

    • Started by spremino
    • 14 Replies:
    • Reputation: 0
    • Registered: 03-Jul-2009
    • Posts: 189

    Hello,

    do you know of any tool (Windows or Linux) which generates a preview of a layout suitable for inclusion into a web page?  It should support ISO layouts too, like this:

    https://en.wikipedia.org/wiki/File:KB_U … ingdom.svg

    Thanks.

    EDIT: If such tool generated preview of full keyboard, that would be even better.

    Last edited by spremino (15-Dec-2010 12:19:21)

    Dvorak typist here.  Please take my comments with a grain of salt.

    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,361

    Urgh argh, I never manage to finish that project. But, you know, if you use Inkscape it isn't so hard to play around with my figures (citing your source afterwards of course).

    And I personally think that the standard "wikipedia-style" keyboard figure grates my eyes something fierce. If you want a simple figure, you can use my simplified background which at least will make the keys slightly rounded!  :)

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 0
    • Registered: 03-Jul-2009
    • Posts: 189

    Thanks DreymaR, but I'm looking for a preview *generator*, that is a tool which takes a keyboard layout in text form and draws a preview.  Now that I think about it, I could hack the infamous Maxwell applet.

    EDIT: DreymaR, where are your pictures?  Thanks.

    Last edited by spremino (16-Dec-2010 09:49:47)

    Dvorak typist here.  Please take my comments with a grain of salt.

    Offline
    • 0
    • Reputation: 23
    • From: Belgium
    • Registered: 26-Feb-2008
    • Posts: 482

    I've used carpalx (Perl based) to generate images like this one:

    rulemak.png
    PKL has a script to generate PNG images too (also Perl I think), but I haven't used it.

    But Dreymar's SVG image will be the most flexible.  Since it's XML, it's easy to turn it into a template where a script can fill in the actual characters from a config file.  And the SVG can be edited afterwards (colors, scale, ...).

    Here's an example:

    Rulemak.png
    (based on Dreymar's images)

    Last edited by ghen (11-Nov-2017 20:27:51)
    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,361

    Thing is though, I've decided that I want to learn Python. So that's the next point on my to-do-list right now. Hahahahah.

    This is where I keep my Colemak-board-figures. The "Feng Shui colored" ones make me smile.  :)

    CmkIBM-ISO60d-Wide_FengShuiFinger.png

    There's a problem making bitmaps at something else than 90 dpi I think - looks mushy. It's because the lines between the keys are thin enough already and will start aliasing, I guess.

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 0
    • Registered: 03-Jul-2009
    • Posts: 189

    Thanks DreymaR.  I'm not that skilled at editing images.  Do you think I could configure colors too, to show fingering?

    Dvorak typist here.  Please take my comments with a grain of salt.

    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,361

    Nobody should fight the awesomeness of the DreymaR fingering scheme! Embrace it, it is your destiny!

    Nah, of course you can edit the colors. How easy it will be for you depends a bit... well, knowing you I'm sure it won't be hard. Ask if you're confused about anything. I've tried to make the layers logical and all, and the colors are in separate layers so they're quite accessible. But my head is a twisted little thing so I've no idea whether anyone but me will find things logical or not in there.

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 23
    • From: Belgium
    • Registered: 26-Feb-2008
    • Posts: 482

    spremino: are you looking at the SVG or the PNG files?  The PNG files are just "exports" of the SVG.
    SVG is a vector graphics format you can easily edit using eg. Inkscape.

    Last edited by ghen (17-Dec-2010 14:26:23)
    Offline
    • 0
    • Reputation: 0
    • Registered: 03-Jul-2009
    • Posts: 189

    Thanks, DreymaR and Ghen.

    Of course I could change colors by means of an image-editing software, but could I do that by means of a script?  My idea was about having both keyboard layout and fingering as parameters to a preview generator.

    Dvorak typist here.  Please take my comments with a grain of salt.

    Offline
    • 0
    • Reputation: 23
    • From: Belgium
    • Registered: 26-Feb-2008
    • Posts: 482

    That's all possible, since svg is an xml format.  Just need to template it.

    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,361

    As I hinted on: I've been promising myself to make that script. The template I have made (and I may send it to you if you know what to do with it and send me an email to that effect).

    My first step was to make yet another layout description file format. I wanted something that would be as easily machine readable as manually editable, and that could support a multistep transition from scan codes to virtual scan codes to transpositions of these (scan code mods) to layouts giving virtual key codes and/or code points in a logical manner. No small task, but I myself am reasonably happy with it now at least.

    Then, script tools to convert between this Keyboard Layout Description format and the common ones such as MSKLC, PKL and the Unix/Mac ones. Some fun was had, but no finished fun yet.

    Also, the script to plonk the resulting data into the picture template and hit the virtual print button. Nope, not done. And I kinda want to do it in Python now but have to learn Python first and I really really hope that the upcoming holiday will be nice to me in that respect!  :)

    Last edited by DreymaR (21-Dec-2010 15:41:03)

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 0
    • Registered: 03-Jul-2009
    • Posts: 189

    DreymaR, I was willing to contribute the preview script, but I've looked at one SVG of yours and it's almost 200KB of XML...  I'm not reverse-engineering such a monster.  Hacking Maxwell's applet is still easier.  I'll look into it.

    Dvorak typist here.  Please take my comments with a grain of salt.

    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,361

    It's a lot simpler than that, as ghen says: I've made a layer in the SVG file that contains tags (scan codes iirc) that the script can easily search/replace. Presto - new layout. So one just has to save the SVG file (I use Inkscape) showing that layer and whatever coloring and finesse (simple vs advanced keys for instance) you want, make a copy and then run said script on that copy before printing/exporting.

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 0
    • Registered: 03-Jul-2009
    • Posts: 189

    Wouldn't string interpolation in whatever scripting language you happen to know be enough?

    I happen to know Perl:

    # Assigning label to keys.  This could go into a configuration file.
    # keyROW_COLUMN = ...
    my $key0_0 = "A";
    my $key0_1 = "B";
    my $key0_2 = "C";
    
    print <<END_OF_LAYOUT;
    Here goes the XML, where $key0_0, $key0_1, $key0_2 ... will replaced by their values.  
    Redirect output to the new SVG file and you are done.
    END_OF_LAYOUT
    ;
    Last edited by spremino (04-Jan-2011 12:28:32)

    Dvorak typist here.  Please take my comments with a grain of salt.

    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,361

    Gravedigging: Would anyone be willing to have a stab at making a script that can search-replace in my SVG file based on a set of layout templates? And automatically save PNG images from Inkscape.

    A layout would use templates like this one, in .ini files:

    [Colemak-DH_lv1]
    ;   X=======+=======+=======+=======+=======+=======+=======+=======+=======+=======+=======+=======+=======X
    ;   |`      |1      |2      |3      |4      |5      |6      |7      |8      |9      |0      |-      |=      |
    LK1="`      |1      |2      |3      |4      |5      |6      |7      |8      |9      |0      |-      |=      |"
    ;   X-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------X
    ;Cmk|Tab    |Q      |W      |F      |P      |G      |J      |L      |U      |Y      |;      |[      |]      |
    LK2="Tab    |q      |w      |f      |p      |b      |j      |l      |u      |y      |;      |[      |]      |"
    ;   X-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------X
    ;Cmk|Caps   |A      |R      |S      |T      |D      |H      |N      |E      |I      |O      |'      |\      |
    LK3="Caps   |a      |r      |s      |t      |g      |k      |n      |e      |i      |o      |'      |\      |"
    ;   X-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------X
    ;Cmk|LShft  |LS/GT  |Z      |X      |C      |V      |B      |K      |M      |,      |.      |/      |RShft  |
    LK4="LShft  |œ      |z      |x      |c      |v      |d      |h      |m      |,      |.      |/      |RShft  |"
    ;   X=======+=======+=======+=======+=======+=======+=======+=======+=======+=======+=======+=======+=======X

    One such set of lines for the existing symbols to switch out, and another for the ones to switch to.

    I think the image file will handle ergo mods.

    Last edited by DreymaR (04-Feb-2016 10:16:34)

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0