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