2021-06-21, updated: 2024-03-12

Tested with Nyxt 2.0.0.

Tags: feature, howto.

The power of enable-mode: an illustrative example with nosound

The power of enable-mode: an illustrative example with nosound

By Pedro Delfino

In Nyxt, every buffer has its own configuration (state). Hence, by applying modes such as nosound-mode, we can change a buffer's state- muting it.

But, what if you wanted to mute multiple buffers? Or maybe all of them?

Well, this can be done! First, you need to execute the command enable-mode (C-space enable-mode).

Then, the prompt will ask you which buffers you would like to act on. Using M-a (alt-a) you can select all of them if you want.

After pressing return with the chosen buffers being selected, you will see another list with all modes available to use. In this illustrative example, we are using nosound-mode.

After choosing nosound-mode, you'll notice that all sound coming from your selected buffers will be muted. If you go and check each previously selected buffer you will notice that nosound-mode is displayed in the status bar.

This idea can be easily generalized, and you can think of enable-mode as a leverage to do similar things with other modes. For instance, putting all (or some) buffers in dark-mode when you're feeling like batman :)

If you like math, think about this as a function composition f(g(x), xs). Enable-mode (f) receives a list of variables/buffers (xs) and a function g (another Nyxt mode) that will be applied to each variable (x).

This is pretty different from the regular user experience of clicking in and out in each tab of those popular browsers out there, right?

And this is just an appetizer, stay tuned. May the power of Nyxt be with you!

Did you enjoy this article? Register for our newsletter to receive the latest hacker news from the world of Lisp and browsers!