- Merged hotfixes and Windows IBM support

This commit is contained in:
Ben Reaves
2020-08-25 03:23:50 -05:00
6 changed files with 72 additions and 48 deletions

View File

@@ -16,13 +16,13 @@ def windows_setup():
default = int(input("\nPlease enter your desired keymap (1 - " + str(len(keymaps)) + ") : ")) default = int(input("\nPlease enter your desired keymap (1 - " + str(len(keymaps)) + ") : "))
print("") print("")
# Short DOS path notation # Short DOS path notation
path= cmdline('echo %cd%')[:-1] path= cmdline('echo ''%cd%''')[:-1]
if default > 0 and default < 5: if default > 0 and default < 5:
print("Will now install chocolatey and autohotkey with elevated privileges...") print("Will now install chocolatey and autohotkey with elevated privileges...")
print("This install will fail if you are not running with elevated privileges") print("This install will fail if you are not running with elevated privileges")
os.system('powershell -executionpolicy bypass ".\\windows\\autohotkey.ps1"') os.system('powershell -executionpolicy bypass ".\\windows\\autohotkey.ps1"')
print("Copying autohotkey combinations for Terminals & Editors...") print("Copying autohotkey combinations for Terminals & Editors...")
os.system("copy /Y " + path + "\\windows\\kinto.ahk " + path + "\\windows\\kinto-new.ahk") os.system('copy /Y "' + path + '\\windows\\kinto.ahk" "' + path + '\\windows\\kinto-new.ahk"')
if default == 1: if default == 1:
os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; MacModifiers)/$2$3/g" .\\windows\\kinto-new.ahk') 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:
@@ -40,27 +40,28 @@ def windows_setup():
print("Ending any running Kinto tasks...") print("Ending any running Kinto tasks...")
os.system("(taskkill /IM autohotkey.exe) 2> nul") os.system("(taskkill /IM autohotkey.exe) 2> nul")
print("Removing Kinto from users profile directory...") print("Removing Kinto from users profile directory...")
os.system('(rd /s /q %userprofile%\\.kinto) 2> nul') os.system('(rd /s /q "%userprofile%\\.kinto") 2> nul')
print("") print("")
print("Uninstall of Kinto is Complete.") print("Uninstall of Kinto is Complete.")
if default > 0 and default < 5: 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) 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...") print("\nWill now install Ubuntu Termimnal Theme as default...")
os.system("regedit " + path + "\\windows\\theme_ubuntu.reg") os.system('regedit "' + path + '\\windows\\theme_ubuntu.reg"')
os.system('robocopy '+ path + '\\assets "%userprofile%\\.kinto\\assets" /E') os.system('robocopy "'+ path + '\\assets" "%userprofile%\\.kinto\\assets" /E')
if(stvscode): if(stvscode):
os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; ST2CODE)/$2$3/g" .\\windows\\kinto-new.ahk') os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; 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\\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\\usb.vbs" "%userprofile%\\.kinto\\usb.vbs"')
os.system('copy /Y ' + path + '\\windows\\detectUSB.ahk "%userprofile%\\.kinto\\detectUSB.ahk"') 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"') os.system('mklink "%userprofile%\\Start Menu\\Programs\\Startup\\kinto-start.vbs" "%userprofile%\\.kinto\\kinto-start.vbs"')
os.system('copy /Y '+ path + '\\windows\\NoShell.vbs "%userprofile%\\.kinto\\NoShell.vbs"') os.system('copy /Y "'+ path + '\\windows\\NoShell.vbs" "%userprofile%\\.kinto\\NoShell.vbs"')
os.system('copy /Y '+ path + '\\windows\\toggle_kb.bat "%userprofile%\\.kinto\\toggle_kb.bat"') os.system('copy /Y "'+ path + '\\windows\\toggle_kb.bat" "%userprofile%\\.kinto\\toggle_kb.bat"')
os.system('copy /Y '+ path + '\\windows\\kinto-new.ahk "%userprofile%\\.kinto\\kinto.ahk"') os.system('copy /Y "'+ path + '\\windows\\kinto-new.ahk" "%userprofile%\\.kinto\\kinto.ahk"')
os.system("del /f .\\windows\\kinto-new.ahk") os.system("del /f .\\windows\\kinto-new.ahk")
os.system("del \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\kinto.ahk\" 2> nul") os.system("del \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\kinto.ahk\" 2> nul")
os.system("%userprofile%\\AppData\\Roaming\\Microsoft\\Windows\\STARTM~1\\Programs\\Startup\\kinto-start.vbs") userpath = cmdline('cmd /c for %A in ("%userprofile%") do @echo %~sA')[:-1]
print('Starting... "' + userpath + '\\AppData\\Roaming\\Microsoft\\Windows\\STARTM~1\\Programs\\Startup\\kinto-start.vbs"')
os.system('"' + userpath + '\\AppData\\Roaming\\Microsoft\\Windows\\STARTM~1\\Programs\\Startup\\kinto-start.vbs"')
# # print("\nPlease log off and back on for changes to take full effect.") # # print("\nPlease log off and back on for changes to take full effect.")
print("If using WSL then please remember to right click on title bar -> Properties -> Edit Options -> Use Ctrl+Shift+C/V as Copy/Paste and enable it.") print("If using WSL then please remember to right click on title bar -> Properties -> Edit Options -> Use Ctrl+Shift+C/V as Copy/Paste and enable it.")
else: else:

View File

@@ -11,13 +11,12 @@ WinHide % "ahk_id " DllCall("GetConsoleWindow", "ptr")
notify_change(wParam, lParam, msg, hwnd) notify_change(wParam, lParam, msg, hwnd)
{ {
global lastkb global lastkb
; kbtype = % ComObjCreate("WScript.Shell").Exec("cscript /nologo usb.vbs").StdOut.ReadAll()
DetectHiddenWindows On DetectHiddenWindows On
Run %ComSpec%,, Hide, pid Run %ComSpec%,, Hide, pid
WinWait ahk_pid %pid% WinWait ahk_pid %pid%
DllCall("AttachConsole", "UInt", pid) DllCall("AttachConsole", "UInt", pid)
WshShell := ComObjCreate("Wscript.Shell") WshShell := ComObjCreate("Wscript.Shell")
exec := WshShell.Exec("cscript /nologo usb.vbs") exec := WshShell.Exec("cscript /nologo ""%userprofile%\.kinto\usb.vbs""")
kbtype := exec.StdOut.ReadAll() kbtype := exec.StdOut.ReadAll()
DllCall("FreeConsole") DllCall("FreeConsole")
Process Close, %pid% Process Close, %pid%
@@ -27,11 +26,11 @@ notify_change(wParam, lParam, msg, hwnd)
if InStr(kbtype, "Apple") if InStr(kbtype, "Apple")
{ {
; MsgBox, Apple ; MsgBox, Apple
Run, %A_ScriptDir%\NoShell.vbs %A_ScriptDir%\toggle_kb.bat mac, %A_ScriptDir% Run, "%A_ScriptDir%\NoShell.vbs" "%A_ScriptDir%\toggle_kb.bat" mac, "%A_ScriptDir%"
} }
else{ else{
; MsgBox, Windows ; MsgBox, Windows
Run, %A_ScriptDir%\NoShell.vbs %A_ScriptDir%\toggle_kb.bat win, %A_ScriptDir% Run, "%A_ScriptDir%\NoShell.vbs" "%A_ScriptDir%\toggle_kb.bat" win, "%A_ScriptDir%"
} }
; MsgBox % kbtype ; MsgBox % kbtype
} }

View File

@@ -2,6 +2,6 @@ Set oShell = CreateObject("Shell.Application")
Set wShell = WScript.CreateObject("WScript.Shell") Set wShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject") Set fso = CreateObject("Scripting.FileSystemObject")
path = wShell.ExpandEnvironmentStrings("%userprofile%") path = wShell.ExpandEnvironmentStrings("""%userprofile%")
strFolder = fso.BuildPath(path, "\.kinto\kinto.ahk") strFolder = fso.BuildPath( path, "\.kinto\kinto.ahk""")
oShell.ShellExecute "C:\Program Files\AutoHotkey\AutoHotkey.exe", strFolder, , "runas", 0 oShell.ShellExecute "C:\Program Files\AutoHotkey\AutoHotkey.exe", strFolder, , "runas", 0

View File

