From 52f2112abd6c249ff97d37d13c0c885031f857e7 Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Tue, 25 Aug 2020 02:05:38 -0500 Subject: [PATCH 1/4] - Preliminary IBM Model M Support for Linux, partail Win setup --- setup.py | 12 ++++++++---- xkeysnail-config/kinto.py | 32 +++++++++++++++++++++++++------- xkeysnail_service.sh | 9 ++++++++- 3 files changed, 41 insertions(+), 12 deletions(-) diff --git a/setup.py b/setup.py index f7a3024..082165e 100755 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ homedir = os.path.expanduser("~") kintotype = 0 def windows_setup(): - keymaps = ["Apple keyboard standard", "Windows keyboard standard","Uninstall"] + keymaps = ["Apple keyboard standard", "Windows keyboard standard","Chromebook","IBM - No Super/Win","Uninstall"] for index, item in enumerate(keymaps): print(" %i. %s" % (index+1, item.capitalize())) default = 0 @@ -17,7 +17,7 @@ def windows_setup(): print("") # Short DOS path notation path= cmdline('echo %cd%')[:-1] - if default > 0 and default < 3: + if default > 0 and default < 5: print("Will now install chocolatey and autohotkey with elevated privileges...") print("This install will fail if you are not running with elevated privileges") os.system('powershell -executionpolicy bypass ".\\windows\\autohotkey.ps1"') @@ -27,7 +27,11 @@ def windows_setup(): os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; MacModifiers)/$2$3/g" .\\windows\\kinto-new.ahk') elif default == 2: os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; WinModifiers)/$2$3/g" .\\windows\\kinto-new.ahk') - elif default == 3: + elif default == 3: + os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; Chromebook)/$2$3/g" .\\windows\\kinto-new.ahk') + elif default == 4: + os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; IBM)/$2$3/g" .\\windows\\kinto-new.ahk') + elif default == 5: print("Removing any old registry keys from prior versions...") p = subprocess.Popen(['powershell.exe', "Remove-ItemProperty -Path HKLM:'SYSTEM\CurrentControlSet\Control\Keyboard Layout' -Name 'Scancode Map' -ErrorAction SilentlyContinue"], stdout=sys.stdout) print("Removing Kinto from Startup folder...") @@ -39,7 +43,7 @@ def windows_setup(): os.system('(rd /s /q %userprofile%\\.kinto) 2> nul') print("") print("Uninstall of Kinto is Complete.") - if default > 0 and default < 3: + if default > 0 and default < 5: stvscode = yn_choice(bcolors.CYELLOW2 + "Would you like to use Sublime Text 3 keymaps in VS Code?\n" + bcolors.ENDC) print("\nWill now install Ubuntu Termimnal Theme as default...") os.system("regedit " + path + "\\windows\\theme_ubuntu.reg") diff --git a/xkeysnail-config/kinto.py b/xkeysnail-config/kinto.py index 897d81b..cd6013d 100644 --- a/xkeysnail-config/kinto.py +++ b/xkeysnail-config/kinto.py @@ -21,6 +21,13 @@ codeStr = "|".join(str(x) for x in mscodes) # [Global modemap] Change modifier keys as in xmodmap define_conditional_modmap(lambda wm_class: wm_class.casefold() not in terminals,{ + # # IBM + # Key.LEFT_ALT: Key.RIGHT_CTRL, # IBM + # Key.LEFT_CTRL: Key.LEFT_ALT, # IBM + # Key.CAPSLOCK: Key.LEFT_META, # IBM + # Key.RIGHT_ALT: Key.RIGHT_CTRL, # IBM - Multi-language (Remove) + # Key.RIGHT_CTRL: Key.RIGHT_ALT, # IBM - Multi-language (Remove) + # # Chromebook # Key.LEFT_ALT: Key.RIGHT_CTRL, # Chromebook # Key.LEFT_CTRL: Key.LEFT_ALT, # Chromebook @@ -44,6 +51,17 @@ define_conditional_modmap(lambda wm_class: wm_class.casefold() not in terminals, # [Conditional modmap] Change modifier keys in certain applications define_conditional_modmap(re.compile(termStr, re.IGNORECASE), { + # # IBM + # Key.LEFT_ALT: Key.RIGHT_CTRL, # IBM + # # Left Ctrl Stays Left Ctrl + # Key.CAPSLOCK: Key.LEFT_ALT, # IBM + # Key.RIGHT_ALT: Key.RIGHT_CTRL, # IBM - Multi-language (Remove) + # Key.RIGHT_CTRL: Key.RIGHT_ALT, # IBM + # # Right Meta does not exist on chromebooks + + # Key.RIGHT_ALT: Key.RIGHT_CTRL, # IBM - Multi-language (Remove) + # Key.RIGHT_CTRL: Key.RIGHT_ALT, # IBM - Multi-language (Remove) + # # Chromebook # Key.LEFT_ALT: Key.RIGHT_CTRL, # Chromebook # # Left Ctrl Stays Left Ctrl @@ -183,9 +201,9 @@ define_keymap(None,{ # K("RC-Shift-Tab"): K("RC-Shift-backslash"), # xfce4 # K("RC-Grave"): K("RC-Shift-backslash"), # xfce4 # In-App Tab switching - # K("M-Tab"): K("C-Tab"), # Chromebook - In-App Tab switching - # K("M-Shift-Tab"): K("C-Shift-Tab"), # Chromebook - In-App Tab switching - # K("M-Grave") : K("C-Shift-Tab"), # Chromebook - In-App Tab switching + # K("M-Tab"): K("C-Tab"), # Chromebook/IBM - In-App Tab switching + # K("M-Shift-Tab"): K("C-Shift-Tab"), # Chromebook/IBM - In-App Tab switching + # K("M-Grave") : K("C-Shift-Tab"), # Chromebook/IBM - In-App Tab switching K("Super-Tab"): K("LC-Tab"), # Default not-chromebook K("Super-Shift-Tab"): K("LC-Shift-Tab"), # Default not-chromebook @@ -204,7 +222,7 @@ define_keymap(None,{ K("RC-Shift-Up"): K("C-Shift-Home"), # Select all to Beginning of File K("RC-Down"): K("C-End"), # End of File K("RC-Shift-Down"): K("C-Shift-End"), # Select all to End of File - # K("M-Backspace"): K("Delete"), # Chromebook - Delete + # K("M-Backspace"): K("Delete"), # Chromebook/IBM - Delete K("Super-Backspace"): K("C-Backspace"), # Default not-chromebook - Delete Left Word of Cursor K("Super-Delete"): K("C-Delete"), # Default not-chromebook - Delete Right Word of Cursor K("Alt-Backspace"): K("C-Backspace"), # Default not-chromebook - Delete Left Word of Cursor @@ -264,7 +282,7 @@ define_keymap(re.compile(codeStr, re.IGNORECASE),{ K("C-Shift-g"): K("Shift-f3"), # find_prev K("Super-c"): K("LC-c"), # Sigints - interrupt # K("Super-C-g"): K("C-f2"), # Default - Sublime - find_all_under - # K("C-M-g"): K("C-f2"), # Chromebook - Sublime - find_all_under + # K("C-M-g"): K("C-f2"), # Chromebook/IBM - Sublime - find_all_under # K("Super-Shift-up"): K("M-Shift-up"), # multi-cursor up - Sublime # K("Super-Shift-down"): K("M-Shift-down"), # multi-cursor down - Sublime # K(""): pass_through_key, # cancel @@ -305,8 +323,8 @@ define_keymap(re.compile("Sublime_text", re.IGNORECASE),{ K("C-Shift-f3"): pass_through_key, # cancel find_under_prev K("Super-M-Shift-g"): K("C-Shift-f3"), # find_under_prev K("M-f3"): pass_through_key, # Default - cancel find_all_under - # K("M-Refresh"): pass_through_key, # Chromebook - cancel find_all_under - # K("M-C-g"): K("M-Refresh"), # Chromebook - find_all_under + # K("M-Refresh"): pass_through_key, # Chromebook/IBM - cancel find_all_under + # K("M-C-g"): K("M-Refresh"), # Chromebook/IBM - find_all_under K("Super-C-g"): K("M-f3"), # Default - find_all_under K("C-Shift-up"): pass_through_key, # cancel swap_line_up K("Super-M-up"): K("C-Shift-up"), # swap_line_up diff --git a/xkeysnail_service.sh b/xkeysnail_service.sh index e6ae73c..992f023 100755 --- a/xkeysnail_service.sh +++ b/xkeysnail_service.sh @@ -186,6 +186,7 @@ if [ $# -eq 0 ]; then echo " 1) Windows & Mac (HID driver) - Most Standard keyboards (& 1st party usb/bt Apple keyboards)" echo " 2) Mac Only & VMs on Macbooks - 3rd & 1st party Apple keyboards" echo " 3) Chromebook - Chromebook running Linux" + echo " 4) IBM M - Keyboards w/o Super/Win keys" # echo " 5) Uninstall" read n @@ -200,7 +201,7 @@ rightalt=false # VS code remap vssublime=false -if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1 == "chromebook" ]]; then +if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "4" || $1 == "winmac" || $1 == "mac" || $1 == "chromebook" || $1 == "ibm" ]]; then if [[ $dename == "gnome" || $dename == "budgie" || $dename == "mate" || $dename == "xfce" ]];then installtray=true while true; do @@ -364,6 +365,12 @@ elif [[ $1 == "3" || $1 == "chromebook" ]]; then perl -pi -e "s/(# )(.*)(# xfce4)/\$2\$3/g" ./xkeysnail-config/kinto.py.new perl -pi -e "s/(\w.*)(# Default)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new fi +elif [[ $1 == "4" || $1 == "ibm" ]]; then + perl -pi -e "s/(# )(.*)(# IBM)/\$2\$3/g" ./xkeysnail-config/kinto.py.new + perl -pi -e "s=(# )(.*)(# Chromebook/IBM)=\$2\$3=g" ./xkeysnail-config/kinto.py.new + # perl -pi -e "s/(# )(.*)(# xfce4)/\$2\$3/g" ./xkeysnail-config/kinto.py.new + perl -pi -e "s/(\w.*)(# Default)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new +fi if $rightalt ; then perl -pi -e "s/(\w.*)(Multi-language)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1 From 40c3d683367edd5c59777f71f457f7ebde866296 Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Tue, 25 Aug 2020 03:52:19 -0500 Subject: [PATCH 2/4] - WIP Added Chromebook and IBM Model M Keyboard Support for Windows to Installer --- setup.py | 20 ++++++++++++++------ windows/kinto.ahk | 15 ++++++++------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/setup.py b/setup.py index 71bb137..fba6748 100755 --- a/setup.py +++ b/setup.py @@ -23,14 +23,12 @@ def windows_setup(): os.system('powershell -executionpolicy bypass ".\\windows\\autohotkey.ps1"') print("Copying autohotkey combinations for Terminals & Editors...") os.system('copy /Y "' + path + '\\windows\\kinto.ahk" "' + path + '\\windows\\kinto-new.ahk"') + if default < 3: + os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; Default)(?!( - ST2CODE))(.*)/$2$3$5/g" .\\windows\\kinto-new.ahk') if default == 1: os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; MacModifiers)/$2$3/g" .\\windows\\kinto-new.ahk') elif default == 2: os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; WinModifiers)/$2$3/g" .\\windows\\kinto-new.ahk') - elif default == 3: - os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; Chromebook)/$2$3/g" .\\windows\\kinto-new.ahk') - elif default == 4: - os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; IBM)/$2$3/g" .\\windows\\kinto-new.ahk') elif default == 5: print("Removing any old registry keys from prior versions...") p = subprocess.Popen(['powershell.exe', "Remove-ItemProperty -Path HKLM:'SYSTEM\CurrentControlSet\Control\Keyboard Layout' -Name 'Scancode Map' -ErrorAction SilentlyContinue"], stdout=sys.stdout) @@ -43,13 +41,23 @@ def windows_setup(): os.system('(rd /s /q "%userprofile%\\.kinto") 2> nul') print("") print("Uninstall of Kinto is Complete.") + if default == 3: + os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; Chromebook)/$2$3/g" .\\windows\\kinto-new.ahk') + os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; WinModifiers/CB)/$2$3/g" .\\windows\\kinto-new.ahk') + if default == 3 || default == 4: + os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; CB/IBM)/$2$3/g" .\\windows\\kinto-new.ahk') + if default == 4: + os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; IBM)/$2$3/g" .\\windows\\kinto-new.ahk') + os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; WinModifiers/CB/IBM)/$2$3/g" .\\windows\\kinto-new.ahk') if default > 0 and default < 5: stvscode = yn_choice(bcolors.CYELLOW2 + "Would you like to use Sublime Text 3 keymaps in VS Code?\n" + bcolors.ENDC) print("\nWill now install Ubuntu Termimnal Theme as default...") os.system('regedit "' + path + '\\windows\\theme_ubuntu.reg"') os.system('robocopy "'+ path + '\\assets" "%userprofile%\\.kinto\\assets" /E') - if(stvscode): - os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; ST2CODE)/$2$3/g" .\\windows\\kinto-new.ahk') + if (stvscode and (default > 0 || default < 3)): + os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; Default - ST2CODE)/$2$3/g" .\\windows\\kinto-new.ahk') + elif (stvscode and (default == 3 || default == 4 )): + os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; CB/IBM - ST2CODE)/$2$3/g" .\\windows\\kinto-new.ahk') os.system('copy /Y "' + path + '\\windows\\kinto-start.vbs" "%userprofile%\\.kinto\\kinto-start.vbs"') os.system('copy /Y "' + path + '\\windows\\usb.vbs" "%userprofile%\\.kinto\\usb.vbs"') os.system('copy /Y "' + path + '\\windows\\detectUSB.ahk" "%userprofile%\\.kinto\\detectUSB.ahk"') diff --git a/windows/kinto.ahk b/windows/kinto.ahk index dbf4a89..e50ace2 100644 --- a/windows/kinto.ahk +++ b/windows/kinto.ahk @@ -153,9 +153,9 @@ GroupAdd, intellij, ahk_exe idea64.exe } else if (GetKeyState("LCtrl", "P") AND GetKeyState("LShift", "P")) { ; Secondary ; Send {LCtrl down}{Secondary up}{LShift down}{tab} - ; Send {LCtrl down}{LWin up}{LShift down}{tab} ; WinModifiers + ; Send {LCtrl down}{LWin up}{LShift down}{tab} ; WinModifiers/CB ; Send {LCtrl down}{LAlt up}{LShift down}{tab} ; MacModifiers - ; Send {LCtrl down}{CapsLock up}{LShift down}{tab} ; CB/IBM + ; Send {LCtrl down}{CapsLock up}{LShift down}{tab} ; IBM KeyWait, tab ; Primary ; } else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P") = false) { ; WinModifiers/CB/IBM @@ -168,14 +168,14 @@ GroupAdd, intellij, ahk_exe idea64.exe Send {LAlt down}{LShift down}{tab} KeyWait, tab ; Secondary - ; } else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P")) = false { ; WinModifiers + ; } else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P")) = false { ; WinModifiers/CB ; } else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P") = false) { ; MacModifiers - ; } else if (GetKeyState("CapsLock", "P") AND GetKeyState("LShift", "P")) = false { ; CB/IBM + ; } else if (GetKeyState("CapsLock", "P") AND GetKeyState("LShift", "P")) = false { ; IBM return ; Secondary - ; } else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P")) { ; WinModifiers + ; } else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P")) { ; WinModifiers/CB ; } else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P")) { ; MacModifiers - ; } else if (GetKeyState("CapsLock", "P") AND GetKeyState("LShift", "P")) { ; CB/IBM + ; } else if (GetKeyState("CapsLock", "P") AND GetKeyState("LShift", "P")) { ; IBM return } else { send {Blind}{tab} @@ -195,7 +195,7 @@ GroupAdd, intellij, ahk_exe idea64.exe ; $LAlt::LCtrl ; CB/IBM ; $RAlt::RCtrl ; CB/IBM - ; $CapsLock::LWin ; CB/IBM + ; $CapsLock::LWin ; IBM ; $LCtrl::LAlt ; CB/IBM ; $LAlt::LCtrl ; WinModifiers @@ -216,6 +216,7 @@ GroupAdd, intellij, ahk_exe idea64.exe ; Primary ; $LAlt up::Send {LWin up}{LAlt up}{LCtrl up} ; WinModifiers ; $LWin up::Send {LWin up}{LAlt up}{LCtrl up} ; MacModifiers + ; $LAlt up::Send {LWin up}{CapsLock up}{LAlt up}{LCtrl up} ; CB/IBM ; Close Apps ^q::Send !{F4} From e43df230f3dd686d6996e6c78c254977c6c08b3d Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Tue, 25 Aug 2020 22:19:15 -0500 Subject: [PATCH 3/4] - Added IBM & Chromebook support to Windows 10. Added Autodetect toggle. --- setup.py | 17 ++++--- windows/kinto-start.vbs | 2 +- windows/kinto.ahk | 107 ++++++++++++++++++++++++++++++---------- windows/toggle_kb.bat | 42 +++++++++++++++- 4 files changed, 132 insertions(+), 36 deletions(-) diff --git a/setup.py b/setup.py index fba6748..34a352e 100755 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ kintotype = 0 def windows_setup(): keymaps = ["Apple keyboard standard", "Windows keyboard standard","Chromebook","IBM - No Super/Win","Uninstall"] for index, item in enumerate(keymaps): - print(" %i. %s" % (index+1, item.capitalize())) + print(" %i. %s" % (index+1, item)) default = 0 while not int(default) in range(1,len(keymaps)+1): default = int(input("\nPlease enter your desired keymap (1 - " + str(len(keymaps)) + ") : ")) @@ -26,8 +26,10 @@ def windows_setup(): if default < 3: os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; Default)(?!( - ST2CODE))(.*)/$2$3$5/g" .\\windows\\kinto-new.ahk') if default == 1: + kbtype = "mac" os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; MacModifiers)/$2$3/g" .\\windows\\kinto-new.ahk') - elif default == 2: + elif default == 2: + kbtype = "win" os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; WinModifiers)/$2$3/g" .\\windows\\kinto-new.ahk') elif default == 5: print("Removing any old registry keys from prior versions...") @@ -42,11 +44,13 @@ def windows_setup(): print("") print("Uninstall of Kinto is Complete.") if default == 3: + kbtype = "chrome" os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; Chromebook)/$2$3/g" .\\windows\\kinto-new.ahk') os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; WinModifiers/CB)/$2$3/g" .\\windows\\kinto-new.ahk') - if default == 3 || default == 4: + if default == 3 or default == 4: os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; CB/IBM)/$2$3/g" .\\windows\\kinto-new.ahk') - if default == 4: + if default == 4: + kbtype = "ibm" os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; IBM)/$2$3/g" .\\windows\\kinto-new.ahk') os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; WinModifiers/CB/IBM)/$2$3/g" .\\windows\\kinto-new.ahk') if default > 0 and default < 5: @@ -54,11 +58,12 @@ def windows_setup(): print("\nWill now install Ubuntu Termimnal Theme as default...") os.system('regedit "' + path + '\\windows\\theme_ubuntu.reg"') os.system('robocopy "'+ path + '\\assets" "%userprofile%\\.kinto\\assets" /E') - if (stvscode and (default > 0 || default < 3)): + if (stvscode and (default > 0 or default < 3)): os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; Default - ST2CODE)/$2$3/g" .\\windows\\kinto-new.ahk') - elif (stvscode and (default == 3 || default == 4 )): + elif (stvscode and (default == 3 or default == 4 )): os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; CB/IBM - ST2CODE)/$2$3/g" .\\windows\\kinto-new.ahk') os.system('copy /Y "' + path + '\\windows\\kinto-start.vbs" "%userprofile%\\.kinto\\kinto-start.vbs"') + os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/{kbtype}/' + kbtype + '/g" "%userprofile%\\.kinto\\kinto-start.vbs"') os.system('copy /Y "' + path + '\\windows\\usb.vbs" "%userprofile%\\.kinto\\usb.vbs"') os.system('copy /Y "' + path + '\\windows\\detectUSB.ahk" "%userprofile%\\.kinto\\detectUSB.ahk"') os.system('mklink "%userprofile%\\Start Menu\\Programs\\Startup\\kinto-start.vbs" "%userprofile%\\.kinto\\kinto-start.vbs"') diff --git a/windows/kinto-start.vbs b/windows/kinto-start.vbs index 374a1a4..4084a24 100644 --- a/windows/kinto-start.vbs +++ b/windows/kinto-start.vbs @@ -3,5 +3,5 @@ Set wShell = WScript.CreateObject("WScript.Shell") Set fso = CreateObject("Scripting.FileSystemObject") path = wShell.ExpandEnvironmentStrings("""%userprofile%") -strFolder = fso.BuildPath( path, "\.kinto\kinto.ahk""") +strFolder = fso.BuildPath( path, "\.kinto\kinto.ahk"" {kbtype}") oShell.ShellExecute "C:\Program Files\AutoHotkey\AutoHotkey.exe", strFolder, , "runas", 0 \ No newline at end of file diff --git a/windows/kinto.ahk b/windows/kinto.ahk index f51607f..1fa9768 100644 --- a/windows/kinto.ahk +++ b/windows/kinto.ahk @@ -2,8 +2,8 @@ #NoEnv #Persistent -DetectHiddenWindows, On -Run, %A_ScriptDir%\detectUSB.ahk +; DetectHiddenWindows, On ; Autodetect +; Run, %A_ScriptDir%\detectUSB.ahk ; Autodetect ; Enable Left clicks on Kinto Icon ; https://www.autohotkey.com/boards/viewtopic.php?t=9501 @@ -32,15 +32,37 @@ AHK_NOTIFYICON(wParam, lParam) ; I_Icon = %A_ScriptDir%\assets\kinto-white-invert.ico ; WinModifiers/CB/IBM ; IfExist, %I_Icon% ; WinModifiers/CB/IBM ; Menu, Tray, Icon, %I_Icon%,, 1 ; WinModifiers/CB/IBM -; Menu, Tray, Tip, Windows - Kinto ; WinModifiers/CB/IBM +; Menu, Tray, Tip, Windows - Kinto ; WinModifiers +; Menu, Tray, Tip, Chromebook - Kinto ; Chromebook +; Menu, Tray, Tip, IBM - Kinto ; IBM + +Menu, Keyboards, Add, Windows, winkb +Menu, Keyboards, Add, Apple, mackb +Menu, Keyboards, Add, Chromebook, chromekb +Menu, Keyboards, Add, IBM (No Super/Win key), ibmkb + +paramkb=%1% + +if paramkb = mac + checkKB = Apple +if paramkb = win + checkKB = Windows +if paramkb = chrome + checkKB = Chromebook +if paramkb = ibm + checkKB = IBM (No Super/Win key) + +menu, Keyboards, check, %checkKB% ; Set Tray menu ; Menu, Tray, Standard Menu, Tray, NoStandard ; to remove default menu -Menu, Tray, Add, Set Windows Keyboard, winkb -Menu, Tray, Add, Set Apple Keyboard, mackb +Menu, Tray, Add, Keyboard Types, :Keyboards +Menu, Tray, Add, Autodetect Keyboards, autodetect +; Menu, Tray, check, Autodetect Keyboards ; Autodetect +; Menu, Tray, disable, Autodetect Keyboards ; CB/IBM Menu, Tray, Add, Suspend Kinto, tray_suspend -Menu, Tray, Add, Returns to Desktop, min +; Menu, Tray, Add, Returns to Desktop, min Menu, Tray, Add Menu, Tray, Add, Close, Exit Menu, Tray, Click, 1 @@ -53,6 +75,18 @@ mackb(){ Run, "%A_ScriptDir%\NoShell.vbs" "%A_ScriptDir%\toggle_kb.bat" mac, "%A_ScriptDir%" } +chromekb(){ + Run, "%A_ScriptDir%\NoShell.vbs" "%A_ScriptDir%\toggle_kb.bat" chrome, "%A_ScriptDir%" +} + +ibmkb(){ + Run, "%A_ScriptDir%\NoShell.vbs" "%A_ScriptDir%\toggle_kb.bat" ibm, "%A_ScriptDir%" +} + +autodetect(){ + Run, "%A_ScriptDir%\NoShell.vbs" "%A_ScriptDir%\toggle_kb.bat" auto, "%A_ScriptDir%" +} + min(){ ; Refocus last active Window Send {LAlt down}{tab}{LAlt up} @@ -311,7 +345,8 @@ GroupAdd, intellij, ahk_exe idea64.exe ^#g::Send ^!+j ;Select all occurrences #+g::Send !+j ;Unselect occurrence ; Editing - #Space::Send ^{Space} ;Basic code completion + ; #Space::Send ^{Space} ; Default - Basic code completion + ; !Space::Send ^{Space} ; CB/IBM - Basic code completion #+Space::Send ^+{Space} ;Smart code completion #j::Send ^q ;Quick documentation lookup ^n::Send !{Insert} ;Generate code... @@ -342,7 +377,8 @@ GroupAdd, intellij, ahk_exe idea64.exe #Left::Send !{Left} ;Go to previous editor tab #l::Send ^g ;Go to line #e::Send ^e ;Recent files popup - !Space::Send ^+i ;Open quick definition lookup + ; !Space::Send ^+i ; Default - Open quick definition lookup + ; #Space::Send ^+i ; CB/IBM - Open quick definition lookup ^Y::Send ^+i ;Open quick definition lookup #+b::Send ^+b ;Go to type declaration #Up::Send !{Up} ;Go to previous @@ -384,7 +420,6 @@ GroupAdd, intellij, ahk_exe idea64.exe #IfWinActive ahk_group vscode #p::send {Up} ; Allow for traversing quick list #n::send {Down} ; Allow for traversing quick list - #Space::Send ^{Space} ; Basic code completion ; Remap Ctrl+Shift to behave like macOS Sublimetext ; Will extend cursor to multiple lines ; #+Up::send ^!{Up} ; Default - ST2CODE @@ -403,7 +438,8 @@ GroupAdd, intellij, ahk_exe idea64.exe #If #IfWinActive ahk_exe sublime_text.exe - #Space::Send ^{Space} ; Basic code completion + ; #Space::Send ^{Space} ; Default - Basic code completion + ; !Space::Send ^{Space} ; CB/IBM - Basic code completion #^Up::send !{O} ; Switch file #^f::send {F11} ; toggle_full_screen ^!v::send {Ctrl Down}k{Ctrl Up}{Ctrl Down}v{Ctrl Up} ; paste_from_history @@ -466,12 +502,14 @@ GroupAdd, intellij, ahk_exe idea64.exe #IfWinActive ahk_group terminals ; End of Line - #e:: + #e:: ; Default + !e:: ; CB/IBM Send {End} return ; Beginning of Line - #a:: + ; #a:: ; Default + ; !a:: ; CB/IBM Send {Home} return @@ -487,7 +525,8 @@ GroupAdd, intellij, ahk_exe idea64.exe return ; Sigints - interrupt - $#c::Send {Ctrl down}c{Ctrl up} + ; $#c::Send {Ctrl down}c{Ctrl up} ; Default + ; $!c::Send {Ctrl down}c{Ctrl up} ; CB/IBM ; Paste ^v:: @@ -528,19 +567,33 @@ GroupAdd, intellij, ahk_exe idea64.exe ; Clear Terminal and Scroll Buffer ^k::Send clear && printf '\e[3J'{Enter} ; Nano editor shortcuts - #g::Send {LCtrl down}g{LCtrl Up} - #k::Send {LCtrl down}k{LCtrl Up} - #x::Send {LCtrl down}x{LCtrl Up} - #o::Send {LCtrl down}o{LCtrl Up} - #r::Send {LCtrl down}r{LCtrl Up} - #w::Send {LCtrl down}w{LCtrl Up} - #\::Send {LCtrl down}\{LCtrl Up} - #u::Send {LCtrl down}u{LCtrl Up} - #j::Send {LCtrl down}j{LCtrl Up} - #t::Send {LCtrl down}t{LCtrl Up} - #_::Send {LCtrl down}_{LCtrl Up} - #z::Send {LCtrl down}z{LCtrl Up} - #y::Send {LCtrl down}y{LCtrl Up} - #v::Send {LCtrl down}v{LCtrl Up} + #g::Send {LCtrl down}g{LCtrl Up} ; Default + #k::Send {LCtrl down}k{LCtrl Up} ; Default + #x::Send {LCtrl down}x{LCtrl Up} ; Default + #o::Send {LCtrl down}o{LCtrl Up} ; Default + #r::Send {LCtrl down}r{LCtrl Up} ; Default + #w::Send {LCtrl down}w{LCtrl Up} ; Default + #\::Send {LCtrl down}\{LCtrl Up} ; Default + #u::Send {LCtrl down}u{LCtrl Up} ; Default + #j::Send {LCtrl down}j{LCtrl Up} ; Default + #t::Send {LCtrl down}t{LCtrl Up} ; Default + #_::Send {LCtrl down}_{LCtrl Up} ; Default + #z::Send {LCtrl down}z{LCtrl Up} ; Default + #y::Send {LCtrl down}y{LCtrl Up} ; Default + #v::Send {LCtrl down}v{LCtrl Up} ; Default + !g::Send {LCtrl down}g{LCtrl Up} ; CB/IBM + !k::Send {LCtrl down}k{LCtrl Up} ; CB/IBM + !x::Send {LCtrl down}x{LCtrl Up} ; CB/IBM + !o::Send {LCtrl down}o{LCtrl Up} ; CB/IBM + !r::Send {LCtrl down}r{LCtrl Up} ; CB/IBM + !w::Send {LCtrl down}w{LCtrl Up} ; CB/IBM + !\::Send {LCtrl down}\{LCtrl Up} ; CB/IBM + !u::Send {LCtrl down}u{LCtrl Up} ; CB/IBM + !j::Send {LCtrl down}j{LCtrl Up} ; CB/IBM + !t::Send {LCtrl down}t{LCtrl Up} ; CB/IBM + !_::Send {LCtrl down}_{LCtrl Up} ; CB/IBM + !z::Send {LCtrl down}z{LCtrl Up} ; CB/IBM + !y::Send {LCtrl down}y{LCtrl Up} ; CB/IBM + !v::Send {LCtrl down}v{LCtrl Up} ; CB/IBM #If #If \ No newline at end of file diff --git a/windows/toggle_kb.bat b/windows/toggle_kb.bat index bfb82f3..59ffa35 100644 --- a/windows/toggle_kb.bat +++ b/windows/toggle_kb.bat @@ -2,20 +2,58 @@ IF "%1"=="mac" goto mac IF "%1"=="win" goto win +IF "%1"=="chrome" goto chrome +IF "%1"=="ibm" goto ibm +IF "%1"=="auto" goto auto echo Not found. goto commonexit +:auto +C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(;)( )(.*)(; Autodetect)|^(?!; )(.*)(; )(Autodetect)/$6$5$6$7$3$4/g" "%userprofile%\.kinto\kinto.ahk" +"%userprofile%\.kinto\kinto-start.vbs" +goto commonexit + :win C:\Strawberry\perl\bin\perl.exe -pi -e "s/(; )(.*)(; WinModifiers)/$2$3/g" "%userprofile%\.kinto\kinto.ahk" C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!;)(.*)(; MacModifiers)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk" -"C:\Program Files\AutoHotkey\AutoHotkey.exe" "%userprofile%\.kinto\kinto.ahk" +C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!;)(.*)(; CB\/IBM)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk" +C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!;)(.*)(; IBM)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk" +C:\Strawberry\perl\bin\perl.exe -pi -e "s/(ahk\"\" )(\w*)/$1win/gm" "%userprofile%\.kinto\kinto-start.vbs" +"C:\Program Files\AutoHotkey\AutoHotkey.exe" "%userprofile%\.kinto\kinto.ahk" win goto commonexit :mac C:\Strawberry\perl\bin\perl.exe -pi -e "s/(; )(.*)(; MacModifiers)/$2$3/g" "%userprofile%\.kinto\kinto.ahk" C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!;)(.*)(; WinModifiers)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk" -"C:\Program Files\AutoHotkey\AutoHotkey.exe" "%userprofile%\.kinto\kinto.ahk" +C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!;)(.*)(; CB\/IBM)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk" +C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!;)(.*)(; IBM)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk" +C:\Strawberry\perl\bin\perl.exe -pi -e "s/(ahk\"\" )(\w*)/$1mac/gm" "%userprofile%\.kinto\kinto-start.vbs" +"C:\Program Files\AutoHotkey\AutoHotkey.exe" "%userprofile%\.kinto\kinto.ahk" mac +goto commonexit + +:chrome +C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!; )(.*)(; Autodetect)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk" +C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!;)(.*)(; WinModifiers)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk" +C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!;)(.*)(; MacModifiers)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk" +C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!;)(.*)(; Default)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk" +C:\Strawberry\perl\bin\perl.exe -pi -e "s/(; )(.*)(; Chromebook)/$2$3/g" "%userprofile%\.kinto\kinto.ahk" +C:\Strawberry\perl\bin\perl.exe -pi -e "s/(; )(.*)(; WinModifiers\/CB)/$2$3/g" "%userprofile%\.kinto\kinto.ahk" +C:\Strawberry\perl\bin\perl.exe -pi -e "s/(; )(.*)(; CB\/IBM)/$2$3/g" "%userprofile%\.kinto\kinto.ahk" +C:\Strawberry\perl\bin\perl.exe -pi -e "s/(ahk\"\" )(\w*)/$1chrome/gm" "%userprofile%\.kinto\kinto-start.vbs" +"C:\Program Files\AutoHotkey\AutoHotkey.exe" "%userprofile%\.kinto\kinto.ahk" chrome +goto commonexit + +:ibm +C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!; )(.*)(; Autodetect)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk" +C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!;)(.*)(; WinModifiers)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk" +C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!;)(.*)(; MacModifiers)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk" +C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!;)(.*)(; Default)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk" +C:\Strawberry\perl\bin\perl.exe -pi -e "s/(; )(.*)(; IBM)/$2$3/g" "%userprofile%\.kinto\kinto.ahk" +C:\Strawberry\perl\bin\perl.exe -pi -e "s/(; )(.*)(; WinModifiers\/CB\/IBM)/$2$3/g" "%userprofile%\.kinto\kinto.ahk" +C:\Strawberry\perl\bin\perl.exe -pi -e "s/(; )(.*)(; CB\/IBM)/$2$3/g" "%userprofile%\.kinto\kinto.ahk" +C:\Strawberry\perl\bin\perl.exe -pi -e "s/(ahk\"\" )(\w*)/$1ibm/gm" "%userprofile%\.kinto\kinto-start.vbs" +"C:\Program Files\AutoHotkey\AutoHotkey.exe" "%userprofile%\.kinto\kinto.ahk" ibm goto commonexit :commonexit From 0d8310670bc5e0ad6ffe18d7fb2b1d84cec89956 Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Wed, 26 Aug 2020 03:24:52 -0500 Subject: [PATCH 4/4] - Fixed installer issues on Linux --- xkeysnail-config/xkeysnail.service | 2 +- xkeysnail_service.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xkeysnail-config/xkeysnail.service b/xkeysnail-config/xkeysnail.service index 7ec1d79..dc9226f 100644 --- a/xkeysnail-config/xkeysnail.service +++ b/xkeysnail-config/xkeysnail.service @@ -5,7 +5,7 @@ Description=xkeysnail Type=simple KillMode=process ExecStart=/usr/bin/sudo /bin/bash -c '/usr/bin/xhost +SI:localuser:root && {homedir}/.config/kinto/killdups.sh && /usr/local/bin/xkeysnail --quiet --watch {homedir}/.config/kinto/kinto.py' -ExecStop=/usr/bin/sudo pkill -f xkeysnail +ExecStop=/usr/bin/sudo pkill -f xkeysnail && exit 0 Restart=on-failure RestartSec=3 Environment=DISPLAY={displayid} diff --git a/xkeysnail_service.sh b/xkeysnail_service.sh index 992f023..a1838e4 100755 --- a/xkeysnail_service.sh +++ b/xkeysnail_service.sh @@ -364,7 +364,6 @@ elif [[ $1 == "3" || $1 == "chromebook" ]]; then perl -pi -e "s/(# )(.*)(# Chromebook)/\$2\$3/g" ./xkeysnail-config/kinto.py.new perl -pi -e "s/(# )(.*)(# xfce4)/\$2\$3/g" ./xkeysnail-config/kinto.py.new perl -pi -e "s/(\w.*)(# Default)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new -fi elif [[ $1 == "4" || $1 == "ibm" ]]; then perl -pi -e "s/(# )(.*)(# IBM)/\$2\$3/g" ./xkeysnail-config/kinto.py.new perl -pi -e "s=(# )(.*)(# Chromebook/IBM)=\$2\$3=g" ./xkeysnail-config/kinto.py.new @@ -414,6 +413,7 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1 # sudo systemctl enable xkeysnail.service # fi sudo systemctl restart xkeysnail + sudo pkill -f kintotray >/dev/null 2>&1 nohup python3 ~/.config/kinto/kintotray.py& >/dev/null 2>&1 echo -e "Adding xhost fix...\n"