Emacs has had browse-url for ages — it’s very simple; it
just calls browse-url-browser-function, and that’s enough for most things.
But then somebody implemented a browser in Emacs that was halfway possible to use for a number of non-complicated web pages, namely eww, and that complicated things. Now some people wanted to stay in Emacs while reading a number of web pages, but had to escape to a real browser for pages that weren’t trivial or had lots of user interaction. So somebody implemented browse-url-secondary-browser-function, and the idea was that if you wanted to stay in Emacs, you just hit RET on a link, and if you wanted to use a real browser, you used C-u RET on the link.
(Or the other way around, depending on your preferences.)
And that works well.
Then Wayland happened.
Wayland doesn’t allow windows to raise themselves because of security. I mean, if a window can just raise itself over another window, that’d be anarchy! Rioting in the streets! It’s so unsafe!
So of course all the compositors have started adding support for this… because… er… uhm… And… er… all applications have to add support for this, explicitly. So, er… Thanks, Wayland.
But back to my thing — an application under Wayland can still open a new window and put it on top. It just can’t raise existing windows. Because that would be unsafe, but opening and raising a new window is obviously safe.
Wayland.
While I’m typing away here, allow me to present my new one act play that has nothing to do with the thing I’m talking about here, but anyway:
Wayland: Taking screenshots is obviously so unsafe! Any application can just copy the screen! Just call magick import. That’s insane! That’s gone!
Users: But we want to be able to take screenshots.
Gnome: OK, we added gnome-screenshot.
KDE: OK, we added Spectacle.
wlroots: OK, we added wayshot.
Wayland: See! Now it’s safe!
End scene. Curtains. Sporadic applause.
But I digress! We were talking about browsers and Emacs.
So I fixed this by just having my firefox being this:
larsi@up:~$ cat /usr/bin/firefox #!/bin/sh exec /usr/local/bin/firefox/firefox --new-window "$@"
But that’s not very satisfactory for some of my workflows. For instance, when shopping music from Norman:
I go through the weekly email and hit C-u RET on all the albums I think may be interesting, and then listen a bit before deciding. But this means that I’ll typically have twenty Firefox windows open, and that’s just kinda messy. In the olden days, I’d just have twenty Firefox tabs, and that was fine.
So I’ve lately realised that I have three ways I want to browse the web:
- In Emacs
- In Firefox, immediately
- In Firefox, later
In the first Firefox case, I want to pop up a window. In the second, I just want to add a tab to the one Firefox window I always have open, and then I’ll read it/do some shopping later.
The results are on Microsoft Github. This is just a tiny micro library, but it seems to do what I want it to do. Your mileage will vary a lot depending on your workflow.
But this is actually better now than my old workflow under X: There I would hit C-u RET on a Norman Records link, and Firefox would pop up with a new tab. And then I’d have to lower the Firefox window to go back to Emacs. Now I can just C-u C-u RET and continue on immediately.
So there you see! Wayland is better after all!