Skip to content
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

file operations export to toml file #520

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pantosaur
Copy link
Contributor

I made an experiment to be able to cut/copy/symlink files across multiple instances of joshuto. I find this useful when, let's say, i am working on multiple projects at the same time, and using multiple file browsers. My file browser is generally not my workflow starting point, but rather a tool I use inside my workflow, so I'm rarely gonna have a joshuto tab for everything I am doing, hence, my need for this.

I used serde to serialize the file operation to a toml file in .config/joshuto/state_context.toml, and deserialize the file content when pasting the result. So far this seems to be working. I tried to follow the code structure as much as possible, but it could be improved. And there might be some considerations about the general approach. But in any case, this is a feature I want, so I am leaving this here as a general idea for consideration.

Thank you!

@DLFW
Copy link
Contributor

DLFW commented Apr 6, 2024

Hi! This sounds really useful! I have the same problem: I use many “Joshutos” all over and sometimes it would be very helpful to move or copy files over several instances. As of now, I always copy the path and then either open another tab in another Joshuto or quickly jump into the shell. However, just have copy/paste/link working cross-instances would be amazing.

I was thinking, all these standard file manager (pcmanfm, dolphin, thunar, u name it...) can use the clipboard to copy or move (and maybe even symlink?) files. How do they do that? Maybe we could use xclip / wl-clipboard to do this? Would have the benefit of even being interop with other software.

I didn't find a proper spec how such file operations are done with the clipboard. Does somebody know more about this?

@kamiyaa kamiyaa added the enhancement New feature or request label Apr 7, 2024
@pantosaur
Copy link
Contributor Author

pantosaur commented Apr 7, 2024

@DLFW I used to do this, yank path, and call a shell command from joshuto that pastes from the clipboard, but it is not very clean to use the clipboard for this, and more importantly, it is not a proper way to move around multiple files with a decent format to represent and store all the information about the transaction, i.e. copy, cut, symlink, list of files, etc. So, since the crate is already using serde+toml, it is fairly easy to do it in rust directly rather than external scripts, although we could also compile an external rust program just to do this.
The more involved and probably better solution rather than using a file to store the command, would be to make a custom process to handle this for all open file browsers, or use dbus, which I think is made pretty much for that purpose, and might already have a standard for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants