diff --git a/README.md b/README.md index 92a2de3..1e0c33a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Kinto +# Kinto.sh -![kinto-color-132](https://user-images.githubusercontent.com/10969616/84361571-7d5bd780-ab91-11ea-81bc-4d3a2ca51c4e.png) +![kinto-color-132](https://user-images.githubusercontent.com/10969616/94909977-9d2d4900-0469-11eb-8710-986289fe7240.gif) [![GitHub release](https://img.shields.io/github/release/rbreaves/kinto.svg)](https://github.com/rbreaves/kinto/releases/latest) @@ -14,6 +14,8 @@ System tray supports the following, but Kinto can run without it on Linux. |---|---| ||| +Note: This project does a lot more than just copy & paste for terminals. I really do mean type like a mac and additions can easily be added to a single file, kinto.py/ahk. + ## Table of Contents [What does this do exactly?](#What-does-this-do-exactly) @@ -64,6 +66,8 @@ Kinto works for standard Windows, Apple and Chromebook keyboards. The following |---|---|---|---|---| |**Virtual**| LCtrl | Alt | RCtrl |Spacebar| +Note: RCtrl for terminals is also adding in Shift most of the time, however it depends on the specific terminal in use and will change itself to the expected keymaps of that terminal application. + ## What's different? Compared to most other remappers ***this is a complete system-wide remap of your base level modifier keys***, this saves time. You're not going to die a death of a thousand papercuts from trying to support every shortcut key under the sun. @@ -291,44 +295,44 @@ git pull origin master Under systemd this is how you control Kinto. -Kinto (xkb/x11) = keyswap +Recommended Install - Kinto (udev/xkeysnail/x11) = xkeysnail -Kinto (udev/xkeysnail/x11) = xkeysnail +Older Install - Kinto (xkb/x11) = keyswap Status ``` -systemctl --user status keyswap sudo systemctl status xkeysnail +systemctl --user status keyswap # older - you probably should not run this one ``` Stop (your keymap will return to normal) ``` -systemctl --user stop keyswap sudo systemctl stop xkeysnail +systemctl --user stop keyswap # older - you probably should not run this one ``` Start ``` -systemctl --user start keyswap sudo systemctl start xkeysnail +systemctl --user start keyswap # older - you probably should not run this one ``` Restart ``` -systemctl --user restart keyswap sudo systemctl restart xkeysnail +systemctl --user restart keyswap # older - you probably should not run this one ``` Enable ``` -systemctl --user enable keyswap sudo systemctl enable xkeysnail +systemctl --user enable keyswap # older - you probably should not run this one ``` Disable ``` -systemctl --user disable keyswap sudo systemctl disable xkeysnail +systemctl --user disable keyswap # older - you probably should not run this one ``` ## Learning macOS style hotkeys on Linux diff --git a/setup.py b/setup.py index 34a352e..9501be2 100755 --- a/setup.py +++ b/setup.py @@ -167,7 +167,8 @@ def setShortcuts(): # Too slow on appearing, compared to the app menu # # if dename != "budgie": - cmdline("gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['Space','Space']\"") + cmdline("gsettings reset org.gnome.desktop.wm.keybindings panel-main-menu") + # cmdline("gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['Space','Space']\"") # else: # cmdline("gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['F1']\"") # cmdline("gsettings set org.gnome.desktop.wm.keybindings panel-run-dialog \"['Space','Space']\"") @@ -180,12 +181,14 @@ def setShortcuts(): cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left ['']") cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-right ['']") 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("gsettings reset org.gnome.desktop.wm.keybindings panel-main-menu") + # cmdline("gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['Space','Space']\"") elif distro == "pop!_os" and dename == "gnome": cmdline("gsettings set org.gnome.desktop.wm.keybindings close \"['F4','w']\"") cmdline("gsettings set org.gnome.desktop.wm.keybindings toggle-maximized \"['F10','Up']\"") 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("gsettings reset org.gnome.desktop.wm.keybindings panel-main-menu") + # cmdline("gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['Space','Space']\"") cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-up \"['Up','Left']\"") cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-down \"['Down','Right']\"") cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left ['']") @@ -199,7 +202,8 @@ def setShortcuts(): cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-applications-backward \"['F14','F14','Tab']\"") cmdline("gsettings set org.gnome.desktop.wm.keybindings show-desktop \"['d','Down']\"") cmdline("gsettings set org.gnome.desktop.wm.keybindings toggle-maximized \"['F10','Up']\"") - cmdline("gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['Space','Space']\"") + cmdline("gsettings reset org.gnome.desktop.wm.keybindings panel-main-menu") + # 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']\"") if(kintotype == 2): @@ -222,8 +226,11 @@ def setShortcuts(): cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/backslash" --create --type string --set "cycle_reverse_windows_key"') # cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/h" --create --type string --set "hide_window_key"') # Don't need to undo other maps for menu - cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/commands/custom/space" --create --type string --set "xfce4-popup-whiskermenu"') - cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/commands/custom/space" --create --type string --set "xfce4-popup-whiskermenu"') + # cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/commands/custom/space" --create --type string --set "xfce4-popup-whiskermenu"') + # cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/commands/custom/space" --create --type string --set "xfce4-popup-whiskermenu"') + cmdline('xfconf-query --reset --channel xfce4-keyboard-shortcuts --property "/commands/custom/space"') + cmdline('xfconf-query --reset --channel xfce4-keyboard-shortcuts --property "/commands/custom/space"') + cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/commands/default/Escape" --create --type string --set "xfce4-popup-whiskermenu"') # Reset move to desktop shortcuts cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/Home" --reset') cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/End" --reset') @@ -246,7 +253,8 @@ def setShortcuts(): cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left ['']") cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-right ['']") 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("gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['Space','Space']\"") + cmdline("gsettings reset org.gnome.desktop.wm.keybindings panel-main-menu") cmdline("gsettings set org.gnome.mutter.keybindings toggle-tiled-right \"['Right']\"") cmdline("gsettings set org.gnome.mutter.keybindings toggle-tiled-left \"['Left']\"") # org.gnome.mutter.keybindings toggle-tiled-right ['Right'] diff --git a/xkeysnail-config/kinto.py b/xkeysnail-config/kinto.py index 1b9c61d..3ae2666 100644 --- a/xkeysnail-config/kinto.py +++ b/xkeysnail-config/kinto.py @@ -121,8 +121,8 @@ define_keymap(re.compile("jetbrains-idea", re.IGNORECASE),{ 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-Space"): K("LC-Space"), # Basic code completion + K("Super-Shift-Space"): K("LC-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 @@ -200,6 +200,9 @@ define_keymap(re.compile(browserStr, re.IGNORECASE),{ }) define_keymap(None,{ + # Launch Application Menu + # K("RC-Space"): K("Alt-F1"), # gnome/kde + # K("RC-Space"): K("LC-Esc"), # xfce4 # Basic App hotkey functions K("RC-Q"): K("Alt-F4"), K("RC-H"): K("Alt-F9"), @@ -243,7 +246,6 @@ define_keymap(None,{ }) define_keymap(lambda wm_class: wm_class.casefold() not in mscodes,{ - K("Super-Space"): K("C-Space"), # Basic code completion # Wordwise remaining - for Everything but VS Code K("M-Left"): K("C-Left"), # Left of Word K("M-Shift-Left"): K("C-Shift-Left"), # Select Left of Word @@ -268,6 +270,7 @@ define_keymap(lambda wm_class: wm_class.casefold() not in mscodes,{ # Keybindings for VS Code define_keymap(re.compile(codeStr, re.IGNORECASE),{ + K("Super-Space"): K("LC-Space"), # Basic code completion # Wordwise remaining - for VS Code # Alt-F19 hack fixes Alt menu activation K("M-Left"): [K("M-F19"),K("C-Left")], # Left of Word diff --git a/xkeysnail_service.sh b/xkeysnail_service.sh index c168791..a6a0e86 100755 --- a/xkeysnail_service.sh +++ b/xkeysnail_service.sh @@ -60,13 +60,13 @@ function uninstall { fi elif [ "$dename" == "kde" ]; then echo "Restoring DE hotkeys..." - kwinkeys = $(ls | grep -m1 "kwinrc") - kdekeys = $(ls | grep -m1 "kglobalshortcutsrc") + kwinkeys=$(ls | grep -m1 "kwinrc") + kdekeys=$(ls | grep -m1 "kglobalshortcutsrc") cp ./"$kdekeys" ~/.config/kglobalshortcutsrc cp ./"$kwinkeys" ~/.config/kwinrc elif [ "$dename" == "xfce" ]; then echo "Restoring DE hotkeys..." - xfcekeys = $(ls | grep -m1 "xfce4-keyboard") + xfcekeys=$(ls | grep -m1 "xfce4-keyboard") cp ./"$xfcekeys" ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml fi fi @@ -339,6 +339,14 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "4" || $1 == "winmac" || $1 = fi fi +if [[ $dename == "gnome" || dename == "budgie" ]]; then + perl -pi -e "s/(# )(.*)(# gnome)/\$2\$3/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1 +fi +if [[ $dename == "kde" ]]; then + echo "Applying Cmd-Space to open App Launcher for KDE..." + perl -pi -e "s/(# )(.*)(#.*kde)/\$2\$3/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1 +fi + if [[ $1 == "1" || $1 == "winmac" ]]; then if ls /sys/module | grep hid_apple >/dev/null 2>&1 ; then echo '1' | sudo tee /sys/module/hid_apple/parameters/swap_opt_cmd;echo 'options hid_apple swap_opt_cmd=1' | sudo tee /etc/modprobe.d/hid_apple.conf;sudo update-initramfs -u -k all @@ -371,6 +379,11 @@ elif [[ $1 == "4" || $1 == "ibm" ]]; 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 +if [[ $dename == "xfce" ]] && ls /etc/apt/sources.list.d/enso* 1> /dev/null 2>&1; then + echo "enso OS detected, applying Cmd-Space for Launchy..." + perl -pi -e "s/(K\(\"RC-Space)(.*)(# )(xfce4)/\$3\$1\$2\$3\$4/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1 + xfconf-query --channel xfce4-keyboard-shortcuts --property "/commands/custom/space" --create --type string --set "launchy" +fi if $rightalt ; then perl -pi -e "s/(\w.*)(Multi-language)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1