From 61e357b5da441ad1b64e4507812cde9b3da59d84 Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Sat, 4 Apr 2020 21:35:43 -0500 Subject: [PATCH] - Added uninstall option for Windows --- setup.py | 25 +++++++++++++++---------- windows/remove_keyswap.reg | 3 ++- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/setup.py b/setup.py index 3b97c28..802214c 100755 --- a/setup.py +++ b/setup.py @@ -37,7 +37,7 @@ def install_ibus(): sys.exit() def windows_setup(): - keymaps = ["Apple keyboard standard", "Apple keyboard w/ Caps lock as Esc", "Windows keyboard standard", "Windows keyboard w/ Caps lock as Esc"] + keymaps = ["Apple keyboard standard", "Apple keyboard w/ Caps lock as Esc", "Windows keyboard standard", "Windows keyboard w/ Caps lock as Esc","Uninstall"] for index, item in enumerate(keymaps): print(" %i. %s" % (index+1, item.capitalize())) default = 0 @@ -53,15 +53,20 @@ def windows_setup(): os.system("regedit " + path + "\\windows\\standard_ctrlalt_swap.reg") elif default == 4: os.system("regedit " + path + "\\windows\\standard_ctrlalt_capsesc_swap.reg") - 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("\nWill now install Ubuntu Terminal Theme as default...") - os.system("regedit " + path + "\\windows\\theme_ubuntu.reg") - print("Copying autohotkey combinations for Terminals & Editors...") - os.system("copy /Y " + path + "\\windows\\kinto.ahk \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\kinto.ahk\"") - 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.") + elif default == 5: + os.system("regedit " + path + "\\windows\\remove_keyswap.reg") + 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"') + print("\nWill now install Ubuntu Terminal Theme as default...") + os.system("regedit " + path + "\\windows\\theme_ubuntu.reg") + print("Copying autohotkey combinations for Terminals & Editors...") + os.system("copy /Y " + path + "\\windows\\kinto.ahk \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\kinto.ahk\"") + 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\"") # check_x11 = cmdline("env | grep -i x11").strip() diff --git a/windows/remove_keyswap.reg b/windows/remove_keyswap.reg index 67121a2..b095966 100644 --- a/windows/remove_keyswap.reg +++ b/windows/remove_keyswap.reg @@ -1,3 +1,4 @@ Windows Registry Editor Version 5.00 -[-HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout\Scancode Map] \ No newline at end of file +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout] +"Scancode Map"=- \ No newline at end of file