From b72def92ce9e6bca9400f2a7a54d3bda60238838 Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Sun, 11 Oct 2020 00:49:02 -0500 Subject: [PATCH 1/5] - Reversing App Launcher hotkey from OS to kinto.py --- setup.py | 22 +++++++++++++++------- xkeysnail-config/kinto.py | 20 ++++++++++++-------- xkeysnail_service.sh | 4 ++++ 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/setup.py b/setup.py index 24f1543..6952486 100755 --- a/setup.py +++ b/setup.py @@ -150,7 +150,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']\"") @@ -163,12 +164,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 ['']") @@ -182,7 +185,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): @@ -205,8 +209,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') @@ -229,7 +236,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 4fd35e5..3a54d2f 100644 --- a/xkeysnail-config/kinto.py +++ b/xkeysnail-config/kinto.py @@ -91,8 +91,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 @@ -170,6 +170,10 @@ define_keymap(re.compile(browserStr, re.IGNORECASE),{ }) define_keymap(None,{ + # Launch Application Menu + # K("RC-Space"): K("Alt-F1"), # gnome + # K("RC-Space"): K("LC-Escape"), # xfce4 + # # K("RC-Space"): K(""), # kde # Basic App hotkey functions K("RC-Q"): K("Alt-F4"), K("RC-H"): K("Alt-F9"), @@ -213,13 +217,13 @@ define_keymap(None,{ }) define_keymap(lambda wm_class: wm_class.casefold() not in mscodes,{ - K("Super-Space"): K("C-Space"), # Basic code completion + K("Super-Space"): K("LC-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 - K("M-Right"): K("C-Right"), # Right of Word - K("M-Shift-Right"): K("C-Shift-Right"), # Select Right of Word - K("M-Shift-g"): K("C-Shift-g"), # View source control + K("M-Left"): K("C-Left"), # Left of Word + K("M-Shift-Left"): K("C-Shift-Left"), # Select Left of Word + K("M-Right"): K("C-Right"), # Right of Word + K("M-Shift-Right"): K("C-Shift-Right"), # Select Right of Word + K("M-Shift-g"): K("C-Shift-g"), # View source control # ** VS Code fix ** # Electron issue precludes normal keybinding fix. # Alt menu auto-focus/toggle gets in the way. diff --git a/xkeysnail_service.sh b/xkeysnail_service.sh index bbe8ce9..0e9e320 100755 --- a/xkeysnail_service.sh +++ b/xkeysnail_service.sh @@ -269,6 +269,10 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1 fi fi +if [[ $dename == "gnome" || dename == "budgie" ]]; then + perl -pi -e "s/(# )(.*)(# gnome)/\$2\$3/g" ./xkeysnail-config/kinto.py.new +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 From 5f9a6f7a3136952681443792cf38640be684f686 Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Sun, 11 Oct 2020 14:02:54 -0500 Subject: [PATCH 2/5] - Fixed uninstaller for xfce & kde on restoring original shortcut keys --- xkeysnail_service.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xkeysnail_service.sh b/xkeysnail_service.sh index 0e9e320..8d68688 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 From 58a2ac4f35be1237988f7af4635d370d33bb0a46 Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Sun, 11 Oct 2020 17:39:49 -0500 Subject: [PATCH 3/5] - Added Cmd-Space support for EnsoOS --- xkeysnail-config/kinto.py | 2 +- xkeysnail_service.sh | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/xkeysnail-config/kinto.py b/xkeysnail-config/kinto.py index 3a54d2f..1fb3f6d 100644 --- a/xkeysnail-config/kinto.py +++ b/xkeysnail-config/kinto.py @@ -172,7 +172,7 @@ define_keymap(re.compile(browserStr, re.IGNORECASE),{ define_keymap(None,{ # Launch Application Menu # K("RC-Space"): K("Alt-F1"), # gnome - # K("RC-Space"): K("LC-Escape"), # xfce4 + # K("RC-Space"): K("LC-Esc"), # xfce4 # # K("RC-Space"): K(""), # kde # Basic App hotkey functions K("RC-Q"): K("Alt-F4"), diff --git a/xkeysnail_service.sh b/xkeysnail_service.sh index 8d68688..f2ebca1 100755 --- a/xkeysnail_service.sh +++ b/xkeysnail_service.sh @@ -300,6 +300,11 @@ 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 +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 + 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 From 0c1b83ecb7f944b5bfa22a7648539a51b9498bb3 Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Sun, 11 Oct 2020 18:05:09 -0500 Subject: [PATCH 4/5] - Added Cmd-Space fix for KDE and silenced output --- xkeysnail-config/kinto.py | 3 +-- xkeysnail_service.sh | 8 ++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/xkeysnail-config/kinto.py b/xkeysnail-config/kinto.py index 1fb3f6d..28786ee 100644 --- a/xkeysnail-config/kinto.py +++ b/xkeysnail-config/kinto.py @@ -171,9 +171,8 @@ define_keymap(re.compile(browserStr, re.IGNORECASE),{ define_keymap(None,{ # Launch Application Menu - # K("RC-Space"): K("Alt-F1"), # gnome + # K("RC-Space"): K("Alt-F1"), # gnome/kde # K("RC-Space"): K("LC-Esc"), # xfce4 - # # K("RC-Space"): K(""), # kde # Basic App hotkey functions K("RC-Q"): K("Alt-F4"), K("RC-H"): K("Alt-F9"), diff --git a/xkeysnail_service.sh b/xkeysnail_service.sh index f2ebca1..702c90e 100755 --- a/xkeysnail_service.sh +++ b/xkeysnail_service.sh @@ -270,7 +270,11 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1 fi if [[ $dename == "gnome" || dename == "budgie" ]]; then - perl -pi -e "s/(# )(.*)(# gnome)/\$2\$3/g" ./xkeysnail-config/kinto.py.new + 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 @@ -302,7 +306,7 @@ elif [[ $1 == "3" || $1 == "chromebook" ]]; then 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 + 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 From 29a77f74ded2ad27ef2f2a76c1609ffc1c737566 Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Sun, 11 Oct 2020 18:16:02 -0500 Subject: [PATCH 5/5] - Moved basic code completion to VS Code for Linux to proper location --- xkeysnail-config/kinto.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/xkeysnail-config/kinto.py b/xkeysnail-config/kinto.py index 28786ee..190d4c0 100644 --- a/xkeysnail-config/kinto.py +++ b/xkeysnail-config/kinto.py @@ -216,13 +216,12 @@ define_keymap(None,{ }) define_keymap(lambda wm_class: wm_class.casefold() not in mscodes,{ - K("Super-Space"): K("LC-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 - K("M-Right"): K("C-Right"), # Right of Word - K("M-Shift-Right"): K("C-Shift-Right"), # Select Right of Word - K("M-Shift-g"): K("C-Shift-g"), # View source control + K("M-Left"): K("C-Left"), # Left of Word + K("M-Shift-Left"): K("C-Shift-Left"), # Select Left of Word + K("M-Right"): K("C-Right"), # Right of Word + K("M-Shift-Right"): K("C-Shift-Right"), # Select Right of Word + K("M-Shift-g"): K("C-Shift-g"), # View source control # ** VS Code fix ** # Electron issue precludes normal keybinding fix. # Alt menu auto-focus/toggle gets in the way. @@ -241,6 +240,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