Interact with this post using Mastodon or
Niri: hello Wayland
Published on
Time for a new hidden gem, though it has recently received quite some attention. Niri
is a Wayland compositor and has been my door to this protocol. Niri is a compositor like Sway (i3 for Wayland) or Hyprland (for those who want shiny transitions and code their own animations) for example.
╭── What is niri
If you’re the kind of person who thinks tiling window managers are the best thing since grep, and you’re looking to let the legacy of X11 behind, niri
may be a good candidate.
Be aware that it’s written in Rust (naturally) in case you have strong opinions against this language. Unlike many other compositors, niri
is not a fork or clone of a X11 windows manager. It comes with some great features and brings some innovations.
╭── Niri
is capable of
Dynamic and ergonomic tiling
Most tiling windows managers or compositors force you into managing splits and layouts manually. niri
arranges windows in columns on an infinite strip going to the right. This is why it’s called a scrollable-tiling compositor (like PaperWM
or karousel
for example). It is to be noticed that opening a new window never causes existing windows to resize.
Workspaces are dynamic and arranged vertically with no limit to their number. Coupled to the scrollable navigation, that means you could have an infinite number of windows to scroll horizontally distributed through an infinite number workspaces. Workspaces are automatically numbered but can also be named. Every monitor has an independent set of workspaces, and there’s always one empty workspace present all the way down or up (your choice).
A great feature is that the workspace arrangement is preserved across disconnecting and connecting monitors. In other words, when a monitor disconnects, its workspaces will move to another monitor, but upon reconnection they will move back to the original monitor.Niri
also offers an overview feature that zooms out workspaces and windows, and from where you can move windows within but also across workspaces.
Group windows into tabs
Columns can also be transformed into tabbed columns, meaning that instead of stacking windows vertically, you can display them as tabs within the same column. This is ideal for maximizing vertical screen space and can be viewed as another infinite scrolling feature applied to a column. You can easily switch windows in and out of tab mode as needed, allowing hybrid layouts that mix both stacked and tabbed arrangements.
Automatic focus
You can of course use keybindings to switch focus between windows or workspaces, but you can also configure niri
to focus using follow the mouse feature. Another focus style you can define as well is to focus chosen app when they open.
Monitor and window screencasting
You can block out any windows from screencasts through xdg-desktop-portal-gnome
, or from screenshots.
Wayland-native from the ground up
Unlike older compositors that wrap themselves around XWayland
, niri
is fully Wayland-native. It works beautifully with HiDPI displays, and doesn’t choke on fractional scaling or touchpads.
Additionally, while niri
has no built-in support for XWayland
, it uses xwayland-satellite
should you need to run any X app.
And more…
That’s just a quick presentation of some niri
’s features. There’s way more to be discovered on the github page
.
╭── Quick summary of my journey
I’ve been using tiling window managers under X11 for more than 15 years (awesomewm
, i3
, dwm
, bspwm
). I have been looking at Wayland for years but finding a compositor that offers an experience close to bspwm
was the limiting factor. While I’ve tried hard to use river
, niri
ends up being the only good candidate for my needs and workflow. I even dare to say that niri
barely beats bspwm
.
After having used bspwm
for so long, I came to become dependent on IPC to expand the level of customization of my windows manager. Niri
comes with its own IPC: niri-msg
which allows for fine tuning in windows management through shell scripts. I’ve created my own scratchpads for example.
A significant bonus that comes with Wayland is the battery saving. On office use, my battery life has been extended by at least 40% compared to X11, confirming my previous statement . That makes a huge difference if, like me, you like to use your battery between 20 and 80% only.
╭── Does perfection exist?
No! Oh, sorry that was a rhetorical question? Of course, nothing is perfect and niri
may not be for you. And that’s not a problem thanks to all the existing alternatives.
Here are the minor hiccups I had to come over before making niri
my daily driver for 2 months now:
I don’t use any display manager and login directly from TTY. Using
niri-session
as documented on the official webpage does not work and I have to useniri-session -l
. This is a known issue . I has the exact same “problem” with a windows manager in X11 back in the days.That’s me being stupid, but to allow the use of fingerprint to unlcok swaylock I had to add
auth sufficient pam_fprintd.so
in /etc/pam.d/swaylockI’d like to use
swhkd
to manage my keybindings. In the meantime, I’ll useniri
config but this is less elegant and doesn’t allow for mouse bindings. I’d be happy to hear from you if you had it worked.
More food for thoughts? Check other posts about: #System
Thanks for your read. Hope it's been useful to you.
✄ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