@@ -29,10 +29,10 @@ AHK_NOTIFYICON(wParam, lParam)
; Menu, Tray, Icon, %I_Icon%,, 1 ; MacModifiers ; Menu, Tray, Icon, %I_Icon%,, 1 ; MacModifiers
; Menu, Tray, Tip, Mac - Kinto ; MacModifiers ; Menu, Tray, Tip, Mac - Kinto ; MacModifiers
; I_Icon = %A_ScriptDir%\assets\kinto-white-invert.ico ; WinModifiers ; I_Icon = %A_ScriptDir%\assets\kinto-white-invert.ico ; WinModifiers/CB/IBM
; IfExist, %I_Icon% ; WinModifiers ; IfExist, %I_Icon% ; WinModifiers/CB/IBM
; Menu, Tray, Icon, %I_Icon%,, 1 ; WinModifiers ; Menu, Tray, Icon, %I_Icon%,, 1 ; WinModifiers/CB/IBM
; Menu, Tray, Tip, Windows - Kinto ; WinModifiers ; Menu, Tray, Tip, Windows - Kinto ; WinModifiers/CB/IBM
; Set Tray menu ; Set Tray menu
; Menu, Tray, Standard ; Menu, Tray, Standard
@@ -46,11 +46,11 @@ Menu, Tray, Add, Close, Exit
Menu, Tray, Click, 1 Menu, Tray, Click, 1
winkb(){ winkb(){
Run, %A_ScriptDir%\NoShell.vbs %A_ScriptDir%\toggle_kb.bat win, %A_ScriptDir% Run, "%A_ScriptDir%\NoShell.vbs" "%A_ScriptDir%\toggle_kb.bat" win, "%A_ScriptDir%"
} }
mackb(){ mackb(){
Run, %A_ScriptDir%\NoShell.vbs %A_ScriptDir%\toggle_kb.bat mac, %A_ScriptDir% Run, "%A_ScriptDir%\NoShell.vbs" "%A_ScriptDir%\toggle_kb.bat" mac, "%A_ScriptDir%"
} }
min(){ min(){
@@ -71,7 +71,7 @@ tray_suspend(){
else{ else{
menu, tray, unCheck, Suspend Kinto menu, tray, unCheck, Suspend Kinto
; I_Icon = %A_ScriptDir%\assets\kinto-white.ico ; MacModifiers ; I_Icon = %A_ScriptDir%\assets\kinto-white.ico ; MacModifiers
; I_Icon = %A_ScriptDir%\assets\kinto-white-invert.ico ; WinModifiers ; I_Icon = %A_ScriptDir%\assets\kinto-white-invert.ico ; WinModifiers/CB/IBM
Menu, Tray, Icon, %I_Icon%,,1 Menu, Tray, Icon, %I_Icon%,,1
Run, %A_ScriptDir%\detectUSB.ahk Run, %A_ScriptDir%\detectUSB.ahk
} }
@@ -134,6 +134,8 @@ GroupAdd, vstudio, ahk_exe devenv.exe
GroupAdd, intellij, ahk_exe idea.exe GroupAdd, intellij, ahk_exe idea.exe
GroupAdd, intellij, ahk_exe idea64.exe GroupAdd, intellij, ahk_exe idea64.exe
; SetCapsLockState, AlwaysOff ; CB/IBM
#IfWinNotActive ahk_group virtm #IfWinNotActive ahk_group virtm
; New AltTab and CtrlTab fix ; New AltTab and CtrlTab fix
@@ -145,31 +147,35 @@ GroupAdd, intellij, ahk_exe idea64.exe
; Send {LCtrl down}{Secondary up}{tab} ; Send {LCtrl down}{Secondary up}{tab}
; Send {LCtrl down}{LWin up}{tab} ; WinModifiers ; Send {LCtrl down}{LWin up}{tab} ; WinModifiers
; Send {LCtrl down}{LAlt up}{tab} ; MacModifiers ; Send {LCtrl down}{LAlt up}{tab} ; MacModifiers
; Send {LCtrl down}{CapsLock up}{tab} ; CB/IBM
KeyWait, tab KeyWait, tab
; Tertiary ; Tertiary
} else if (GetKeyState("LCtrl", "P") AND GetKeyState("LShift", "P")) { } else if (GetKeyState("LCtrl", "P") AND GetKeyState("LShift", "P")) {
; Secondary ; Secondary
; Send {LCtrl down}{Secondary up}{LShift down}{tab} ; 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
; Send {LCtrl down}{LAlt up}{LShift down}{tab} ; MacModifiers ; Send {LCtrl down}{LAlt up}{LShift down}{tab} ; MacModifiers
; Send {LCtrl down}{CapsLock up}{LShift down}{tab} ; CB/IBM
KeyWait, tab KeyWait, tab
; Primary ; Primary
; } else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P") = false) { ; WinModifiers ; } else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P") = false) { ; WinModifiers/CB/IBM
; } else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P") = false) { ; MacModifiers ; } else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P") = false) { ; MacModifiers
Send {LAlt down}{tab} Send {LAlt down}{tab}
KeyWait, tab KeyWait, tab
; Primary ; Primary
; } else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P")) { ; WinModifiers ; } else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P")) { ; WinModifiers/CB/IBM
; } else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P")) { ; MacModifiers ; } else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P")) { ; MacModifiers
Send {LAlt down}{LShift down}{tab} Send {LAlt down}{LShift down}{tab}
KeyWait, tab KeyWait, tab
; Secondary ; Secondary
; } else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P")) = false { ; WinModifiers ; } else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P")) = false { ; WinModifiers
; } else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P") = false) { ; MacModifiers ; } else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P") = false) { ; MacModifiers
; } else if (GetKeyState("CapsLock", "P") AND GetKeyState("LShift", "P")) = false { ; CB/IBM
return return
; Secondary ; Secondary
; } else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P")) { ; WinModifiers ; } else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P")) { ; WinModifiers
; } else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P")) { ; MacModifiers ; } else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P")) { ; MacModifiers
; } else if (GetKeyState("CapsLock", "P") AND GetKeyState("LShift", "P")) { ; CB/IBM
return return
} else { } else {
send {Blind}{tab} send {Blind}{tab}
@@ -187,6 +193,11 @@ GroupAdd, intellij, ahk_exe idea64.exe
; Secondary::LAlt ; Secondary::LAlt
; Tertiary::LWin ; Tertiary::LWin
; $LAlt::LCtrl ; CB/IBM
; $RAlt::RCtrl ; CB/IBM
; $CapsLock::LWin ; CB/IBM
; $LCtrl::LAlt ; CB/IBM
; $LAlt::LCtrl ; WinModifiers ; $LAlt::LCtrl ; WinModifiers
; $RAlt::RCtrl ; WinModifiers ; $RAlt::RCtrl ; WinModifiers
; $LWin::LAlt ; WinModifiers ; $LWin::LAlt ; WinModifiers
@@ -372,13 +383,19 @@ GroupAdd, intellij, ahk_exe idea64.exe
#IfWinActive ahk_group vscode #IfWinActive ahk_group vscode
; Remap Ctrl+Shift to behave like macOS Sublimetext ; Remap Ctrl+Shift to behave like macOS Sublimetext
; Will extend cursor to multiple lines ; Will extend cursor to multiple lines
; #+Up::send ^!{Up} ; ST2CODE ; #+Up::send ^!{Up} ; Default - ST2CODE
; #+Down::send ^!{Down} ; ST2CODE ; !+Up::send ^!{Up} ; CB/IBM - ST2CODE
; #+Down::send ^!{Down} ; Default - ST2CODE
; !+Down::send ^!{Down} ; CB/IBM - ST2CODE
; Remap Ctrl+Cmd+G to select all matches ; Remap Ctrl+Cmd+G to select all matches
; #^g::send ^+{L} ; ST2CODE ; #^g::send ^+{L} ; Default - ST2CODE
!+g::send ^+{G} ; View source control ; !^g::send ^+{L} ; CB/IBM - ST2CODE
; Sigints - interrupt !+g::send ^+{G} ; View source control
$#c::Send {Ctrl down}c{Ctrl up} ; $#c::Send {Ctrl down}c{Ctrl up} ; Default - Sigints interrupt
; $!c::Send {Ctrl down}c{Ctrl up} ; CB/IBM
; #Space::Send ^{Space} ; Default - Basic code completion
; !Space::Send ^{Space} ; CB/IBM - Basic code completion
#If #If
#IfWinActive ahk_exe sublime_text.exe #IfWinActive ahk_exe sublime_text.exe
@@ -389,8 +406,10 @@ GroupAdd, intellij, ahk_exe idea64.exe
^!Up::send ^{Up} ; scroll_lines up ^!Up::send ^{Up} ; scroll_lines up
^Down::Return ; cancel scroll_lines down ^Down::Return ; cancel scroll_lines down
^!Down::send ^{Down} ; scroll_lines down ^!Down::send ^{Down} ; scroll_lines down
#+Up::send {shift up}^!{Up} ; multi-cursor up ; #+Up::send {shift up}^!{Up} ; Default - multi-cursor up
#+Down::send {shift up}^!{Down} ; multi-cursor down ; #+Down::send {shift up}^!{Down} ; Default - multi-cursor down
; #+Up::send {shift up}^!{Up} ; CB/IBM - multi-cursor up
; #+Down::send {shift up}^!{Down} ; CB/IBM - multi-cursor down
^PgDn::Return ; cancel next_view ^PgDn::Return ; cancel next_view
^PgUp::Return ; cancel prev_view ^PgUp::Return ; cancel prev_view
^+{::send ^{PgDn} ; next_view ^+{::send ^{PgDn} ; next_view
@@ -411,7 +430,8 @@ GroupAdd, intellij, ahk_exe idea64.exe
^+g::send +{F3} ; find_prev ^+g::send +{F3} ; find_prev
#!g::send ^{F3} ; find_under #!g::send ^{F3} ; find_under
#!+g::send ^+{F3} ; find_under_prev #!+g::send ^+{F3} ; find_under_prev
#^g::send !{F3} ; find_all_under ; #^g::send !{F3} ; Default - find_all_under
; !^g::send !{F3} ; CB/IBM - find_all_under
^+Up::Return ; cancel swap_line_up ^+Up::Return ; cancel swap_line_up
#!Up::send ^+{Up} ; swap_line_up #!Up::send ^+{Up} ; swap_line_up
^+Down::Return ; cancel swap_line_down ^+Down::Return ; cancel swap_line_down

View File

@@ -1,5 +1,5 @@
Option Explicit Option Explicit
Dim oWMISrv, collDvcs, iUSBDvc , iDvc, sDvcID, sPID, sVID Dim oWMISrv, collDvcs, iUSBDvc , iDvc, sDvcID, sPID, sVID, deviceID
' add item to array ' add item to array
Function AddItem(arr, val) Function AddItem(arr, val)
@@ -49,21 +49,23 @@ Dim nonApple: nonApple = 0
Dim i Dim i
If vcount = 1 Then If vcount = 1 Then
deviceID = deviceVID(0)
If StrComp(deviceVID(0), "05AC") = 0 Then If StrComp(deviceVID(0), "05AC") = 0 Then
Wscript.Echo "Apple" Wscript.Echo "Apple " & deviceID
Else Else
Wscript.Echo "Windows" Wscript.Echo "Windows " & deviceID
End If End If
Else Else
For i = 0 To counter-1 For i = 0 To counter-1
deviceID = deviceVID(i)
If StrComp(deviceVID(i), "05AC") = -1 Then If StrComp(deviceVID(i), "05AC") = -1 Then
nonApple = 1 nonApple = 1
End If End If
Next Next
If nonApple = 1 Then If nonApple = 1 Then
Wscript.Echo "Windows" Wscript.Echo "Windows " & deviceID
Else Else
Wscript.Echo "Apple" Wscript.Echo "Apple " & deviceID
End If End If
End If End If

View File

@@ -232,6 +232,7 @@ define_keymap(None,{
}) })
define_keymap(lambda wm_class: wm_class.casefold() not in mscodes,{ define_keymap(lambda wm_class: wm_class.casefold() not in mscodes,{
K("Super-Space"): K("C-Space"), # Basic code completion
# Wordwise remaining - for Everything but VS Code # Wordwise remaining - for Everything but VS Code
K("M-Left"): K("C-Left"), # Left of Word K("M-Left"): K("C-Left"), # Left of Word
K("M-Shift-Left"): K("C-Shift-Left"), # Select Left of Word K("M-Shift-Left"): K("C-Shift-Left"), # Select Left of Word
@@ -291,6 +292,7 @@ define_keymap(re.compile(codeStr, re.IGNORECASE),{
# Keybindings for Sublime Text # Keybindings for Sublime Text
define_keymap(re.compile("Sublime_text", re.IGNORECASE),{ define_keymap(re.compile("Sublime_text", re.IGNORECASE),{
K("Super-Space"): K("C-Space"), # Basic code completion
K("C-Super-up"): K("M-o"), # Switch file K("C-Super-up"): K("M-o"), # Switch file
K("Super-RC-f"): K("f11"), # toggle_full_screen K("Super-RC-f"): K("f11"), # toggle_full_screen
K("C-M-v"): [K("C-k"), K("C-v")], # paste_from_history K("C-M-v"): [K("C-k"), K("C-v")], # paste_from_history