zellij
zellij copied to clipboard
Modify watch_filesystem to take in a list of folders to watch
It would be nice to modify watch_filesystem to take in a list of folders to watch. The reasons for doing this are:
- Avoid doing unnecessary work watching files we don't care about.
- Currently, this watches the
/hostfolder and recurses through all child folders. As a result, if the user doesn't have access to a file in the/hostfolder or child folders, this results in an error. Restricting the folders watched to the minimum required should limit this happening.
To make this change, watch_filesystem could be modified from this function signature
pub fn watch_filesystem()
to
pub fn watch_filesystem(files: &HashMap<PathBuf, bool>)
If watch_filesystem is called with an empty HashMap, we can fill it with /host and true to get the previous behavior.
The downside of this is the function signature of watch_filesystem will change, which means any plugins using it will need to update this call. This doesn't seem to be used much in the zellij core. There was only one instance of it in the core, and it was for a test. multitask is another plugin I know that uses this, and I will update said plugin if this change is made.
I've got this implemented and tested on a local fork. Would be happy to submit a PR if this is accepted (or modify and submit a PR based on any discussion here).
The PR I have ready for this is located here (should have added this when I first opened the issue).
EDIT: Created PR at #3377.
Closing this as the PR has been closed. There is a better way to fix this, which is with new plugin APIs available in 0.41! :)