I have made a script so GSConnect and kdecoonect can be kept together

i have made a script so GSConnect and kdeconnect can be used together: https://gist.github.com/tuxutku/e2fbb928ccd827e8a450eac6b5fa43e2
This script have three options;
run manually starts kdeconnectd and kdeconnect-indicator
disable disables kdeconnect auto-start
enable enables kdeconnect auto-start
entering nothing will display help.

if [ "$1" = run ]
then echo "press Ctrl+C to stop"
a=$(mktemp -d)
sudo -E su -c "cp /usr/lib/x86_64-linux-gnu/libexec/kdeconnectd $a;chmod -R 777 $a;su $USER -c $a/kdeconnectd&su $USER -c kdeconnect-indicator"
rm -rfv $a
fi
if [ "$1" = disable ]
then sudo chmod -x /usr/lib/x86_64-linux-gnu/libexec/kdeconnectd
fi
if [ "$1" = enable ]
then sudo chmod +x /usr/lib/x86_64-linux-gnu/libexec/kdeconnectd
fi
if [ "$1" != enable -a "$1" != disable -a "$1" != run ]
then echo -e "I have disabled kdeconnectd, see 'https://unix.stackexchange.com/questions/384306/why-does-kdeconnect-listen-on-port-1716-tcp-all-the-time-how-to-close-the-port/509476#509476' to how i did it"\\nto re-enable it, run:\\nsudo chmod +x /usr/lib/x86_64-linux-gnu/libexec/kdeconnectd\\n"OR run this script with 'enable'"\\n"Ex: 'kdeconnectd enable'"\\nAnd reboot the computer\\n\\n"to disable run this script with 'disable'"\\n"Ex: 'kdeconnectd disable'"\\n\\nyou can also run:\\n"'a=\$(mktemp -d);sudo -E su -c \"cp /usr/lib/x86_64-linux-gnu/libexec/kdeconnectd $a;chmod -R 777 $a;su \$USER -c $a/kdeconnectd&su \$USER -c kdeconnect-indicator\";rm -rfv \$a'"\\n"if you run this with 'run'"\\n"Ex: 'kdeconnectd run'"\\nThis will run the suggested command
fi
#using "-E" instead of "--preserve-env=USER seems to work better, kdeconnect-cli works this way. if "--preserve-env" used istead; it launches indicator but doesn't allow kdeconnect-cli to work. With "-E"; indicator won't show up until you pair with a device but it allows kdeconnect-cli to work
1 Like

Why was this necessary? GSConnect requires KDE Connect to function so I assumed that GSConnect would have some method of starting and whatnot the KDE Connect stuff. Is that not the case?

i have two DE and no GSConnect actually requires KDE connect to be removed to function, only fix afaik is to remove executable flag from kdeconnectd and i have implemented it to script