Closed AKXX closed 5 years ago
Hmm. I was hoping xdg-open would handle this automatically, but on my machine using i3...it doesn't. I'll keep looking at it.
Ok, I figured out my problem so now I can click mailto: links on a webpage and have it open in mutt. For reference:
~/.local/share/applications/mutt.desktop
[Desktop Entry]
Type=Application
Name=mutt
Comment=Simple text based Mail User Agent
Exec=i3-sensible-terminal -e mutt %f
Icon=utilities-terminal
Terminal=false
MimeType=x-scheme-handler/mailto;
Categories=Email;Office;Network;
~/.local/share/applications/mimeapps.list
[Default Applications]
x-scheme-handler/mailto=mutt.desktop;
Once that's working, now you can set urlscan to use xdg-open to open all links instead of the python webbrowser module (which is the default). Change muttrc line to:
macro index,pager b "<pipe-message> urlscan -d -r 'xdg-open \"{}\"'<Enter>" 'call urlscan to extract URLs out of a message'
Notice the escaped quotes on {}...those are important!! And took a long time to figure out...
I'll consider adding xdg-open as a built-in alternative to the webbrowser module. For now, hopefully this setup will work for you.
I was busy in compiling new distro, just came to write a port for urlscan so checked issues, I hope it will work now, I'll update soon.
it still opening browser from mutt mailto links.
I didn't change anything with urlscan. You have to setup your mutt.desktop and muttrc as I described above.
Edit: you may also have to edit the mutt.desktop Exec line if you aren't using i3.
yeah I did that. maybe I don't have xdg-open ;-)
yeah I did that too.
tried this way too,
macro index,pager U "
If you can get xdg-open 'mailto:joe@joe.com'
in a terminal to open mutt then you are on the right track. Otherwise you have to get that working before it will work from urlscan.
xdg-open 'mailto:joe@joe.com' it also opened a browser window
before urlscan, any mailto link in browsers weren't working, now if I click on them, they are opened in new browser instances. which means the urlscan is opening them ;-)
Then you have to figure out how to get that working first. Took me awhile too. There's a few Stack Overflow questions, but I'm pretty sure I covered everything they mentioned in my answer above.
Yeah I appreciate your work. Its far better than urlview
What's the output of XDG_UTILS_DEBUG_LEVEL=2 xdg-mime query default x-scheme-handler/mailto
?
Checking /home/ak/.local/share//applications/defaults.list Checking /usr/local/share//applications/defaults.list Checking /usr/share//applications/defaults.list
output of default query
let me set it this way
Looks like it's checking defaults.list instead of mimeapps.list like on my system.
This is what you should see (or something similar):
Checking /home/firecat53/.config/mimeapps.list
Checking /home/firecat53/.local/share/applications/mimeapps.list
mutt.desktop
I have set it, now it shows mutt.desktop , yeah same as yours output
Now it should hopefully open a terminal window with mutt when you click a mailto link in your browser
lemme put it in .config too
opened in a new instance of chrome ;-) both from browser and mutt
lemme reboot maybe there is some issue
not working even after a reboot. I think I have to modify xdg-open script as once I was able to achieve it with urlview
I'm working on the xdg
branch right now so you'll be able to cycle through using xdg-open, python webbrowser or a custom --run or --pipe command without having to exit urlscan.
You'll still have to figure out getting xdg-open to work in your own environment though! Any luck with that?
Latest commit 728569adb allows cycling through webbrowser, xdg-open, or a --run command. This should allow you to open mailto links using one of those options that works for you. Let me know if you get it working!
Haven't heard anything from you for awhile. I'll close this for now. Feel free to re-open if you still assistance.
https://abdullah.today/blog/how-to-use-mailto-links-in-DWM.html is the solution you want.
I can't see an option to set mailto links opened in mutt or some other mail agents.