Create PNG Images of Keypresses Simply

One really last attempt. The file “nw” should really be called “nwjs”. Could you rename it and try each way again "especially the “Keypresses.app” mechanism again?

Une toute dernière tentative. Le fichier “nw” devrait vraiment s’appeler “nwjs”. Pourriez-vous le renommer et réessayer dans chaque sens “en particulier le mécanisme” Keypresses.app "?

Modification du nom: cela ne change rien nw ou nwjs.
Avec le terminal, voici sa fenêtre.

Name change: it doesn’t change anything nw or nwjs.
With the terminal, here is its window.

Peut-être une piste? dans d’autres applications, le fichier PkjInfo est un fichier texte, dans keypresses c’est un exécutable?

Maybe a hint? in other applications, the file PkjInfo is a text file, in keypresses it is an executable?

Just dashing out for a birthday party then back later tomorrow afternoon after a journey to Nicosia and back. I’ll look into this more carefully then. Thanks for your assistance.

Juste se précipiter pour une fête d’anniversaire puis revenir plus tard demain après-midi après un voyage à Nicosie et retour. Je vais regarder ça plus attentivement alors. Merci pour votre aide.

I’m running Fedora 35 with KDE Plasma desktop.
Tested the Linux version of the keypresses app. I have Wine installed. When the keypresses.exe file is clicked it calls Wine to execute the exe file. The application will not launch.
Screen capture:

Also tested the Windows keypresses app. It does not work with Wine either. A black screen appears for a few seconds, then the application window appears for a few seconds, finally the window disappears.

Screen capture:

@Chucky Thanks for testing this. Could I ask you to rename the “Keypresses.exe” file to just “Keypresses” and try executing that, then let me know if it works or not?

@Namna has tried it on MacOS and can’t get it to work there. Unfortunately I don’t have a MacOS nor a Linux system I can try it on (the Windows version works on Windows), so I might have to install a Linux partition to try to debug it myself. I have a friend, who should be back from the UK next week who has a MacOS system. I’ll see if I can use that for further testing on that OS.

This is the first time I’ve created an NW.js for any system other than Windows, and not having such systems myself has produced these “teething troubles”. Hopefully I’ll get them sorted in the next few days or so.

Works perfectly yes. Windows guys. What a nice product, so easy to use :grin:

I did that. The application doesn’t launch.

OK, thanks for trying. I’ll set up a linux partition on one of my systems and try to debug the process myself.

Did some testing on Linux.

chmod +x Keypresses 
./Keypresses

[201125:201125:0319/072240.687651:FATAL:double_fork_and_exec.cc(131)] execv /home/tim/Downloads/keypresses-linux/Keypresses/chrome_crashpad_handler: Permission denied (13)
#0 0x7f7a47bcbe03 (/home/tim/Downloads/keypresses-linux/Keypresses/lib/libnw.so+0x5820e02)

But opening index.html in firefox works fine, see no reason all the NW.js magic on Linux, just distribute the html and js files.

The CC BY-SA 4.0 license is meant for content, not code, so it don’t make much sense.

I works great, I would be nice to be able to set the padding around the text, ex, Control have to little space to the borders of the body.

Use “Ctrl” insted of “Control” most keyboard layout does that.

Screenshot from 2022-03-19 07-50-16

changing the padding from 0.2em to 0.5em looks much better

   #keys > i, #keys > b {
          padding         : 0 0.5em;

Screenshot from 2022-03-19 08-12-05

This will change “Control” to “Ctrl”

  textarea.addEventListener('keydown', function(e) {

    processing_initiated = false;
    if (e.repeat || e.key.toLowerCase() === 'meta') { return; }

    if (e.key.toLowerCase() == 'control') {
      keys.push('Ctrl');
      textarea.value += 'Ctrl ';
    } else {
      keys.push(e.key);
      textarea.value += e.key + ' ';
    }

Tim,

Thanks for testing this for me. I will still try to get the NWJS version working though. It looks as if it might just a permissions problem.

If you don’t use the NWJS app certain key combinations do not work. e.g. ControlPageDown. Using the app this shows as-is, using Firefox it shows as only Control, using Chrome or Edge it jumps to the next browser tab and does not even register as a keypress.

The key names are standard and come from the Javascript Keypress event object. I’ve been thinking about having a configuration option to let the user decide how to call the various control keys, e.g. a user of an AZERTY keyboard may like “Shift” to be “Maj” as it is on the keyboard. What is it about the AZERTY keyboard? It has a key dedicated to the letter ⟨ù⟩, which occurs in only one French word (où [where]); the œ is completely unrepresented, despite the fact that it is an integral part of the French spelling system and occurs in several common words like œil (eye) and œuvre (work).

I have map a version with dictionary to translate some JS keyevent name to something more human

 let keymap = {
  "Control": "Ctrl",
  "ArrowUp": "Up",
  "ArrowDown": "Down",
  "ArrowLeft": "Left",
  "ArrowRight": "Right",
  "PageUp": "PgUp",
  "PageDown": "PgDn"
}

let mapped = "";

  //$(document).on('keydown', 'textarea', function(e) { // Can't use this as jQuery event does not handle REPEAT keystrokes correctly

  textarea.addEventListener('keydown', function(e) {

    processing_initiated = false;
    if (e.repeat || e.key.toLowerCase() === 'meta') { return; }

    mapped = keymap[e.key]
    if (mapped) {
      keys.push(mapped);
      textarea.value += mapped;
    } else {
      keys.push(e.key);
      textarea.value += e.key + ' ';
    }
    e.preventDefault();
    e.stopPropagation();
    e.stopImmediatePropagation();

});

It is hard to share code in a forum, so have made a github repository with my changes

Bonjour,
@ Elusien
1° Mon clavier est un clavier AZERTY français mais mon premier PC (Texas), en 1993, étant un clavier QUERTY je superposais un calque transparent sur le clavier pour transformer directement les touches QUERTY en touches AZERTY.
« ù »(AZERTY) => la virgule », » en QWERTY

2° Plus tard, vers 2000, pour les caractères spéciaux susceptibles de créer des problèmes, j’avais écrit un script avec les correspondances des codes ISO (utilisables en XML) et les codes HTML :

  • ù => ú (ISO) ou => &ugrave ; (HTML)*
    Si c’est utile je peux fournir une photo du calque transparent et un zip du tableau complet (?) des correspondances ISO <=> HTML, environ 150 correspondances.

Hello
1 ° My keyboard is a French AZERTY keyboard but my first PC (Texas), in 1993, being a QUERTY keyboard I superimposed a transparent layer on the keyboard to directly transform the QUERTY keys into AZERTY keys. “ù” (AZERTY) => the comma", in QWERTY
2° Later, around 2000, for special characters likely to create problems, I had written a script with the correspondences of ISO codes (usable in XML) and HTML codes:
ù => ú (ISO) or => ù (HTML)
If it is useful I can provide a photo of the transparent layer and several jpg of the complete international table (?) of ISO HTML matches, about 150 matches.

I’ve been incommunicado for a few days, so took a rest from Shotcut and S/W development. I got round to creating the code for the key name mapping today. I’ve done it in such a way that the user can choose what mapping to do directly in the app and doesn’t have to modify the code. There is now a table displayed in the app that enables the user to map names onto up to 16 keys. These are saved when the “Save Parameters” button is clicked and are restored whenever the app starts up.

I use Github, but mainly as a private source control system for myself on large projects, since I don’t normally do S/W collaboration.

I’ve not got round to testing the Linux (or the MacOS) versions yet, so I’ve disabled their download on the website.

1 Like

Nice addition! :+1:

I added these:
5qCq31CGVj

1 Like

Hi @Elusien

I did not use the app for a while, but today I needed a couple of keypress PNGs.

First thing I noticed after launching the app was that the custom keys I programed on my last session were gone.
So I created them again, pressed the Save Parameters button and re-launched the app.
Gone again

Do you experience the same problem?

Also, while we’re talking about saving the parameters, would it be possible for the app to remember the last window size used?
In the default size, the custom keys are hidden at the bottom of the app. I prefer to resize the window to have them to the side where I can see them.

chrome_qWYkMKdw09

The keys are saved not in a file but in the browser “localstorage”. If you cleared the browser cache it may have cleared this area too.

I’ll look into saving it in a “real” file.

I’ll also look at saving and restoring the last window size.

I didn’t clear the browser cache. So there must be another issue on my side.
But thanks for looking to it. Saving it to a file, will most likely solve the problem.