I’ve played with the Tridactyl extension for a few years, but Firefox
limitations in part have kept me from using it more extensively. But I
stumbled across a relatively easy way of “unreserving” reserved
Firefox keys (like <C-p>
, <C-f>
etc.) via an offhand comment at
Lobste.rs, which points to a 2 line bit of code to remove reserved
keybindings. I repeat it here:
#!/usr/bin/env sh
sudo perl -i -pne 's/reserved="true"/ /g' /usr/lib/firefox/browser/omni.ja
find ~/.cache/mozilla/firefox -type d -name startupCache | xargs rm -rf
This now frees up any key as a potential target for Tridactyl bindings. It’s still not perfect: the ability to remap keys in StumpWM is still easier, but it gives me a better possibility for customisation on machines not running StumpWM.
One thing I’ve added to all machines is a better way of dealing with
Tridactyl’s function to edit browser text areas in an external browser
(bound to C-i
by default). In Tridactyl I run in the command area
:set editorcmd emacsclient -c %f
. This opens up an Emacs frame
connected to the default daemon. However, I wanted a quick way of
“entering”/“saving” the text and closing the frame. An ad-hoc major
mode seemed like an easy way, allowing for save and close-frame with
C-c C-c
:
;; tridactyl mode
(define-derived-mode tridactyl-mode text-mode "tridactyl"
"A major mode to edit tridactyl-spawned 'editor' text.")
(define-key tridactyl-mode-map (kbd "C-c C-c")
'(lambda ()
"save and exit quickly"
(interactive)
(save-buffer)
(clipboard-kill-ring-save (point-min) (point-max)) ; just in case
(sleep-for 1)
(delete-frame)))
(provide 'tridactyl-mode)
However, the editorcmd interface seems to have problems running -e '(func)'
type calls (maybe there’s a way to get it to work, but it
wasn’t obvious to me), so I additionally added an auto-mode-alist
regexp to auto-detect tridactyl temporary files:
(add-to-list 'auto-mode-alist '("/tmp/tmp.*\\.txt$" . tridactyl-mode))
And this seems to work well. I still can’t quite get in-Firefox text editing to have Emacs-style bindings, but for anything non-trivial, I can just edit it in Emacs directly in this way.
(Addendum: though I note that at least a number of text boxes seem to require some additional input afterwards to “fix” the editorcmd text; otherwise they revert back to their previous state. A bit irritating. I’ve added a save-to-clipboard bit in the function above as a safety precaution against lost text.)
]]>However, John Mercouris has been developing Next Browser (originally styled nEXT Browser), a browser with a Common Lisp front-end, allowing for customisability and extensibility along Conkeror/Emacs lines:
The back-ends are – if I understand correctly – planned to be Blink for the QT port and WebkitGTK+ for the GTK port, with the Mac port of Webkit for the Mac version. But the front-end, the user-facing side, is Common Lisp.
John is currently running an Indiegogo campaign to properly port it to Linux and other non-Mac Unix variants (it apparently runs well already on the Mac, John’s main platform it seems [there’s no accounting for taste ;) ]). The raised money would be used in part to pay a professional C/C++ developer for their time.
Ambrevar is currently working on packaging Next Browser for Guix, which is exciting and promises to add to the amount of Lisp front-end software we’ll be able to use. Currently I’m running Emacs (elisp) for the majority of my non-browser productivity (writing papers & creating class slides using AUCTeX; reading composing email with mu4e; note-taking and scheduling with Org mode; &c. &c.) and, at least on one machine, StumpWM (Common Lisp window manager) for my ‘desktop environment’; and GNU GuixSD with a Guile-based package manager, Guile-based cron (mcron), and Guile-based init/daemon-manager (Shepherd). A functional, configurable, Lisp-based browser would be a most welcome addition. As excellent as Firefox is, especially its backend, I do really miss the halcyon days of Conkeror, and Next Browser could represent a return to those heady days of configurable browsing Emacs-style.
So, if this sort of thing appeals to you (i.e. if you like Lisp, Emacs, and/or highly-extendable browsers), you might want to support the Linux/Unix-port of Next Browser: https://www.indiegogo.com/projects/next-browser-nix-support
There’s only about a week left in the campaign.
]]>