Re: How to work with Nemo file manager?
Thiago Macieira <[email protected]> Mon, 03 Jul 2023 20:51:10 -0700
| Newsgroups | gmane.comp.freedesktop.dbus |
|---|---|
| Message-ID | <38379942.10thIPus4b@tjmaciei-mobl5> |
On Monday, 3 July 2023 16:31:04 PDT Ahmad Ismail wrote: > busctl --user call org.Nemo /org/Nemo org.Nemo.FileOperations CopyFile ssss > file:$HOME/Downloads/test.txt test.txt file:$HOME/Downloads test2.txt > busctl --user call org.Nemo /org/Nemo org.Nemo.FileOperations CopyURIs ass > 2 file:$HOME/Downloads/test.txt file:$HOME/Downloads/test2.txt file:$HOME > > busctl --user tree org.Nemo --list | grep -P "window/\d+" > busctl --user call org.Nemo /org/Nemo/window/1 org.freedesktop.DBus.Peer > GetMachineId > > These solutions work for me. However, I am all invested in dbus. So, please > let me know if anything can be improved here. Two things with the above: First, why Nemo? What if the user doesn't use Nemo? I have no idea what it is, aside from a character who got lost in a kids movie and his dad had to look find him. You should reconsider your usage if you can't guarantee that the user will have this software installed. You're just copying files, you don't need a file manager for that. Second, you're not properly encoding URLs. Just prepending "file:" isn't correct if the file name contains any URI special characters (for paths, that's a question mark or a hash, but the application might balk if you fail to encode some other characters too, like space). If you want to do anything that isn't just a toy, you must encode the URIs correctly, which probably means using a proper scripting language, not shell scripts. If you do the latter, then you should also abandon using busctl or dbus-send and just use that language's D-Bus binding. Please note you haven't explained what you're trying to do yet. I am assuming you're just trying to learn stuff (though it isn't clear if it is D-Bus, Nemo, a combination of them or something else), not actually program a long-term solution. > Is it? Is there anything more we need to know or look at *to find the > correct command line syntax*? Yes. You should read the documentation for the API you're calling. D-Feet and other bus-querying mechanisms only tell you that certain API exist, not what they do, what their constraint and failure conditions are, etc. That documentation may only exist in the form of the source code for the application in question, so be prepared to read it. And if no such documentation exists, you should reconsider using that API you've found... maybe it's not meant for you to use in the first place.