-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
FileBrowser: "Open containing folder" automatically selects file in the OS's file manager #7700
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Sticking to saying "Open containing folder" regardless of OS and opening it using the native file manager (if any) is probably the way to go IMO. It's a lot simpler that way at the cost of little. Also, I'm confused on what this has to do with highlighting files in the Additionally, I think we should be using something like |
Unless you have other concerns, the only downside is maintainability but that should've been fixed in the latest commit.
You're right, this PR is badly titled.
I really do dislike using openUrl. It was really slow for me (like ~5 second wait time) when I was on linux, But almost instant with my PR. |
@sakertooth Many applications have shims that do as the OP is suggesting. I've noticed that this trend has become an unofficial standard over the years for polished software. For example, my IDEs tend to do this same thing and when reading the source code, the techniques are often identical to the OP's. The larger the folder contents, the more useful this feature can become as the file manager will navigate directly to the file that was requested. This is a very well received feature IMO. |
I haven't benchmarked openUrl, but I wholeheartedly agree. A pragmatic solution would leverage the underlying C++ APIs, but Linux lacks a consistently shared framework to leverage something like this and Windows + macOS have the support build into the CLI of their file managers, so this really is the simplest approach for 99% of users. For those 1% of users (e.g. Haiku) we'll need to simply fallback to Qt's inferior handling. |
@sakertooth @AW1534 how much sense would it be to subclass The code also reads more portable anyway since it uses non-LMMS precompiler definitions and focuses on standard ones (e.g. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless you have other concerns, the only downside is maintainability but that should've been fixed in the latest commit.
Just took another peek at the code and it's a lot better. In particular, we aren't making so many references to platform-specific applications like Thunar, Nautilus, Dolphin, etc. The use of xdg-mime
and xdg-open
is a nice solution.
Code-wise, I think we can apply some formatting to the new changes, and I think some simplifications can be made. I can help out a bit if you will allow it.
It seems like we merely fallback to using |
This is a great idea which i'm willing to do, but as @sakertooth said, it probably doesnt need to extend from |
Co-authored-by: Tres Finocchiaro <[email protected]>
absolutely, I'll apply any suggestions you give me |
Yikes! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some style fixes.
When testing it again on Linux Mint with Nemo, using "show in file manager" on a file opens two Nemo windows - one is the directory the lmms executable is in and the other is the directory with the file in it. Using "Open in file manager" on a directory does not have this problem.
Trying now. Still opens Catfish. 🥲 |
I noticed this on the output:
|
Weird it should show |
On the XFCE DE, it displays "XFCE". This is an issue of my DWM instance not being set up properly, then! Sorry for the confusion! I'll try it now. |
Everything works great! 👍 Interestingly, LMMS samples and presets are loaded to |
After running For future documentation purposes, I've noted that this functionality depends on What about this, though: In the case someone using XFCE uninstalls Thunar and installs, say, Dolphin or Nautilus, how will that affect this functionality? |
Can you try |
Also, if |
on XFCE It uses So it should behave as expected and open whichever file manager the user has set as default |
Co-authored-by: Tres Finocchiaro <[email protected]>
Co-authored-by: Dalton Messmer <[email protected]>
Co-authored-by: Dalton Messmer <[email protected]>
Co-authored-by: Dalton Messmer <[email protected]>
Co-authored-by: Dalton Messmer <[email protected]>
Co-authored-by: Dalton Messmer <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works with Nemo now.
So the final hold-up is the peculiar behavior of @bratpeki's desktop with DWM installed.
It's hard to know how the Desktop "should" be setup, but having an environment to reproduce would certainly help. I was always under the impression that the average Desktop was usually one of the major flavors, but this PR really has me rethinking that.
^--- This is particularly worrisome to me for two reasons...
But seriously what I think is a bit more unorthodox is the DWM doesn't even have a preferred file manager, so I feel like this is likely a configuration issue. The DWM official page offers recommended file managers, but does not list a default. DWM Q&A articles discussing setting the default file manager seem to dip back into this mess: #7700 (comment) (click to expand the table to see how complicated it can get). So I think this is in good shape now unless we want to throw a few more DEs at it, but if so, I want to make sure that we don't go down another rabbit hole where the DE was misconfigured. |
@tresf so does this mean we're ready to merge? |
Yes, I think so. Let's merge it and we can easily patch in other DEs as they're reported. The code is extremely scalable for adding more. |
Introduces a new helper class FileRevealer to manage file selection across different platforms (Windows, macOS, Linux, and other *nix operating systems with
xdg
). Includes methods to open and select files or directories using the default file manager on the respective platform.User-Facing Changes:
Other Changes:
FileRevealer::canSelect
method to check if file selection is possible.FileRevealer::select
method to select files or directories using platform-specific commands.