diff --git a/setup.py b/setup.py index 895f52e..a7bc98e 100755 --- a/setup.py +++ b/setup.py @@ -5,6 +5,7 @@ from subprocess import PIPE, Popen from prekinto import * homedir = os.path.expanduser("~") +kintotype = 0 def windows_setup(): keymaps = ["Apple keyboard standard", "Windows keyboard standard","Uninstall"] @@ -183,10 +184,11 @@ def setShortcuts(): cmdline("gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['Space','Space']\"") cmdline("gsettings set org.gnome.desktop.wm.keybindings minimize \"['h','F9']\"") cmdline("gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['Space','Space']\"") - cmdline('perl -pi -e "s/(\/\/ )(.*)(\/\/ Elementary cmdtab)/\$2\$3/g" ~/.xkb/symbols/mac_term') - cmdline('perl -pi -e "s/(\w.*)(\/\/ Default cmdtab)/\/\/ \$1\$2/g" ~/.xkb/symbols/mac_term') - cmdline('perl -pi -e "s/(\/\/ )(.*)(\/\/ Elementary cmdtab)/\$2\$3/g" ~/.xkb/symbols/mac_gui') - cmdline('perl -pi -e "s/(\w.*)(\/\/ Default cmdtab)/\/\/ \$1\$2/g" ~/.xkb/symbols/mac_gui') + if(kintotype == 2): + cmdline('perl -pi -e "s/(\/\/ )(.*)(\/\/ Elementary cmdtab)/\$2\$3/g" ~/.xkb/symbols/mac_term') + cmdline('perl -pi -e "s/(\w.*)(\/\/ Default cmdtab)/\/\/ \$1\$2/g" ~/.xkb/symbols/mac_term') + cmdline('perl -pi -e "s/(\/\/ )(.*)(\/\/ Elementary cmdtab)/\$2\$3/g" ~/.xkb/symbols/mac_gui') + cmdline('perl -pi -e "s/(\w.*)(\/\/ Default cmdtab)/\/\/ \$1\$2/g" ~/.xkb/symbols/mac_gui') # elif distro == "budgie" and dename == "gnome": # print("Apply budgie shortcuts here") elif (dename == "xfce"): @@ -327,14 +329,14 @@ def Uninstall(): def kintoImpOne(): - check_xbind = cmdline("which xbindkeys 2>/dev/null").strip() - check_xdotool = cmdline("which xdotool 2>/dev/null").strip() - check_ibus = cmdline("which ibus-setup 2>/dev/null").strip() + check_xbind = cmdline("\\which xbindkeys 2>/dev/null").strip() + check_xdotool = cmdline("\\which xdotool 2>/dev/null").strip() + check_ibus = cmdline("\\which ibus-setup 2>/dev/null").strip() - pkgm = cmdline("which apt-get 2>/dev/null").strip() + pkgm = cmdline("\\which apt-get 2>/dev/null").strip() if len(pkgm) == 0: - pkgm = cmdline("which dnf 2>/dev/null").strip() + pkgm = cmdline("\\which dnf 2>/dev/null").strip() if len(pkgm) > 0: pkgm += " check-update;sudo dnf install -y " else: @@ -342,7 +344,7 @@ def kintoImpOne(): pkgm += " update; sudo apt-get install -y " if len(pkgm) == 0: - pkgm = cmdline("which pacman 2>/dev/null").strip() + pkgm = cmdline("\\which pacman 2>/dev/null").strip() if len(pkgm) > 0: pkgm += " -Syy; sudo pacman -S " diff --git a/uninstall.sh b/uninstall.sh index 3cd3d63..8019cf6 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -1,8 +1,8 @@ #!/bin/bash # Undo Apple keyboard cmd & alt swap if test -f "/sys/module/hid_apple/parameters/swap_opt_cmd" && [ `cat /sys/module/hid_apple/parameters/swap_opt_cmd` == "1" ]; then - echo '0' | sudo tee -a /sys/module/hid_apple/parameters/swap_opt_cmd - echo 'options hid_apple swap_opt_cmd=0' | sudo tee -a /etc/modprobe.d/hid_apple.conf + echo '0' | sudo tee /sys/module/hid_apple/parameters/swap_opt_cmd + echo 'options hid_apple swap_opt_cmd=0' | sudo tee /etc/modprobe.d/hid_apple.conf sudo update-initramfs -u -k all fi systemctl --user stop keyswap 2>/dev/null diff --git a/windows/kinto.ahk b/windows/kinto.ahk index cda1156..b11d723 100644 --- a/windows/kinto.ahk +++ b/windows/kinto.ahk @@ -208,6 +208,96 @@ $^+Right::Send +{End} ; Cmd+Space Alternative ^Space::Send ^{Esc} +#IfWinActive ahk_group intellij + ; General + ^0::Send !{0} ;Open corresponding tool window + ^1::Send !{1} ;Open corresponding tool window + ^2::Send !{2} ;Open corresponding tool window + ^3::Send !{3} ;Open corresponding tool window + ^4::Send !{4} ;Open corresponding tool window + ^5::Send !{5} ;Open corresponding tool window + ^6::Send !{6} ;Open corresponding tool window + ^7::Send !{7} ;Open corresponding tool window + ^8::Send !{8} ;Open corresponding tool window + ^9::Send !{9} ;Open corresponding tool window + #`::Send ^` ;Quick switch current scheme + ^,::Send ^!s ;Open Settings dialog + ^;::Send ^!+s ;Open Project Structure dialog + ; Debugging + ^!r::Send F9 ;Resume program + ; Search/Replace + ^g::Send F3 ;Find next + ^+F3::Send Shift+F3 ;Find previous + #g::Send !j ;Select next occurrence + ^#g::Send ^!+j ;Select all occurrences + #+g::Send !+j ;Unselect occurrence + ; Editing + #Space::Send ^Space ;Basic code completion + #+Space::Send ^+Space ;Smart code completion + #j::Send ^q ;Quick documentation lookup + ^n::Send !{Insert} ;Generate code... + #o::Send ^o ;Override methods + #i::Send ^i ;Implement methods + !Up::Send ^w ;Extend selection + !Down::Send ^+w ;Shrink selection + #+q::Send !q ;Context info + #!o::Send ^!o ;Optimize imports + #!i::Send ^!i ;Auto-indent line(s) + ^Backspace::Send ^y ;Delete line at caret + #+j::Send ^+j ;Smart line join + !Delete::Send ^Delete ;Delete to word end + !Backspace::Send ^Backspace ;Delete to word start + ^+::Send ^{NumpadAdd} ;Expand code block + ^-::Send ^{NumpadSub} ;Collapse code block + ^++::Send ^+{NumpadAdd} ;Expand all + ^+-::Send ^+{NumpadSub} ;Collapse all + ^w::Send ^F4 ;Close active editor tab + ; Refactoring + ^Delete::Send !Delete ;Safe Delete + ^T::Send ^!+T ;Refactor this + ; Navigation + ^o::Send ^n ;Go to class + ^+o::Send ^+n ;Go to file + ^!o::Send ^!+n ;Go to symbol + #Right::Send !Right ;Go to next editor tab + #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 + ^Y::Send ^+i ;Open quick definition lookup + #+b::Send ^+b ;Go to type declaration + #Up::Send !Up ;Go to previous + #Down::Send !Down ;Go to next method + #h::Send ^h ;Type hierarchy + #!h::Send ^!h ;Call hierarchy + ^Down::Send ^Enter ;Edit source/View source + !Home::Send !Home ;Show navigation bar + F2::Send F11 ;Toggle bookmark + #F3::Send ^F11 ;Toggle bookmark with mnemonic + #0::Send ^{0} ;Go to numbered bookmark + #1::Send ^{1} ;Go to numbered bookmark + #2::Send ^{2} ;Go to numbered bookmark + #3::Send ^{3} ;Go to numbered bookmark + #4::Send ^{4} ;Go to numbered bookmark + #5::Send ^{5} ;Go to numbered bookmark + #6::Send ^{6} ;Go to numbered bookmark + #7::Send ^{7} ;Go to numbered bookmark + #8::Send ^{8} ;Go to numbered bookmark + #9::Send ^{9} ;Go to numbered bookmark + ^F3::Send +F11 ;Show bookmarks + ; Compile and Run + #!r::Send !+F10 ;Select configuration and run + #!d::Send !+F9 ;Select configuration and debug + #r::Send +F10 ;Run + #d::Send +F9 ;Debug + #+r::Send ^+F10 ;Run context configuration from editor + #+d::Send ^+F9 ;Debug context configuration from editor + ; VCS/Local History + #v::Send !` ;VCS quick popup + ; Sigints - interrupt + $#c::Send {Ctrl down}c{Ctrl up} +#If + ; Close all browsers #IfWinActive ahk_group browsers ^q::send {Alt Down}f{Alt Up}x ; exit all windows @@ -222,6 +312,8 @@ $^+Right::Send +{End} ; Remap Ctrl+Cmd+G to select all matches ; #^g::send ^+{L} ; ST2CODE !+g::send ^+{G} ; View source control + ; Sigints - interrupt + $#c::Send {Ctrl down}c{Ctrl up} #If #IfWinActive ahk_exe sublime_text.exe diff --git a/xkeysnail-config/kinto.py b/xkeysnail-config/kinto.py index 9181c09..3457391 100644 --- a/xkeysnail-config/kinto.py +++ b/xkeysnail-config/kinto.py @@ -66,6 +66,96 @@ define_conditional_modmap(re.compile(termStr, re.IGNORECASE), { # Key.RIGHT_CTRL: Key.LEFT_CTRL, # Mac - Multi-language (Remove) }) +# Keybindings for IntelliJ +define_keymap(re.compile("jetbrains-idea", re.IGNORECASE),{ + # General + K("C-Key_0"): K("M-Key_0"), # Open corresponding tool window + K("C-Key_1"): K("M-Key_1"), # Open corresponding tool window + K("C-Key_2"): K("M-Key_2"), # Open corresponding tool window + K("C-Key_3"): K("M-Key_3"), # Open corresponding tool window + K("C-Key_4"): K("M-Key_4"), # Open corresponding tool window + K("C-Key_5"): K("M-Key_5"), # Open corresponding tool window + K("C-Key_6"): K("M-Key_6"), # Open corresponding tool window + K("C-Key_7"): K("M-Key_7"), # Open corresponding tool window + K("C-Key_8"): K("M-Key_8"), # Open corresponding tool window + K("C-Key_9"): K("M-Key_9"), # Open corresponding tool window + K("Super-Grave"): K("C-Grave"), # Quick switch current scheme + K("C-Comma"): K("C-M-s"), # Open Settings dialog + K("C-Semicolon"): K("C-M-Shift-s"), # Open Project Structure dialog + # Debugging + K("C-M-r"): K("F9"), # Resume program + # Search/Replace + K("C-g"): K("F3"), # Find next + K("C-Shift-F3"): K("Shift-F3"), # Find previous + K("Super-g"): K("M-j"), # Select next occurrence + K("C-Super-g"): K("C-M-Shift-j"), # Select all occurrences + K("Super-Shift-g"): K("M-Shift-j"), # Unselect occurrence + # Editing + K("Super-Space"): K("C-Space"), # Basic code completion + K("Super-Shift-Space"): K("C-Shift-Space"), # Smart code completion + K("Super-j"): K("C-q"), # Quick documentation lookup + K("C-n"): K("M-Insert"), # Generate code... + K("Super-o"): K("C-o"), # Override methods + K("Super-i"): K("C-i"), # Implement methods + K("M-Up"): K("C-w"), # Extend selection + K("M-Down"): K("C-Shift-w"), # Shrink selection + K("Super-Shift-q"): K("M-q"), # Context info + K("Super-M-o"): K("C-M-o"), # Optimize imports + K("Super-M-i"): K("C-M-i"), # Auto-indent line(s) + K("C-Backspace"): K("C-y"), # Delete line at caret + K("Super-Shift-j"): K("C-Shift-j"), # Smart line join + K("M-Delete"): K("C-Delete"), # Delete to word end + K("M-Backspace"): K("C-Backspace"), # Delete to word start + K("C-Shift-Equal"): K("C-KPPLUS"), # Expand code block + K("C-Minus"): K("C-KPMINUS"), # Collapse code block + K("C-Shift-Equal"): K("C-Shift-KPPLUS"), # Expand all + K("C-Shift-Minus"): K("C-Shift-KPMINUS"), # Collapse all + K("C-w"): K("C-F4"), # Close active editor tab + # Refactoring + K("C-Delete"): K("M-Delete"), # Safe Delete + K("C-T"): K("C-M-Shift-t"), # Refactor this + # Navigation + K("C-o"): K("C-n"), # Go to class + K("C-Shift-o"): K("C-Shift-n"), # Go to file + K("C-M-o"): K("C-M-Shift-n"), # Go to symbol + K("Super-Right"): K("M-Right"), # Go to next editor tab + K("Super-Left"): K("M-Left"), # Go to previous editor tab + K("Super-l"): K("C-g"), # Go to line + K("Super-e"): K("C-e"), # Recent files popup + K("M-Space"): K("C-Shift-i"), # Open quick definition lookup + K("C-Y"): K("C-Shift-i"), # Open quick definition lookup + K("Super-Shift-b"): K("C-Shift-b"), # Go to type declaration + K("Super-Up"): K("M-Up"), # Go to previous + K("Super-Down"): K("M-Down"), # Go to next method + K("Super-h"): K("C-h"), # Type hierarchy + K("Super-M-h"): K("C-M-h"), # Call hierarchy + K("C-Down"): K("C-Enter"), # Edit source/View source + K("M-Home"): K("M-Home"), # Show navigation bar + K("F2"): K("F11"), # Toggle bookmark + K("Super-F3"): K("C-F11"), # Toggle bookmark with mnemonic + K("Super-Key_0"): K("C-Key_0"), # Go to numbered bookmark + K("Super-Key_1"): K("C-Key_1"), # Go to numbered bookmark + K("Super-Key_2"): K("C-Key_2"), # Go to numbered bookmark + K("Super-Key_3"): K("C-Key_3"), # Go to numbered bookmark + K("Super-Key_4"): K("C-Key_4"), # Go to numbered bookmark + K("Super-Key_5"): K("C-Key_5"), # Go to numbered bookmark + K("Super-Key_6"): K("C-Key_6"), # Go to numbered bookmark + K("Super-Key_7"): K("C-Key_7"), # Go to numbered bookmark + K("Super-Key_8"): K("C-Key_8"), # Go to numbered bookmark + K("Super-Key_9"): K("C-Key_9"), # Go to numbered bookmark + K("C-F3"): K("Shift-F11"), # Show bookmarks + # Compile and Run + K("Super-M-r"): K("M-Shift-F10"), # Select configuration and run + K("Super-M-d"): K("M-Shift-F9"), # Select configuration and debug + K("Super-r"): K("Shift-F10"), # Run + K("Super-d"): K("Shift-F9"), # Debug + K("Super-Shift-r"): K("C-Shift-F10"), # Run context configuration from editor + K("Super-Shift-d"): K("C-Shift-F9"), # Debug context configuration from editor + # VCS/Local History + K("Super-v"): K("M-Grave"), # VCS quick popup + K("Super-c"): K("LC-c"), # Sigints - interrupt +}) + # Keybindings for Nautilus define_keymap(re.compile("org.gnome.nautilus", re.IGNORECASE),{ K("RC-Up"): K("M-Up"), # Go Up dir @@ -171,6 +261,7 @@ define_keymap(re.compile(codeStr, re.IGNORECASE),{ K("C-g"): K("f3"), # find_next K("Shift-f3"): pass_through_key, # cancel find_prev 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("Super-Shift-up"): K("M-Shift-up"), # multi-cursor up - Sublime diff --git a/xkeysnail_service.sh b/xkeysnail_service.sh index 88224e0..2ac4f6a 100755 --- a/xkeysnail_service.sh +++ b/xkeysnail_service.sh @@ -115,7 +115,7 @@ function budgieUpdate { budgieVersion="$(/usr/bin/budgie-desktop --version | awk '{ print $2; }' | head -n1)" if [ "$budgieVersion" == "10.5.1" ]; then if ! [ -f ./system-config/budgie-daemon_10.5.1 ]; then - wget https://github.com/rbreaves/budgie-desktop/raw/f112e0e349c021c1bbfa7e45c16083eae0d92fac/binaries/budgie-daemon_10.5.1 -O ./system-config/budgie-daemon_10.5.1 + wget github.com/rbreaves/budgie-desktop/blob/binaries/binaries/budgie-daemon_10.5.1?raw=true -O ./system-config/budgie-daemon_10.5.1 fi bdmd5=$(md5sum /usr/bin/budgie-daemon | awk '{ print $1 }') newbdmd5=$(md5sum ./system-config/budgie-daemon_10.5.1 | awk '{ print $1 }') @@ -252,14 +252,14 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1 fi sed -i "s/{username}/`whoami`/g" ./xkeysnail-config/xkeysnail.service.new sed -i "s#{homedir}#`echo "$HOME"`#g" ./xkeysnail-config/xkeysnail.service.new - sed -i "s#{xhost}#`which xhost`#g" ./xkeysnail-config/xkeysnail.service.new + sed -i "s#{xhost}#`\\which xhost`#g" ./xkeysnail-config/xkeysnail.service.new sed -i "s/{username}/`whoami`/g" ./xkeysnail-config/limitedadmins.new sed -i "s#{homedir}#`echo "$HOME"`#g" ./xkeysnail-config/limitedadmins.new - sed -i "s#{systemctl}#`which systemctl`#g" ./xkeysnail-config/limitedadmins.new + sed -i "s#{systemctl}#`\\which systemctl`#g" ./xkeysnail-config/limitedadmins.new sudo chown root:root ./xkeysnail-config/limitedadmins.new sudo mv ./xkeysnail-config/limitedadmins.new /etc/sudoers.d/limitedadmins - sed -i "s#{systemctl}#`which systemctl`#g" ~/.config/autostart/xkeysnail.desktop - sed -i "s#{xhost}#`which xhost`#g" ~/.config/autostart/xkeysnail.desktop + sed -i "s#{systemctl}#`\\which systemctl`#g" ~/.config/autostart/xkeysnail.desktop + sed -i "s#{xhost}#`\\which xhost`#g" ~/.config/autostart/xkeysnail.desktop sed -i "s#{homedir}#`echo "$HOME"`#g" ~/.config/kinto/prexk.sh sed -i "s/{displayid}/`echo "$DISPLAY"`/g" ./xkeysnail-config/xkeysnail.service.new sed -i "s/{displayid}/`echo "$DISPLAY"`/g" ~/.config/kinto/prexk.sh