diff --git a/setup.py b/setup.py index 0357728..bf57496 100755 --- a/setup.py +++ b/setup.py @@ -119,7 +119,7 @@ def setShortcuts(): addhotkeys = yn_choice("\nDo you want to apply system level shortcuts?") if(addhotkeys): distro = distro.lower() - if dename == "gnome" or dename == "mate": + if dename == "gnome" or dename == "mate" or dename == "budgie": cmdline('dconf dump /org/gnome/desktop/wm/keybindings/ > keybindings_`date +"%Y.%m.%d-%s"`.conf') cmdline('dconf dump /org/gnome/mutter/keybindings/ > mutter_`date +"%Y.%m.%d-%s"`.conf') if(kintotype == 1): @@ -129,11 +129,19 @@ def setShortcuts(): cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-applications \"['F13','F13','Tab']\"") cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-applications-backward \"['F14','F14','Tab']\"") cmdline("gsettings set org.gnome.desktop.wm.keybindings minimize \"['h','F9']\"") + # + # Leaving run dialog disabled for now + # 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']\"") + # 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']\"") cmdline("gsettings set org.gnome.shell.keybindings toggle-application-view \"['LaunchB']\"") if dename != "mate": cmdline("gsettings set org.gnome.mutter overlay-key ''") - if (distro == "ubuntu" and dename == "gnome") or (distro == "linux" and dename == "mate") or (distro == "ubuntu" and dename == "mate"): + if (distro == "ubuntu" and dename == "gnome") or (distro == "ubuntu" and dename == "budgie") or (distro == "linux" and dename == "mate") or (distro == "ubuntu" and dename == "mate"): 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 ['']") @@ -232,7 +240,8 @@ def setShortcuts(): os.system('kquitapp5 kglobalaccel && sleep 2s && kglobalaccel5 &') else: print('distro: ' + distro + ' de: ' + dename) - print("A supported OS and DE was not found, you may not have full system level shortcuts installed.") + print(bcolors.CRED2 + "A supported OS and DE was not found, you may not have full system level shortcuts installed." + bcolors.ENDC) + print(bcolors.CRED2 + "You may want to find your DE or Window Manager settings and manually set Alt-Tab & other OS related shortcuts." + bcolors.ENDC) if dename == "gnome": # Apply dconf update to make updates survive reboots cmdline('dconf dump /org/gnome/desktop/wm/keybindings/ > tempkb.conf') diff --git a/system-config/dename.sh b/system-config/dename.sh index eed7b3a..4c5dfbe 100755 --- a/system-config/dename.sh +++ b/system-config/dename.sh @@ -1,5 +1,17 @@ #!/bin/bash +function detect_budgie() +{ + ps -e | grep -E '^.* budgie-wm' > /dev/null + if [ $? -ne 0 ]; + then + return 0 + fi + VERSION=`dpkg-query -l | grep budgie-core | awk '{print $3}'` + DESKTOP="budgie" + return 1 +} + function detect_gnome() { ps -e | grep -E '^.* gnome-session' > /dev/null @@ -133,17 +145,20 @@ then then if detect_kde4; then - if detect_gnome; + if detect_budgie; then - if detect_xfce; + if detect_gnome; then - if detect_cinnamon; + if detect_xfce; then - if detect_mate; + if detect_cinnamon; then - if detect_lxde; + if detect_mate; then - detect_sugar + if detect_lxde; + then + detect_sugar + fi fi fi fi diff --git a/xkeysnail_service.sh b/xkeysnail_service.sh index 460dc05..ecaac7b 100755 --- a/xkeysnail_service.sh +++ b/xkeysnail_service.sh @@ -72,6 +72,20 @@ function uninstall { fi } +function removeAppleKB { + # 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 + sudo update-initramfs -u -k all + fi + if test -f "/sys/module/applespi/parameters/swap_opt_cmd" && [ `cat /sys/module/applespi/parameters/swap_opt_cmd` == "1" ]; then + echo '0' | sudo tee -a /sys/module/applespi/parameters/swap_opt_cmd + echo 'options applespi swap_opt_cmd=0' | sudo tee -a /etc/modprobe.d/applespi.conf + sudo update-initramfs -u -k all + fi +} + function budgieUninstall { if [ -f /usr/bin/budgie-desktop ];then read -n 1 -s -r -p "Your system may log you off immediately during the restoration of budgie-daemon. Press any key to continue..." @@ -255,13 +269,22 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1 fi if [[ $1 == "1" || $1 == "winmac" ]]; then - echo '1' | sudo tee -a /sys/module/hid_apple/parameters/swap_opt_cmd;echo 'options hid_apple swap_opt_cmd=1' | sudo tee -a /etc/modprobe.d/hid_apple.conf;sudo update-initramfs -u -k all + if ls /sys/module | grep hid_apple >/dev/null 2>&1 ; then + echo '1' | sudo tee -a /sys/module/hid_apple/parameters/swap_opt_cmd;echo 'options hid_apple swap_opt_cmd=1' | sudo tee -a /etc/modprobe.d/hid_apple.conf;sudo update-initramfs -u -k all + fi + if ls /sys/module | grep applespi >/dev/null 2>&1 ; then + echo '1' | sudo tee -a /sys/module/applespi/parameters/swap_opt_cmd;echo 'options applespi swap_opt_cmd=1' | sudo tee -a /etc/modprobe.d/applespi.conf;sudo update-initramfs -u -k all + fi + if ! ls /sys/module | grep apple ; then + removeAppleKB + fi perl -pi -e "s/(# )(.*)(# WinMac)/\$2\$3/g" ./xkeysnail-config/kinto.py.new if [[ $dename == "xfce" ]]; then perl -pi -e "s/(# )(.*)(# xfce4)/\$2\$3/g" ./xkeysnail-config/kinto.py.new perl -pi -e "s/(\w.*)(# Default not-xfce4)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new fi elif [[ $1 == "2" || $1 == "mac" ]]; then + removeAppleKB perl -pi -e "s/(# )(.*)(# Mac)/\$2\$3/g" ./xkeysnail-config/kinto.py.new if [[ $dename == "xfce" ]]; then perl -pi -e "s/(# )(.*)(# xfce4)/\$2\$3/g" ./xkeysnail-config/kinto.py.new @@ -358,12 +381,7 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1 elif [[ $1 == "5" || $1 == "uninstall" || $1 == "Uninstall" ]]; then echo "Uninstalling Kinto - xkeysnail (udev)" uninstall - # 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 - sudo update-initramfs -u -k all - fi + removeAppleKB sudo systemctl stop xkeysnail sudo systemctl disable xkeysnail sudo rm /etc/sudoers.d/limitedadmins