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