From da22daf1f318c42cb1761fc4c3c06fe1d7ce8554 Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Fri, 19 Jun 2020 19:03:06 -0700 Subject: [PATCH 1/4] - Corrected autohotkey/choco install script, added setup for powershell --- setup.ps1 | 1 + windows/autohotkey.ps1 | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 setup.ps1 diff --git a/setup.ps1 b/setup.ps1 new file mode 100644 index 0000000..07d5c51 --- /dev/null +++ b/setup.ps1 @@ -0,0 +1 @@ +Add-AppxPackage -register "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2241.0_x64__qbz5n2kfra8p0\AppxManifest.xml" -DisableDevelopmentMode \ No newline at end of file diff --git a/windows/autohotkey.ps1 b/windows/autohotkey.ps1 index af83f93..419b6b4 100644 --- a/windows/autohotkey.ps1 +++ b/windows/autohotkey.ps1 @@ -1,10 +1,9 @@ -$testchoco = powershell choco -v -if(-not($testchoco)){ +if(-not(Get-Command "choco" -errorAction SilentlyContinue)){ Write-Output "Seems Chocolatey is not installed, installing now" Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) } else{ - Write-Output "Chocolatey Version $testchoco is already installed" + Write-Output "Chocolatey is already installed" } if(-not(test-path "C:\Program Files\AutoHotkey\AutoHotkey.exe")){ From 70774c343130096956f0cec3ab683c6aafb9f4ad Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Fri, 19 Jun 2020 20:18:03 -0700 Subject: [PATCH 2/4] - More updates to the Windows based installer --- setup.ps1 | 1 - setup.py | 7 +++---- windows/autohotkey.ps1 | 7 +++++++ 3 files changed, 10 insertions(+), 5 deletions(-) delete mode 100644 setup.ps1 diff --git a/setup.ps1 b/setup.ps1 deleted file mode 100644 index 07d5c51..0000000 --- a/setup.ps1 +++ /dev/null @@ -1 +0,0 @@ -Add-AppxPackage -register "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2241.0_x64__qbz5n2kfra8p0\AppxManifest.xml" -DisableDevelopmentMode \ No newline at end of file diff --git a/setup.py b/setup.py index a88afcc..1e48951 100755 --- a/setup.py +++ b/setup.py @@ -17,6 +17,9 @@ def windows_setup(): # Short DOS path notation path= cmdline('echo %cd%')[:-1] if default > 0 and default < 3: + 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"') print("Copying autohotkey combinations for Terminals & Editors...") os.system("copy /Y " + path + "\\windows\\kinto.ahk " + path + "\\windows\\kinto-new.ahk") if default == 1: @@ -39,10 +42,6 @@ def windows_setup(): print("Uninstall of Kinto is Complete.") if default > 0 and default < 3: stvscode = yn_choice(bcolors.CYELLOW2 + "Would you like to use Sublime Text 3 keymaps in VS Code?\n" + bcolors.ENDC) - 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"') - os.system('refreshenv') 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') diff --git a/windows/autohotkey.ps1 b/windows/autohotkey.ps1 index 419b6b4..4293f3a 100644 --- a/windows/autohotkey.ps1 +++ b/windows/autohotkey.ps1 @@ -9,6 +9,13 @@ else{ if(-not(test-path "C:\Program Files\AutoHotkey\AutoHotkey.exe")){ choco install autohotkey.install } +else{ + Write-Output "Autohotkey is already installed" +} if(-not(test-path "C:\Strawberry\")){ choco install strawberryperl + refreshenv +} +else{ + Write-Output "Perl is already installed" } From d52d8cc34f85ef51052022c64afcd5ff1863c717 Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Fri, 19 Jun 2020 18:53:29 -0700 Subject: [PATCH 3/4] - Windows installer fixes, perl fixes --- setup.py | 22 ++++++++++------------ windows/autohotkey.ps1 | 1 + windows/toggle_kb.bat | 8 ++++---- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/setup.py b/setup.py index 1e48951..895f52e 100755 --- a/setup.py +++ b/setup.py @@ -23,21 +23,19 @@ def windows_setup(): print("Copying autohotkey combinations for Terminals & Editors...") os.system("copy /Y " + path + "\\windows\\kinto.ahk " + path + "\\windows\\kinto-new.ahk") if default == 1: - os.system('perl -pi -e "s/(; )(.*)(; MacModifiers)/$2$3/g" ./windows/kinto-new.ahk') - # os.system("regedit " + path + "\\windows\\macbook_winctrl_swap.reg") - elif default == 2: - os.system('perl -pi -e "s/(; )(.*)(; WinModifiers)/$2$3/g" ./windows/kinto-new.ahk') - # os.system("regedit " + path + "\\windows\\standard_ctrlalt_swap.reg") + 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: 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...") - os.system("(del \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\kinto.ahk\") 2>$null") - os.system('(del "%userprofile%\\AppData\\Roaming\\Microsoft\\Windows\\STARTM~1\\Programs\\Startup\\kinto-start.vbs") 2>$null') + os.system("(del \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\kinto.ahk\") 2> nul") + os.system('(del "%userprofile%\\AppData\\Roaming\\Microsoft\\Windows\\STARTM~1\\Programs\\Startup\\kinto-start.vbs") 2> nul') print("Ending any running Kinto tasks...") - os.system("(taskkill /IM autohotkey.exe) 2>$null") + os.system("(taskkill /IM autohotkey.exe) 2> nul") print("Removing Kinto from users profile directory...") - os.system('(rd /s /q %userprofile%\\.kinto) 2>$null') + os.system('(rd /s /q %userprofile%\\.kinto) 2> nul') print("") print("Uninstall of Kinto is Complete.") if default > 0 and default < 3: @@ -46,7 +44,7 @@ def windows_setup(): os.system("regedit " + path + "\\windows\\theme_ubuntu.reg") os.system('robocopy '+ path + '\\assets "%userprofile%\\.kinto\\assets" /E') if(stvscode): - os.system('perl -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\\usb.vbs "%userprofile%\\.kinto\\usb.vbs"') os.system('copy /Y ' + path + '\\windows\\detectUSB.ahk "%userprofile%\\.kinto\\detectUSB.ahk"') @@ -55,13 +53,13 @@ def windows_setup(): 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("del /f .\\windows\\kinto-new.ahk") - os.system("del \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\kinto.ahk\"") + 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") # # 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.") else: - os.system("(del \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\kinto.ahk\") 2>$null") + os.system("(del \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\kinto.ahk\") 2> nul") def cmdline(command): process = Popen( diff --git a/windows/autohotkey.ps1 b/windows/autohotkey.ps1 index 4293f3a..1b2c5a7 100644 --- a/windows/autohotkey.ps1 +++ b/windows/autohotkey.ps1 @@ -1,6 +1,7 @@ if(-not(Get-Command "choco" -errorAction SilentlyContinue)){ Write-Output "Seems Chocolatey is not installed, installing now" Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) + refreshenv } else{ Write-Output "Chocolatey is already installed" diff --git a/windows/toggle_kb.bat b/windows/toggle_kb.bat index 8cd118e..06eafeb 100644 --- a/windows/toggle_kb.bat +++ b/windows/toggle_kb.bat @@ -7,14 +7,14 @@ echo Not found. goto commonexit :win -perl -pi -e "s/(; )(.*)(; WinModifiers)/$2$3/g" "%userprofile%\.kinto\kinto.ahk" -perl -pi -e "s/^(?!;)(.*)(; MacModifiers)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk" +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" goto commonexit :mac -perl -pi -e "s/(; )(.*)(; MacModifiers)/$2$3/g" "%userprofile%\.kinto\kinto.ahk" -perl -pi -e "s/^(?!;)(.*)(; WinModifiers)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk" +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" goto commonexit From 85d6653261c1a5e2d76d05666f10673aee8e7c00 Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Sat, 20 Jun 2020 01:35:11 -0500 Subject: [PATCH 4/4] - toggle_kb.bat syntax fix --- windows/toggle_kb.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windows/toggle_kb.bat b/windows/toggle_kb.bat index 06eafeb..bfb82f3 100644 --- a/windows/toggle_kb.bat +++ b/windows/toggle_kb.bat @@ -8,7 +8,7 @@ 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:\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" goto commonexit