未来是Niri
The Future Is Niri

原始链接: https://ersei.net/en/blog/niri

多年来一直忠实使用 Sway,但一个令人沮丧的拖拽文本选择bug促使作者尝试了 Niri,一款可滚动的平铺窗口管理器。起初这是一个冒险的尝试,但结果却出奇地好。Niri 允许打开窗口而不影响其他窗口的布局,支持每个窗口的屏幕共享,并且延长了电池续航时间。而且由于它是用 Rust 编写的,所以更容易进行修改。 作者认为,像 Sway 这样的传统平铺窗口管理器会让人习惯于优化窗口布局以最大限度地减少重新排列,这造成了不必要的认知负担和空间浪费。Niri 通过允许无限水平滚动解决了这个问题,有效地消除了传统平铺窗口管理器主要面临的空间限制。作者现在可以在几个工作区内同时管理多个项目、沟通工具和学业,这与之前使用 Sway 时杂乱无章的工作区形成了鲜明对比。使用 Niri 后,作者发现至少对他来说,空间问题得到了解决,传统平铺窗口管理器可能不再是高级用户的最佳工作流程。如果你目前正在使用 Sway,作者强烈建议你今天就试试 Niri。

Hacker News 上的这篇讨论帖关注 Niri,一款可滚动的平铺窗口管理器,以及其作为 i3 和 Sway 等传统平铺 WM 的现代替代品的潜力。用户分享了他们的经验和工作流程,强调了 Niri 的直观设计、鼠标集成以及对编号/命名工作区的支持。一些人强调了它的效率,而另一些人则指出需要外部工具来处理通知和应用程序启动。文章将 Niri 与其他平铺解决方案(如 PaperWM(一个 Gnome 扩展)和 Hyprland)进行了比较。用户讨论了 Niri 的方法在聚合应用程序和管理大量打开窗口方面的优势。一些人提到了 X11 窗口兼容性方面的问题,以及对诸如二维概览或改进的窗口映射等功能的需求。虽然一些用户更喜欢窗口最大化带来的更简单的工作流程,但许多用户都对 Niri 在功能性和可用性之间的平衡表示热情。

原文

The worst "street-cred" I have is that I've been using tiling window managers for thirty-five percent of my life: five years with Sway and two with i3. As the realization of those numbers (and my age) dawns upon me, an irresistible urge wells up in my chest, threatening to overwhelm me. I try to tamp it down, but the urge is too strong—I must Give My Opinion.

This may be worse than finding grey hairs.

I switched to Wayland before it was cool, so a lot of stuff was broken, and I got used to it being broken, much like my entire Linux-on-modern-laptop experience. I was fine with Sway, since I had gotten used to the workflow over the years. After all, it was what all the cool kids online were using, and I was too young to make good decisions. I went about my life, going through most of high school and all of college with a tiling window manager, dismissing alternatives as straying from the One True Path set forth by anonymous forum-goers.

Until about a month ago.

Sway broke me (emotionally) with a click-and-drag issue where selecting text and dragging the selection (a pretty bog-standard thing people do with their computers) changed somehow to keep the selection happening after you released the mouse.

My decades of muscle memory stopped working—I felt lost, adrift on a rough sea, the hot sun bearing down on me. Would I (the bug) ever be rescued (fixed)? Only time would tell, but I was getting desperate.

At first, I thought I could handle it and someone would quickly fix the bug. Days turned into weeks, and I was losing my mind. The Sway IRC was silent to my pleads for help, and I had developed a Pavlovian response to clicking on text to highlight it—a burst of panic in my chest as I dread the mouse continuing to drag after I had let go.

Naturally, instead of figuring out what library made a breaking change and spending four hours running git bisect, I decided to throw nearly a decade of muscle-memory and workflow refinements out the window. I was getting bored of Sway anyway. Let's switch to Niri!

For those unaware, Niri is a scrollable-tiling window manager: each workspace is an infinitely-wide strip you can scroll side-to-side on. It's easier to show their official demo video than to try to explain it with words (you don't have to watch the whole thing):

It was new, dangerous, risky, and most of all, really cool. I just had to try it, transporting me back to my youth distro-hopping and window-manager-hopping(?) with reckless abandon.

Off The Deep End, Again.

It seems to be a recurring theme, throwing myself into a new productivity-altering technology in March when I should be doing more important things instead.

It wasn't as bad this time around! Within a few hours, I had a setup that worked fine enough. Within a week, I had Niri working better than Sway, and I was greatly enjoying the changes (read: improvements) it brought.

  1. Opening a window does not alter other windows: I can keep my focus and Firefox doesn't scroll to another dimension if I open a terminal in its vicinity.

  2. Unlike Sway, Niri supports per-window screensharing, as well as "blackout window from appearing in screen sharing". I've been streaming my homework and it's much nicer without needing to worry about an email notification from my bank showing up in the top corner.

  3. Niri's built-in screenshot tool is really nice, especially compared to Sway's recommended grim+slurp.

  1. Niri has increased my battery life by about two hours compared to Sway.

I was so excited about Niri that I tried my hand at adding a feature to its IPC for something or the other, and I greatly enjoyed it! Unlike Sway/wlroots, Niri/Smithay are written in Rust and are surprisingly accessible to hack on.

I genuinely can't see myself going back to a traditional tiling window manager, Niri just brings too many improvements to my workflow.

The Death of the Traditional Tiling Window Manager

Traditional tiling window managers have a side effect of forcing you to be as efficient as possible with your window layout. There is an additional cognitive load incentivizing you to optimize for the wrong thing: minimizing window reflows. If you don't find yourself constantly swapping between fullscreen and non-fullscreen views and running out of workspaces, you don't have very many windows open. Don't even get me started on tabbed/stacked layouts with nested containers, the least ergonomic Band-Aid™ for the space issue I've ever seen.

After many many years of optimizing for the wrong thing with Sway, Niri blesses me with the realization that I can have the speed of a traditional tiling window manager without the space limitations.

The future is Niri, old man

On Sway, I often had eleven workspaces open. Ever since I switched to a tiling window manager, I kept running out of space and added shortcuts to workspaces 11-20. I drilled it into myself to close windows when I was done with them, often losing my flow when I come back to the projects I closed, all to save imaginary space I feel should be infinite. With Niri, I can have three large projects open, various chat apps, a YouTube video, and three classes worth of schoolwork and never use more than five workspaces. The same setup would have me spilling into workspace fifteen on Sway, and I would quickly get confused and forget where I put my math textbook, switching between each workspace until I find the right one, often the very last one I check!

Wow, I did not realize how much repressed anger I had at traditional tiling window managers until now.

Given the variety of screen sizes and improved processing power I do not think that the traditional tiling window manager ought to be the power-user workflow of choice. It artificially limits space, forces content reflows, and does not work well with nonstandard monitor layouts.

If you are using Sway or another Wayland traditional tiling window manager, you should try Niri. Right now. My configurations are published on Sourcehut if you want to have a Sway-like experience with my keybindings.

Go on then, what are you waiting for?


Thoughts? Comments? Want to hire me? Feel free to get in touch!

I'm also on Bluesky and the Fediverse, if you're into me making bad puns.

联系我们 contact @ memedata.com