-
Notifications
You must be signed in to change notification settings - Fork 255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CLI interface #564
Comments
Currently there's no way to do this (easily). You can technically invoke any GAction registered by a device using something like:
Clearly this is super obvious to everyone and fun to do 😉 GSConnect is a lot more amenable to use over DBus at the moment. I can try to add a proper CLI interface, but it might be awhile. I don't have much free time and there are some upcoming breaking changes in the KDE Connect protocol, as well as a number of other unfinished projects. |
To aid with scripting and process handling, run commands using a GSubprocessLauncher with the following environment variables: * GSCONNECT_DEVICE_ID: the device id * GSCONNECT_DEVICE_NAME: the device name * GSCONNECT_DEVICE_ICON: the device themed icon-name * GSCONNECT_DEVICE_DBUS: the device's object path on DBus We also watch subprocesses now and check return codes. addresses #564
EDIT: there seems to be some problem with command-line handling, I'll try and fix this when I figure out the problem. EDIT 2: okay, second zip should be good 🤞 Okay, so I guess I got bored and just did it 😕. Maybe you want to try this Zip and tell me what you think?
gsconnect@andyholmes.github.io.zip <- good If you want to run commands from the command-line you have enter the extension directory or call the full path of the script:
However, scripting from a command shared with a device is a little easier: #!/bin/bash
echo $GSCONNECT; # Path to the application (`daemon.js`)
echo $GSCONNECT_DEVICE_DBUS; # DBus object path, useful for Python, GJS or other script
echo $GSCONNECT_DEVICE_ID;
echo $GSCONNECT_DEVICE_NAME;
echo $GSCONNECT_DEVICE_ICON;
${GSCONNECT} --device ${GSCONNECT_DEVICE_ID} --file ${HOME}/test.jpg \
--file ${HOME}/test.gif Files and urls can be supplied more than once. The
Have fun and let me know how it goes :) |
Sorry for answering so late, I was sick for the last few days. It's working great, thank you very much! To anyone else reading this, note that the daemon.js file is in the service folder, and not in the root GSConnect folder. At least in the .zip attached above. Another note that should make life easier in some cases. You can use something like |
Hey @andyholmes , sorry to bother you by opening it again. I tried to use your 2nd zip and many commands work, some not. The ones that do not work with my OnePlus 5 (model A5000 with the altests stable Android/Oxigen OS 9.0.6) are Semi-related: Just as a tip for anybody that wanted to use
|
I'm marking this as closed, since the CLI interface is in v25. However, some of the options changed and might change again before v26. Hopefully I'll have a wiki page up by then documenting the whole thing. |
Is there a way to send a file from the command line using GSConnect, similar to kdeconnect-cli? If not, would it be possible to implement it? That's useful if for example you want to integrate it into some command that you trigger from the KDE Connect Android app, which sends you a file back to the phone upon command completion.
The text was updated successfully, but these errors were encountered: