Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

54
LINES

< > BotCompany Repo | #1020495 // VNC Fixer [just for Stefan, WORKS, but only on Linux]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 1113K of libraries. Click here for Pure Java version (9939L/53K).

!7

// fixes typing "|", "{", "[", "]", "}", "\", "@" and "~" in VNC on German keyboard

cmodule2 VNCFixer > DynPrintLogAndEnabled {
  transient new LS shouldSend;
  transient S computerID;
  switchable bool verbose;

  start {
    dm_requireLinuxWindowList(); // inZOrder doesn't have to be set anymore
    dm_startKeyLogger();
    dm_vmBus_onMessage keyUp(voidfunc(int keyCode, int modifiers) {
      if (nempty(shouldSend) && keyCode == 56) { // Alt+Gr released
        switch to q();
        LS sending = getAndClearList(shouldSend);
        print("Sending " + sending + " to " + computerID);
        for (S key : sending)
          dm_evalOnOtherMachine(computerID, "robot_pressAndRelease_" + key + "_englishLayout();");
      }
    });
    dm_vmBus_onMessage keyDown_raw(voidfunc(final int rawCode, int modifiers) {
      if (enabled && modifiers == 128) {
        switch to q();
        //robot_keyRelease(KeyEvent.VK_ALT_GRAPH); // doesn't work, wait for modifier release instead
        //S activeWindow = getString(first((L) dm_call(dm_linuxWindowList(), 'getData)), 'windowTitle);
        S activeWindowID = linux_activeWindowID();
        S activeWindow = (S) dm_call(dm_linuxWindowList(), 'titleForWindowID, activeWindowID);
        if (cic(activeWindow, "X desktop (gazelle")) computerID = "ekrmjmnbrukm";
        else if (cic(activeWindow, "X desktop (onfire.")) computerID = "jozkyjcghlvl";
        else if (cic(activeWindow, "X desktop (vmd41736")) computerID = "whxojlpjdney";
        else if (cic(activeWindow, "X desktop (vm13548")) computerID = "hpgrupgrauku";
        else if (cic(activeWindow, "X desktop (c8.")) computerID = "mqqgnosmbjvj";
        else if (cicOneOf(activeWindow, "X desktop (big", "X desktop (ns57")) computerID = "pzhvpgtvlbxg";
        else if (cic(activeWindow, "X desktop (cruddie.")) computerID = "bhatertpkbcr";
        else {
          if (verbose) print("No matching window (" + activeWindowID + "/" + activeWindow + ")");
          shouldSend.clear();
          ret;
        }
        print("Got computer ID: " + computerID + ", rawCode: " + rawCode);
        
        if (rawCode == 124) shouldSend.add("vbar");
        else if (rawCode == 123 || rawCode == 55) shouldSend.add("openingCurlyBracket");
        else if (rawCode == 125 || rawCode == 48) shouldSend.add("closingCurlyBracket");
        else if (rawCode == 91) shouldSend.add("openingSquareBracket");
        else if (rawCode == 93) shouldSend.add("closingSquareBracket");
        else if (rawCode == 64) shouldSend.add("at");
        else if (rawCode == 92) shouldSend.add("backslash");
        else if (rawCode == 126) shouldSend.add("tilde");
      }
    });
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 9 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

-
Snippet ID: #1020495
Snippet name: VNC Fixer [just for Stefan, WORKS, but only on Linux]
Eternal ID of this version: #1020495/56
Text MD5: 5990a41946a84271e4c53701cff66543
Transpilation MD5: 49715f027292ef5d84e00df3882104ec
Author: stefan
Category:
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-29 08:04:15
Source code size: 2681 bytes / 54 lines
Pitched / IR pitched: No / No
Views / Downloads: 424 / 35634
Version history: 55 change(s)
Referenced in: