From 6c8bcb8d7c4e83190e9d9f94988423257ebbae7d Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Mon, 13 Apr 2020 23:08:50 -0500 Subject: [PATCH 1/2] - Added KDE backup and restore hotkeys to uninstaller --- setup.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/setup.py b/setup.py index 4423d0b..011a03f 100755 --- a/setup.py +++ b/setup.py @@ -129,6 +129,8 @@ def setShortcuts(): elif dename == "kde": # cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "krunner.desktop" --key "_launch","Alt+Space\tAlt+F2\tSearch,Alt+Space\tAlt+F2\tSearch,KRunner"') # Remove Alt+F3 Operations Menu - Sublimetext Select-All + cmdline('cp ~/.config/kwinrc ./kwinrc_`date +"%Y.%m.%d-%s"`') + cmdline('cp ~/.config/kglobalshortcutsrc ./kde_kglobalshortcutsrc_`date +"%Y.%m.%d-%s"`') cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Switch to Previous Desktop" "Meta+Left,Meta+Left,Switch to Previous Desktop"') cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Window Operations Menu" "none,Alt+F3,Window Operations Menu"') cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Walk Through Windows" "Ctrl+Shift+F13,Alt+Tab,Walk Through Windows"') @@ -193,9 +195,18 @@ def Uninstall(): cmdline('dconf load /org/gnome/mutter/keybindings/ < ' + mutterkeys) if len(wmkeys) > 0 or len(mutterkeys) > 0: print("Gnome hotkeys have been successfully restored.") + elif dename == "kde": + print("Restoring DE hotkeys...") + kwinkeys = cmdline('ls | grep -m1 "kwinrc"') + kdekeys = cmdline('ls | grep -m1 "kglobalshortcutsrc"') + cmdline('cp ./' + kdekeys.strip() + ' ~/.config/kglobalshortcutsrc') + cmdline('cp ./' + kwinkeys.strip() + ' ~/.config/kwinrc') + if dename == "gnome" or dename == "kde": print("./uninstall.sh\n") cmdline("./uninstall.sh") print("Done.") + if dename == "kde": + print("Please log off and back on for your original hotkeys to take effect.") else: if dename == "gnome": print("Resetting DE hotkeys...\n") @@ -203,9 +214,16 @@ def Uninstall(): cmdline("gsettings reset-recursively org.gnome.desktop.wm.keybindings") print("gsettings reset-recursively org.gnome.mutter.keybindings") cmdline("gsettings reset-recursively org.gnome.mutter.keybindings") + elif dename == "kde": + print("Resetting DE hotkeys...\n") + cmdline('mv ~/.config/kwinrc ~/.config/kwinrc.kinto') + cmdline('mv ~/.config/kglobalshortcutsrc ~/.config/kglobalshortcutsrc.kinto') + if dename == "gnome" or dename == "kde": print("./uninstall.sh\n") cmdline("./uninstall.sh") print("Done.") + if dename == "kde": + print("Please log off and back on for your original DE hotkeys to take effect.") # check_x11 = cmdline("env | grep -i x11").strip() check_x11 = cmdline("(env | grep -i x11 || loginctl show-session \"$XDG_SESSION_ID\" -p Type) | awk -F= '{print $2}'").strip() From 543a10884dddc59348208658fb90dc456df15e94 Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Mon, 13 Apr 2020 23:43:52 -0500 Subject: [PATCH 2/2] - Added XFCE full uninstaller --- setup.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/setup.py b/setup.py index 011a03f..17d597f 100755 --- a/setup.py +++ b/setup.py @@ -87,6 +87,7 @@ def setShortcuts(): cmdline('perl -pi -e "s/(\w.*)(\/\/ Default cmdtab)/\/\/ \$1\$2/g" ~/.xkb/symbols/mac_gui') elif distro == "galliumos" and dename == "xfce": print("Applying GalliumOS (xfce) shortcuts...") + cmdline('cp ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml ./xfce4-keyboard-shortcuts_`date +"%Y.%m.%d-%s"`.xml') # Reset Show desktop cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/d" --reset') cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/d" --create --type string --set "show_desktop_key"') @@ -197,15 +198,19 @@ def Uninstall(): print("Gnome hotkeys have been successfully restored.") elif dename == "kde": print("Restoring DE hotkeys...") - kwinkeys = cmdline('ls | grep -m1 "kwinrc"') - kdekeys = cmdline('ls | grep -m1 "kglobalshortcutsrc"') - cmdline('cp ./' + kdekeys.strip() + ' ~/.config/kglobalshortcutsrc') - cmdline('cp ./' + kwinkeys.strip() + ' ~/.config/kwinrc') - if dename == "gnome" or dename == "kde": + kwinkeys = cmdline('ls | grep -m1 "kwinrc"').strip() + kdekeys = cmdline('ls | grep -m1 "kglobalshortcutsrc"').strip() + cmdline('cp ./' + kdekeys + ' ~/.config/kglobalshortcutsrc') + cmdline('cp ./' + kwinkeys + ' ~/.config/kwinrc') + elif dename == "xfce": + print("Restoring DE hotkeys...") + xfcekeys = cmdline('ls | grep -m1 "xfce4-keyboard"').strip() + cmdline('cp ./' + xfcekeys + ' ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml') + if dename == "gnome" or dename == "kde" or dename == "xfce": print("./uninstall.sh\n") cmdline("./uninstall.sh") print("Done.") - if dename == "kde": + if dename == "kde" or dename == "xfce": print("Please log off and back on for your original hotkeys to take effect.") else: if dename == "gnome": @@ -218,11 +223,14 @@ def Uninstall(): print("Resetting DE hotkeys...\n") cmdline('mv ~/.config/kwinrc ~/.config/kwinrc.kinto') cmdline('mv ~/.config/kglobalshortcutsrc ~/.config/kglobalshortcutsrc.kinto') - if dename == "gnome" or dename == "kde": + elif dename == "xfce": + print("Resetting DE hotkeys...\n") + cmdline('cp /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml') + if dename == "gnome" or dename == "kde" or dename == "xfce": print("./uninstall.sh\n") cmdline("./uninstall.sh") print("Done.") - if dename == "kde": + if dename == "kde" or dename == "xfce": print("Please log off and back on for your original DE hotkeys to take effect.") # check_x11 = cmdline("env | grep -i x11").strip()