emacs/var/elfeed/db/data/ff/ff757579b137ac4ab77c6c2cbf2c66e81052321c
2022-01-03 12:49:32 -06:00

130 lines
9.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<meta name="author" content="By Artyom Bologov" />
<title>auto-mode will take care of your VPN when you forget!</title>
<style type="text/css">
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
</style>
<style type="text/css">
a.sourceLine { display: inline-block; line-height: 1.25; }
a.sourceLine { pointer-events: none; color: inherit; text-decoration: inherit; }
a.sourceLine:empty { height: 1.2em; position: absolute; }
.sourceCode { overflow: visible; }
code.sourceCode { white-space: pre; position: relative; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
code.sourceCode { white-space: pre-wrap; }
a.sourceLine { text-indent: -1em; padding-left: 1em; }
}
pre.numberSource a.sourceLine
{ position: relative; }
pre.numberSource a.sourceLine:empty
{ position: absolute; }
pre.numberSource a.sourceLine::before
{ content: attr(data-line-number);
position: absolute; left: -5em; text-align: right; vertical-align: baseline;
border: none; pointer-events: all;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
a.sourceLine::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
</style>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
</head>
<body>
<header>
<h1 class="title">auto-mode will take care of your VPN when you forget!</h1>
<p class="author">By Artyom Bologov</p>
</header>
<p>Your Internet privacy routine can be simple or complicated, ritualistic or conscious, but it's always this <em>routine</em>. It helps you to leave less data for other people to exploit… Until you forget!</p>
<p>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.</p>
<p>That's where Nyxt's new <code>auto-mode</code> can help you. It remembers the modes you enable and disable for different URLs and reapplies them automatically.</p>
<h1 id="how-to-use-it">How to use it?</h1>
<p>Just add <code>auto-mode</code> to your buffer <code>default-modes</code>:</p>
<div class="sourceCode" id="cb1" data-org-language="lisp"><pre class="sourceCode commonlisp"><code class="sourceCode commonlisp"><a class="sourceLine" id="cb1-1" data-line-number="1">(define-configuration buffer</a>
<a class="sourceLine" id="cb1-2" data-line-number="2"> ((default-modes (<span class="kw">append</span> &#39;(auto-mode) %slot-default))))</a></code></pre></div>
<p>Now, if you navigate to a web page, enable <code>proxy-mode</code>, and execute <code>save-non-default-modes-for-future-visits</code>, <code>proxy-mode</code> 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, <code>auto-mode</code> will automatically deactivate modes when they are no longer relevant.</p>
<p>If you get back to the page you saved <code>proxy-mode</code> 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 <code>auto-mode</code> will do for you all the time. It will remember your modes and enable them right when you need them!</p>
<h1 id="this-command-is-hard-to-type-is-there-an-alternative">This command is hard to type! Is there an alternative?</h1>
<p>If you don't want to type in the long <code>save-non-default-...</code> command name (even though it's fuzzy-completed), there's an option for you! Just enable chatty prompting on mode toggles that <code>auto-mode</code> has as a configuration variable:</p>
<div class="sourceCode" id="cb2" data-org-language="lisp"><pre class="sourceCode commonlisp"><code class="sourceCode commonlisp"><a class="sourceLine" id="cb2-1" data-line-number="1">(define-configuration nyxt/auto-mode:auto-mode</a>
<a class="sourceLine" id="cb2-2" data-line-number="2"> ((nyxt/auto-mode:prompt-on-mode-toggle <span class="kw">t</span>)))</a></code></pre></div>
<p>It's simple and convenient. Say, you open some web page and enable <code>proxy-mode</code>. That's what you'll see:</p>
<p><img src="../static/image/article/auto-mode-permanent.png" /></p>
<p>If you answer &quot;yes&quot;, you'll be prompted for a URL to save this mode for, as in <code>save-non-default-modes-for-future-visits</code>. The rule will be created in the same way, but you won't need to call any command <code>auto-mode</code> will ask you about saving modes when you toggle them.</p>
<h1 id="how-do-i-change-the-auto-mode-rules">How do I change the auto-mode rules?</h1>
<p>There are two ways:</p>
<ul>
<li>you can browse your usual websites and use <code>auto-mode</code> to re-save the modes you enable, or</li>
<li>you can edit the file that <code>auto-mode</code> saves all the rules in.</li>
</ul>
<p>The rules file is stored in <code>~/.local/share/nyxt/auto-mode-rules.lisp</code>. (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!</p>
<p>When you open it, you'll be presented with a header explaining all the formatting of <code>auto-mode</code> rules, so you won't ever be lost! Here are the shortened rules:</p>
<ul>
<li>Every rule is delimited by a newline.</li>
<li>Rules can have test, <code>:excluded</code> modes, <code>:included</code> modes and they can be <code>:exact-p</code>.
<ul>
<li>Test is the first thing in the rule. It relies on <code>match-*</code> functions heavily, so you can look up their documentation with Nyxt's <code>describe-function</code> and use them however you want!</li>
<li><code>:included</code> modes are the ones that will always be enabled when the URL matches this rule.</li>
<li><code>:excluded</code> modes will be always disabled when this rule matches.</li>
<li><code>:exact-p</code> denotes whether you want <em>exactly this list of modes</em> 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 of <code>save-exact-modes-for-future-visits</code> for more information.</li>
</ul></li>
</ul>
<p>That's almost everything you need to know to create new rules and edit the existing ones!</p>
<h1 id="what-about-other-uses-of-auto-mode">What about other uses of <code>auto-mode</code>?</h1>
<p>Maybe you like <code>noscript-mode</code> and <code>noimage-mode</code>, because they speed up browsing, at the cost of breaking some sites. <code>auto-mode</code> is the perfect solution for this kind of problems: simply disable <code>noscript-mode</code> or <code>noimage-mode</code> when required and your preferences will be remembered!</p>
<p><code>auto-mode</code> 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 <code>auto-mode</code> will become, so don't hesitate to use it and create new modes to automate your Internet routine!</p>
<p>Thanks for reading :-)</p>
</body>
</html>