-
Notifications
You must be signed in to change notification settings - Fork 45
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
Issue with Ubuntu 22.04, does not open web browser, instead opens mime-type file associated application. #55
Comments
I was not satisfied with having no potential solution, so I found a couple links that offer a potential solution, but I will not say it is the solution outright. But at least it's something to chew on: to repeat what was already said:
So, I had a thought to fix the problem. Convert the file path into a URL, I found this on Stack Overflow: |
Thanks for the detailed notes, @Nbjohnston86. Saved me quite some time. I was earlier going to respond by saying that This makes it a little tricky to solve, because ideally I'd like to avoid having to parse xdg config. In case you weren't aware, you can always solve this by overriding the If that works for you, then I'd be inclined to just leave this issue open for up to 3 months to see if this is a common enough issue to justify the additional complexity of parsing xdg settings. |
Also, can you please point me to the application which you were using (if it's open source, and you're ok sharing)? This is just to make sure that if indeed I end up solving for it specifically, then I notify the maintainer of it. |
Sure, I'll point you to the issue I originally found this in, even. https://github.com/0xhiro/thebook/issues/2 I'm aware that I can fix this by setting that, it's just such an odd behavior I feel it's worth addressing anyways. I had to spend a couple of hours searching online through configuration guides and source code just to find out the specific intricacies of why my browser wouldn't open this file, when it seemed to open everywhere else. And I was only able to figure this out because I'm a slightly more advanced linux user. I didn't technically choose this outright, as my original problem was it was opening with visual studio code, not gedit, and I think at one point it just did that without asking(I could be mistaken about that). A year ago, I definitely couldn't figure this out, that's for sure, haha. It would just seem broken on linux to the average user, but that's just my opinion. It's hard to say how often this case could come up, so you could be right. If nothing else, it should at least be documented somewhere so people don't have to search as long as I did. |
Well done @Nbjohnston86! |
Thanks @Nbjohnston86, keep going with your linux pursuit! I looked up more on this, and looks like Can you give this a shot? |
@Nbjohnston86 PR #58 fixes this in a proper way, so your default browser gets opened even if you have local file associations. This is particularly useful for projects like @0xhiro's, where local file is being opened instead of a URL, so thanks for bringing this up. I have a few more things to include before this gets released, but feel free to give it a test by using the main branch
|
Thanks for the fix. Will test it and give feedback ASAP. |
@0xhiro, I tested this with 0xhiro/thebook and it's working. Just logging my test results here, as I'll be making a release soon. This issue also led me to expand the Consistent Behaviour promised by this crate, so double thanks to @Nbjohnston86 and you. |
Thanks for this useful crate, looking forward to the next release. I'm sorry i couldn't contribute by testing, the holiday season got me occupied. I will ensure to fix the directory bug and publish a new version as soon as you make the bug fixes into a release. |
No worries at all. Happy holidays 🎉 🎄 |
Thanks! |
Any idea when that new release is coming? |
The release should be out by this weekend, hopefully sooner. I'll ping here when that happens |
Thanks! |
Awesome! Great work! and happy new year! |
Thanks, and wish you a happy new year as well |
I found this out by accident, when troubleshooting a problem with someone else's application, but hey! I know what the issue is (Although, I do not know how to fix it, I can at least identify it!)
How to reproduce this issue:
gedit ~/.config/mimeapps.list
(you can use any text editor, really, I just chose gedit)Once open, under
[Default Applications]
replace the line containingtext/html=
withtext/html=gedit.desktop
If the line does not exist, add
text/html=gedit.desktop
instead. (Again, any text editor with a.desktop
file will do.Now that that's set up, use the function that calls:
open_browser_internal
, and is a standard file system path to an html document.Example:
/home/username/index.html
This will instead open up the file in the text editor you chose.
The problem is this: https://manpages.ubuntu.com/manpages/focal/man1/xdg-open.1.html
This means that if a file path is provided rather than a URL, and is a valid mime type, it will open the related non-browser application instead. This is definitely an edge case, but hey, it didn't open the default browser!
The text was updated successfully, but these errors were encountered: