2021-06-24, updated: 2021-07-22
Scroll down, scroll, scroll down, scroll, scroll… Reload, reopen, reload, reload, reopen, reload… Follow this link, follow that link, follow this link, follow another link…
Repeating things is boring. However, sometimes there seems to be no other way to use the browser except repeating things explicitly. That's depressing. Luckily, Nyxt brings
process-mode and its derivatives to offload some of the tiring burdens to!
The pattern is usually dead simple: "Do X every Y seconds and don't disturb me until I turn you off". It should be automatable, right? It is.
"Do this every Y seconds"
Suppose you're a website developer and you want to look at your website in several levels of magnification. It's quite typical when you do responsive design. There can be thousands of magnification levels, though. Repeatedly pressing even a short zooming keybinding can be dull (and harmful for your wrists!) Why not automate it? Just call
zoom-page in the appearing prompt, and enjoy the website zooming in every second.
And if you want to repeat something at an interval other than one second, call
repeat-every and set it to anything you want :)
"… and don't disturb me!"
Now, what if it fails? Will it show a prompt or some alert? No, it won't. The
process-mode is a solution to the "don't disturb me" part of our initial problem. It simply creates a background process, making sure it's not going to cause any harm to Nyxt even in case of critical failure. The only thing you'll see is a warning in the message area. It's not distracting, but quite enough to understand what happened and how to fix it.
repeat-mode is simply an extension, a child-mode, of
process-mode, and it's as reliable as the
process-mode itself. You can create many more modes doing whatever you want on some condition, based on those two. We have tried doing that, and the results are already in Nyxt:
- cruise-control-mode, for example, is scrolling a page up and down every tenth of a second. It essentially is a
- watch-mode repeats
reload-bufferevery five minutes. Again, a trivial extension of
preview-modereloads a buffer with a local file you've got opened when this file is modified. Convenient when you want to see some HTML without setting up a server :)
The possibilities are endless there! If we haven't covered your routine, you can always hack up some derivative of
process-mode and become more productive at doing the thing that matters instead of dull routine!
We'll be happy to know what you automate with