Hi I'm heavily using the feature C-c C-o
in org mode to open the links in org mode in my firefox. I have org lists with these links and I want to open a bunch of them and then go through this websites in the end. Currently after opening the links the focus switches to the browser tab and I need to go back to emacs myself. Is there a way to tell emacs not to switch focus to the opened browser tab?
1 Answer
I think this is determined by firefox itself and can't be easily fixed by Emacs.
Firefox-side solution
In about:config
, toggle browser.tabs.loadDivertedInBackground
from false to true.
See also this stackoverflow question
Outline of possible (ugly) alternatives
Tweak your window-manager to make Emacs reclaim focus.
In Emacs, define two new functions (and corresponding keybindings) that will i) add URLs to a queue, and ii) open all the queued URLs in Firefox. This would have the disadvantage of making the process more complicated, so I don't really recommend it.
Write a Firefox webextension that will communicate with Emacs via "Native messaging" and open the tabs in the background. (I think, but I'm not 100 % sure, that it would work — experimenting with the browser console, placing it in a different workspace to Firefox and executing
browser.tabs.create({})
does not bring focus back to Firefox.)
-
1I tried the firefox-side solution, the behaviour is not exactly what I want. The switch leads to the tab not coming to the foreground but firefox itself still does. So I still have to switch focus. The other solutions appear a little more complex to me as I'm not experienced in the proposed fields, but it sounds promising. I will put it my todo list ;)– daedaMar 5, 2018 at 19:47
-
Regarding the Firefox solution, that's weird — I had tested it (and just tested it again) and, in my case (Linux with XMonad), neither Firefox nor the tab came to the foreground, but it probably depends precisely on the details of the system.– aplaiceMar 5, 2018 at 23:23
-
1