Skip to content

Instantly share code, notes, and snippets.

@nottux
Last active October 9, 2019 11:50
Show Gist options
  • Select an option

  • Save nottux/e2fbb928ccd827e8a450eac6b5fa43e2 to your computer and use it in GitHub Desktop.

Select an option

Save nottux/e2fbb928ccd827e8a450eac6b5fa43e2 to your computer and use it in GitHub Desktop.
kdeconnectd disabling auto-start but still being able to launch it manually solution
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
@nottux
Copy link
Copy Markdown
Author

nottux commented Oct 7, 2019

#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

@nottux
Copy link
Copy Markdown
Author

nottux commented Oct 8, 2019

final revision, probably

@nottux
Copy link
Copy Markdown
Author

nottux commented Oct 8, 2019

nope, i had to fix one more thing.
But now i am sure this is the last revision

@nottux
Copy link
Copy Markdown
Author

nottux commented Oct 8, 2019

finally, previous had wrong quotation mark and i made it, now this is what i call "final revision"

@nottux
Copy link
Copy Markdown
Author

nottux commented Oct 9, 2019

fixed the help message, one of the $a's were missing a backslash to be visible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment