2020-09-07, updated: 2024-03-12
Tested with Nyxt 2 Pre-release 2.
auto-mode will take care of your VPN when you forget!
Your Internet privacy routine can be simple or complicated, ritualistic or conscious, but it's always this – routine. It helps you to leave less data for other people to exploit… Until you forget!
While browsers and extensions offer some options- like blocklisting the websites you want your VPN to be turned on, or even remembering settings domain-wise, it's usually not scalable and transferable between different extensions. It's hard to learn ten different mechanisms and use them everyday to preserve your privacy.
That's where Nyxt's new auto-mode
can help you. It remembers the modes you enable and disable for different URLs and reapplies them automatically.
How to use it?
Just add auto-mode
to your buffer default-modes
:
Now, if you navigate to a web page, enable proxy-mode
, and execute save-non-default-modes-for-future-visits
, proxy-mode
will be automatically reapplied when you vist again. Your rules can be activated on the main domain of a website, any of its subdomains, or even on specific pages, depending on what you input. In addition to reapplying modes, auto-mode
will automatically deactivate modes when they are no longer relevant.
If you get back to the page you saved proxy-mode
for, it will be enabled and you'll access the page with a new IP, without any action on your part. Easy, huh? That's what auto-mode
will do for you all the time. It will remember your modes and enable them right when you need them!
This command is hard to type! Is there an alternative?
If you don't want to type in the long save-non-default-...
command name (even though it's fuzzy-completed), there's an option for you! Just enable chatty prompting on mode toggles that auto-mode
has as a configuration variable:
It's simple and convenient. Say, you open some web page and enable proxy-mode
. That's what you'll see:
If you answer "yes", you'll be prompted for a URL to save this mode for, as in save-non-default-modes-for-future-visits
. The rule will be created in the same way, but you won't need to call any command – auto-mode
will ask you about saving modes when you toggle them.
How do I change the auto-mode rules?
There are two ways:
- you can browse your usual websites and use
auto-mode
to re-save the modes you enable, or - you can edit the file that
auto-mode
saves all the rules in.
The rules file is stored in ~/.local/share/nyxt/auto-mode-rules.lisp
. (You can redefine it to use a different path and even to use GPG-encryption!) This file is made exactly in a way that enables you to easily edit it!
When you open it, you'll be presented with a header explaining all the formatting of auto-mode
rules, so you won't ever be lost! Here are the shortened rules:
- Every rule is delimited by a newline.
- Rules can have test,
:excluded
modes,:included
modes and they can be:exact-p
.- Test is the first thing in the rule. It relies on
match-*
functions heavily, so you can look up their documentation with Nyxt'sdescribe-function
and use them however you want! :included
modes are the ones that will always be enabled when the URL matches this rule.:excluded
modes will be always disabled when this rule matches.:exact-p
denotes whether you want exactly this list of modes to be enabled for this rule or you just want to enable/disable the listed modes in addition to the present ones. See the documentation ofsave-exact-modes-for-future-visits
for more information.
- Test is the first thing in the rule. It relies on
That's almost everything you need to know to create new rules and edit the existing ones!
What about other uses of auto-mode
?
Maybe you like noscript-mode
and noimage-mode
, because they speed up browsing, at the cost of breaking some sites. auto-mode
is the perfect solution for this kind of problems: simply disable noscript-mode
or noimage-mode
when required and your preferences will be remembered!
auto-mode
is about toggling modes, so anything that can be represented as mode can be automated by it! The more modes there are, the more powerful auto-mode
will become, so don't hesitate to use it and create new modes to automate your Internet routine!
Thanks for reading :-)
Did you enjoy this article? Register for our newsletter to receive the latest hacker news from the world of Lisp and browsers!
- Maximum one email per month
- Unsubscribe at any time