Edit browser textfarea with Emacs
Updated: 2022-02-11 - added the solution for xmonad shifting and floating.
As with all things computer related tasks, Emacs people want to do everything in Emacs. Here is a solution how to do edit textfields in Emacs.
I will be the first to say that I don't know how this all work, but it does, and that's enough for me at the moment.
First: Install browser extension
Download the browser extensions:
- For Chromium-based: https://chrome.google.com/extensions/detail/ljobjlafonikaiipfkggjbhkghgicgoh
- For Firefox-based: https://addons.mozilla.org/en-US/firefox/addon/edit-with-emacs1/
After installing it, you don't have to do anything, other than maybe check some of the options there.
Second: Setup Emacs
We need to install a package, called edit-server. If you are using MELPA, you can install it from there.
(require 'edit-server) (edit-server-start)
Test it in your browser
I tested this with my current favorite social site, misskey. And it works nicely. In the browser you just click on the purple edit button, and it opens up a new Emacs window. You type the text you want, then press C-x C-#, and it closes it, and put the text in the textfield. Pretty simple, and amazing stuff.
Xmonad and the edit-server buffer window
Since I use Emacs on a specific workspace (I send every Emacs window to that workspace by default), at first I had problems, because it didn't go to the first workspace where I use my web browser. But I found a solution for that. As usual, "xprop" command is for the rescue.
Add this to your ManageHook section, where you have your doShift and doFloat stuff:
, title =? "Edit with Emacs FRAME" --> doShift ( myWorkspaces !! 0 )
Note, that here the number at the end is 0, but it's your first workspace.
If you want to buffer window floated, add this to the same section:
, title =? "Edit with Emacs FRAME" --> doFloat