!7 // fixes typing "|", "{", "[", "]", "}", "\" and "@" in VNC on German keyboard cmodule VNCFixer > DynPrintLogAndEnabled { transient new LS shouldSend; transient S computerID; /*visualize { ret centerAndSouth(super.visualize(), withMargin(withLabel("Computer ID:", dm_fieldTextField('computerID)))); }*/ start { dm_requireLinuxWindowList(); 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) { //robot_keyRelease(KeyEvent.VK_ALT_GRAPH); // doesn't work, wait for modifier release instead switch to q(); S activeWindow = getString(first((L) dm_call(dm_linuxWindowList(), 'getData)), 'windowTitle); if (cic(activeWindow, "X desktop (smartbot.")) computerID = "mqqgnosmbjvj"; else if (cic(activeWindow, "X desktop (onfire.")) computerID = "jozkyjcghlvl"; else if (cic(activeWindow, "X desktop (vmanager")) computerID = "whxojlpjdney"; else if (cic(activeWindow, "X desktop (vm13548")) computerID = "ayivmpnvhhik"; else { print("No matching window"); shouldSend.clear(); ret; } print("Got computer ID: " + computerID + ", rawCode: " + rawCode); if (rawCode == 124) shouldSend.add("vbar"); else if (rawCode == 123) shouldSend.add("openingCurlyBracket"); else if (rawCode == 125) 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"); } }); } }