- Preliminary IBM Model M Support for Linux, partail Win setup

This commit is contained in:
Ben Reaves
2020-08-25 02:05:38 -05:00
parent a84afd5b10
commit 52f2112abd
3 changed files with 41 additions and 12 deletions

View File

@@ -8,7 +8,7 @@ homedir = os.path.expanduser("~")
kintotype = 0 kintotype = 0
def windows_setup(): 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): for index, item in enumerate(keymaps):
print(" %i. %s" % (index+1, item.capitalize())) print(" %i. %s" % (index+1, item.capitalize()))
default = 0 default = 0
@@ -17,7 +17,7 @@ def windows_setup():
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 < 3: 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"')
@@ -28,6 +28,10 @@ def windows_setup():
elif default == 2: elif default == 2:
os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; WinModifiers)/$2$3/g" .\\windows\\kinto-new.ahk') 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...") 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) 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...") print("Removing Kinto from Startup folder...")
@@ -39,7 +43,7 @@ def windows_setup():
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 < 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) 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")

View File

@@ -21,6 +21,13 @@ codeStr = "|".join(str(x) for x in mscodes)
# [Global modemap] Change modifier keys as in xmodmap # [Global modemap] Change modifier keys as in xmodmap
define_conditional_modmap(lambda wm_class: wm_class.casefold() not in terminals,{ 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 # # Chromebook
# Key.LEFT_ALT: Key.RIGHT_CTRL, # Chromebook # Key.LEFT_ALT: Key.RIGHT_CTRL, # Chromebook
# Key.LEFT_CTRL: Key.LEFT_ALT, # 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 # [Conditional modmap] Change modifier keys in certain applications
define_conditional_modmap(re.compile(termStr, re.IGNORECASE), { 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 # # Chromebook
# Key.LEFT_ALT: Key.RIGHT_CTRL, # Chromebook # Key.LEFT_ALT: Key.RIGHT_CTRL, # Chromebook
# # Left Ctrl Stays Left Ctrl # # Left Ctrl Stays Left Ctrl
@@ -183,9 +201,9 @@ define_keymap(None,{
# K("RC-Shift-Tab"): K("RC-Shift-backslash"), # xfce4 # K("RC-Shift-Tab"): K("RC-Shift-backslash"), # xfce4
# K("RC-Grave"): K("RC-Shift-backslash"), # xfce4 # K("RC-Grave"): K("RC-Shift-backslash"), # xfce4
# In-App Tab switching # In-App Tab switching
# K("M-Tab"): K("C-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 - 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 - 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-Tab"): K("LC-Tab"), # Default not-chromebook
K("Super-Shift-Tab"): K("LC-Shift-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-Shift-Up"): K("C-Shift-Home"), # Select all to Beginning of File
K("RC-Down"): K("C-End"), # End 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("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-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("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 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("C-Shift-g"): K("Shift-f3"), # find_prev
K("Super-c"): K("LC-c"), # Sigints - interrupt K("Super-c"): K("LC-c"), # Sigints - interrupt
# K("Super-C-g"): K("C-f2"), # Default - Sublime - find_all_under # 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-up"): K("M-Shift-up"), # multi-cursor up - Sublime
# K("Super-Shift-down"): K("M-Shift-down"), # multi-cursor down - Sublime # K("Super-Shift-down"): K("M-Shift-down"), # multi-cursor down - Sublime
# K(""): pass_through_key, # cancel # 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("C-Shift-f3"): pass_through_key, # cancel find_under_prev
K("Super-M-Shift-g"): K("C-Shift-f3"), # 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-f3"): pass_through_key, # Default - cancel find_all_under
# K("M-Refresh"): pass_through_key, # Chromebook - cancel find_all_under # K("M-Refresh"): pass_through_key, # Chromebook/IBM - cancel find_all_under
# K("M-C-g"): K("M-Refresh"), # Chromebook - 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("Super-C-g"): K("M-f3"), # Default - find_all_under
K("C-Shift-up"): pass_through_key, # cancel swap_line_up K("C-Shift-up"): pass_through_key, # cancel swap_line_up
K("Super-M-up"): K("C-Shift-up"), # swap_line_up K("Super-M-up"): K("C-Shift-up"), # swap_line_up

View File

@@ -186,6 +186,7 @@ if [ $# -eq 0 ]; then
echo " 1) Windows & Mac (HID driver) - Most Standard keyboards (& 1st party usb/bt Apple keyboards)" 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 " 2) Mac Only & VMs on Macbooks - 3rd & 1st party Apple keyboards"
echo " 3) Chromebook - Chromebook running Linux" echo " 3) Chromebook - Chromebook running Linux"
echo " 4) IBM M - Keyboards w/o Super/Win keys"
# echo " 5) Uninstall" # echo " 5) Uninstall"
read n read n
@@ -200,7 +201,7 @@ rightalt=false
# VS code remap # VS code remap
vssublime=false 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 if [[ $dename == "gnome" || $dename == "budgie" || $dename == "mate" || $dename == "xfce" ]];then
installtray=true installtray=true
while true; do 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/(# )(.*)(# xfce4)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
perl -pi -e "s/(\w.*)(# Default)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new perl -pi -e "s/(\w.*)(# Default)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new
fi 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 if $rightalt ; then
perl -pi -e "s/(\w.*)(Multi-language)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1 perl -pi -e "s/(\w.*)(Multi-language)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1