diff --git a/xkeysnail-config/prexk.sh b/xkeysnail-config/prexk.sh index e7f00a0..1b4053a 100755 --- a/xkeysnail-config/prexk.sh +++ b/xkeysnail-config/prexk.sh @@ -1,14 +1,12 @@ #!/bin/bash -if systemctl -q --user is-enabled keyswap.timer; then - systemctl --user stop keyswap.timer - systemctl --user disable keyswap.timer +if [ -f /home/{username}/.config/systemd/user/keyswap.timer ]; then + systemctl --user stop keyswap.timer >/dev/null 2>&1 + systemctl --user disable keyswap.timer >/dev/null 2>&1 fi -if systemctl -q --user is-active keyswap; then - systemctl --user stop keyswap -fi -if systemctl -q --user is-enabled keyswap; then - systemctl --user disable keyswap +if [ -f /home/{username}/.config/systemd/user/keyswap.service ]; then + systemctl --user stop keyswap >/dev/null 2>&1 + systemctl --user disable keyswap >/dev/null 2>&1 fi # export DISPLAY={displayid};/usr/bin/xhost +SI:localuser:root diff --git a/xkeysnail_service.sh b/xkeysnail_service.sh index 923f491..40d2394 100755 --- a/xkeysnail_service.sh +++ b/xkeysnail_service.sh @@ -3,6 +3,9 @@ # set about:config?filter=ui.key.menuAccessKeyFocuses # to false for wordwise to work in Firefox +typeset -l distro +distro=$(awk -F= '$1=="NAME" { print $2 ;}' /etc/os-release) + function uninstall { typeset -l dename dename=$(./system-config/dename.sh | cut -d " " -f1) @@ -102,7 +105,17 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1 echo "Will need to install python3-pip..." sudo ./system-config/unipkg.sh python3-pip fi - + if ! [ -x "$(command -v python3-config)" ]; then + if [ "$distro" == "ubuntu" ] || [ "$distro" == "debian" ]; then + pydev="python3-dev" + elif [ "$distro" == "fedora" ]; then + pydev="python3-devel" + fi + if [ "$distro" == "gnome" ] || [ "$distro" == "fedora" ] || [ "$distro" == "debian" ]; then + echo "Will need to install $pydev..." + sudo ./system-config/unipkg.sh "$pydev" + fi + fi # echo "Transferring files..." mkdir -p ~/.config/kinto @@ -154,7 +167,18 @@ fi if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1 == "chromebook" ]]; then mv ./xkeysnail-config/kinto.py.new ~/.config/kinto/kinto.py - sudo mv ./xkeysnail-config/xkeysnail.service.new /etc/systemd/system/xkeysnail.service + # if [ "$distro" == "fedora" ];then + sudo rm /etc/systemd/system/xkeysnail.service + sudo mv ./xkeysnail-config/xkeysnail.service.new /usr/lib/systemd/system/xkeysnail.service + sudo chown -R root:root /usr/lib/systemd/system/xkeysnail.service + sudo chmod 644 /usr/lib/systemd/system/xkeysnail.service + sudo ln -s /usr/lib/systemd/system/xkeysnail.service /etc/systemd/system/xkeysnail.service + sudo ln -s /usr/lib/systemd/system/xkeysnail.service /etc/systemd/system/graphical.target.wants/xkeysnail.service + # else + # sudo mv ./xkeysnail-config/xkeysnail.service.new /etc/systemd/system/xkeysnail.service + # sudo chown -R root:root /etc/systemd/system/xkeysnail.service + # sudo chmod 644 /etc/systemd/system/xkeysnail.service + # fi xhost +SI:localuser:root git clone --depth 1 https://github.com/rbreaves/xkeysnail.git cd xkeysnail @@ -167,8 +191,13 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1 fi git pull origin master sudo pip3 install --upgrade . - sudo systemctl enable xkeysnail.service sudo systemctl daemon-reload + sudo systemctl --state=not-found --all | grep xkeysnail + if [ "$distro" == "fedora" ];then + systemctl enable xkeysnail.service + else + sudo systemctl enable xkeysnail.service + fi sudo systemctl restart xkeysnail echo -e "Adding xhost fix...\n" @@ -219,4 +248,10 @@ else sudo rm /etc/sudoers.d/limitedadmins rm ~/.config/autostart/xkeysnail.desktop rm -rf ~/.config/kinto + sudo rm /etc/systemd/system/xkeysnail.service + sudo rm /etc/systemd/system/graphical.target.wants/xkeysnail.service + sudo rm /usr/lib/systemd/system/xkeysnail.service + sudo systemctl daemon-reload + sudo systemctl --state=not-found --all | grep xkeysnail + exit 0 fi \ No newline at end of file