i3 窗口管理器使 Linux 更美好
i3 窗口管理器

> 
> 通过键盘操作的 i3 平铺窗口管理器使用 Linux 桌面。
> 
> 
> 


![](/data/attachment/album/201811/28/114731z171znh8978ngn8a.jpg)


Linux（和一般的开源软件）最美好的一点是自由 —— 可以在不同的替代方案中进行选择以满足我们的需求。


我使用 Linux 已经很长时间了，但我从来没有对可选用的桌面环境完全满意过。直到去年，[Xfce](https://xfce.org/) 还是我认为在功能和性能之间的平和最接近满意的一个桌面环境。然后我发现了 [i3](https://i3wm.org/)，这是一个改变了我的生活的惊人的软件。


i3 是一个平铺窗口管理器。窗口管理器的目标是控制窗口系统中窗口的外观和位置。窗口管理器通常用作功能齐全的桌面环境 (如 GONME 或 Xfce ) 的一部分，但也有一些可以用作独立的应用程序。


平铺式窗口管理器会自动排列窗口，以不重叠的方式占据整个屏幕。其他流行的平铺式窗口管理器还有 [wmii](https://code.google.com/archive/p/wmii/) 和 [xmonad](https://xmonad.org/) 。


![i3 tiled window manager screenshot](/data/attachment/album/201811/28/114747cz93iitfkz4w0in0.png "i3 tiled window manager screenshot")


*带有三个的 i3 屏幕截图*


为了获得更好的 Linux 桌面体验，以下是我使用和推荐 i3 窗口管理器的五个首要原因。


### 1、极简艺术


i3 速度很快。它既不冗杂、也不花哨。它的设计简单而高效。作为开发人员，我重视这些功能，因为我可以使用更多的功能以丰富我最喜欢的开发工具，或者使用容器或虚拟机在本地测试内容。


此外， i3 是一个窗口管理器，与功能齐全的桌面环境不同，它并不规定您应该使用的应用程序。您是否想使用 Xfce 的 Thunar 作为文件管理器？GNOME 的 gedit 去编辑文本? i3 并不在乎。选择对您的工作流最有意义的工具，i3 将以相同的方式管理它们。


### 2、屏幕实际使用面积


作为平铺式窗口管理器，i3 将自动 “平铺”，以不重叠的方式定位窗口，类似于在墙上放置瓷砖。因为您不需要担心窗口定位，i3 一般会更好地利用您的屏幕空间。它还可以让您更快地找到您需要的东西。


对于这种情况有很多有用的例子。例如，系统管理员可以打开多个终端来同时监视或在不同的远程系统上工作；开发人员可以使用他们最喜欢的 IDE 或编辑器和几个终端来测试他们的程序。


此外，i3 具有灵活性。如果您需要为特定窗口提供更多空间，请启用全屏模式或切换到其他布局，如堆叠或选项卡式（标签式）。


### 3、键盘式工作流程


i3 广泛使用键盘快捷键来控制环境的不同方面。其中包括打开终端和其他程序、调整大小和定位窗口、更改布局，甚至退出 i3。当您开始使用 i3 时，您需要记住其中的一些快捷方式才能使用，随着时间的推移，您会使用更多的快捷方式。


主要好处是，您不需要经常在键盘和鼠标之间切换。通过练习，您将提高工作流程的速度和效率。


例如， 要打开新的终端，请按 `<SUPER>+<ENTER>`。由于窗口是自动定位的，您可以立即开始键入命令。结合一个很好的终端文本编辑器（如 Vim）和一个以面向键盘的浏览器，形成一个完全由键盘驱动的工作流程。


在 i3 中，您可以为所有内容定义快捷方式。下面是一些示例：


* 打开终端
* 打开浏览器
* 更改布局
* 调整窗口大小
* 控制音乐播放器
* 切换工作区


现在我已经习惯了这个工作形式，我已无法回到了常规的桌面环境。


### 4、灵活


i3 力求极简，使用很少的系统资源，但这并不意味着它不能变漂亮。i3 是灵活且可通过多种方式进行自定义以改善视觉体验。因为 i3 是一个窗口管理器，所以它没有提供启用自定义的工具，你需要外部工具来实现这一点。一些例子：


* 用 `feh` 定义桌面的背景图片。
* 使用合成器管理器，如 `compton` 以启用窗口淡入淡出和透明度等效果。
* 用 `dmenu` 或 `rofi` 以启用可从键盘快捷方式启动的可自定义菜单。
* 用 `dunst` 用于桌面通知。


i3 是可完全配置的，您可以通过更新默认配置文件来控制它的各个方面。从更改所有键盘快捷键，到重新定义工作区的名称，再到修改状态栏，您都可以使 i3 以任何最适合您需要的方式运行。


![i3 with rofi menu and dunst desktop notifications](/data/attachment/album/201811/28/114748uhrd8mwownkozf2p.png "i3 with rofi menu and dunst desktop notifications")


*i3 与 `rofi` 菜单和 `dunst` 桌面通知。*


最后，对于更高级的用户，i3 提供了完整的进程间通信（[IPC](https://i3wm.org/docs/ipc.html)）接口，允许您使用偏好的语言来开发脚本或程序，以实现更多的自定义选项。


### 5、工作空间


在 i3 中，工作区是对窗口进行分组的一种简单方法。您可以根据您的工作流以不同的方式对它们进行分组。例如，您可以将浏览器放在一个工作区上，终端放在另一个工作区上，将电子邮件客户端放在第三个工作区上等等。您甚至可以更改 i3 的配置，以便始终将特定应用程序分配给它们自己的工作区。


切换工作区既快速又简单。像 i3 中的惯例，使用键盘快捷方式执行此操作。按 `<SUPER>+num` 切换到工作区 `num` 。如果您养成了始终将应用程序组的窗口分配到同一个工作区的习惯，则可以在它们之间快速切换，这使得工作区成为非常有用的功能。


此外，还可以使用工作区来控制多监视器环境，其中每个监视器都有个初始工作区。如果切换到该工作区，则切换到该监视器，而无需让手离开键盘。


最后，i3 中还有另一种特殊类型的工作空间：the scratchpad（便笺簿）。它是一个不可见的工作区，通过按快捷方式显示在其他工作区的中间。这是一种访问您经常使用的窗口或程序的方便方式，如电子邮件客户端或音乐播放器。


### 尝试一下吧


如果您重视简洁和效率，并且不惮于使用键盘，i3 就是您的窗口管理器。有人说是为高级用户准备的，但情况不一定如此。你需要学习一些基本的快捷方式来度过开始的阶段，不久就会越来越自然并且不假思索地使用它们。


这篇文章只是浅浅谈及了 i3 能做的事情。欲了解更多详情，请参阅 [i3 的文档](https://i3wm.org/docs/userguide.html)。




---


via: <https://opensource.com/article/18/8/i3-tiling-window-manager>


作者：[Ricardo Gerardi](https://opensource.com/users/rgerardi) 选题：[lujun9972](https://github.com/lujun9972) 译者：[lixinyuxx](https://github.com/lixinyuxx) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
One of the nicest things about Linux (and open source software in general) is the freedom to choose among different alternatives to address our needs.

I've been using Linux for a long time, but I was never entirely happy with the desktop environment options available. Until last year, [Xfce](https://xfce.org/) was the closest to what I consider a good compromise between features and performance. Then I found [i3](https://i3wm.org/), an amazing piece of software that changed my life.

I3 is a tiling window manager. The goal of a window manager is to control the appearance and placement of windows in a windowing system. Window managers are often used as part a full-featured desktop environment (such as GNOME or Xfce), but some can also be used as standalone applications.

A tiling window manager automatically arranges the windows to occupy the whole screen in a non-overlapping way. Other popular tiling window managers include [wmii](https://code.google.com/archive/p/wmii/) and [xmonad](https://xmonad.org/).

![i3 tiled window manager screenshot i3 tiled window manager screenshot](https://opensource.com/sites/default/files/uploads/i3_screenshot.png)

Following are the top five reasons I use the i3 window manager and recommend it for a better Linux desktop experience.

## 1. Minimalism

I3 is fast. It is neither bloated nor fancy. It is designed to be simple and efficient. As a developer, I value these features, as I can use the extra capacity to power my favorite development tools or test stuff locally using containers or virtual machines.


In addition, i3 is a window manager and, unlike full-featured desktop environments, it does not dictate the applications you should use. Do you want to use Thunar from Xfce as your file manager? GNOME's gedit to edit text? I3 does not care. Pick the tools that make the most sense for your workflow, and i3 will manage them all in the same way.

## 2. Screen real estate

As a tiling window manager, i3 will automatically "tile" or position the windows in a non-overlapping way, similar to laying tiles on a wall. Since you don't need to worry about window positioning, i3 generally makes better use of your screen real estate. It also allows you to get to what you need faster.

There are many useful cases for this. For example, system administrators can open several terminals to monitor or work on different remote systems simultaneously; and developers can use their favorite IDE or editor and a few terminals to test their programs.

In addition, i3 is flexible. If you need more space for a particular window, enable full-screen mode or switch to a different layout, such as stacked or tabbed.

## 3. Keyboard-driven workflow

I3 makes extensive use of keyboard shortcuts to control different aspects of your environment. These include opening the terminal and other programs, resizing and positioning windows, changing layouts, and even exiting i3. When you start using i3, you need to memorize a few of those shortcuts to get around and, with time, you'll use more of them.

The main benefit is that you don't often need to switch contexts from the keyboard to the mouse. With practice, it means you'll improve the speed and efficiency of your workflow.

For example, to open a new terminal, press `<SUPER>+<ENTER>`

. Since the windows are automatically positioned, you can start typing your commands right away. Combine that with a nice terminal-driven text editor (e.g., Vim) and a keyboard-focused browser for a fully keyboard-driven workflow.

In i3, you can define shortcuts for everything. Here are some examples:

- Open terminal
- Open browser
- Change layouts
- Resize windows
- Control music player
- Switch workspaces

Now that I am used to this workflow, I can't see myself going back to a regular desktop environment.

## 4. Flexibility

I3 strives to be minimal and use few system resources, but that does not mean it can't be pretty. I3 is flexible and can be customized in several ways to improve the visual experience. Because i3 is a window manager, it doesn't provide tools to enable customizations; you need external tools for that. Some examples:

- Use
`feh`

to define a background picture for your desktop. - Use a compositor manager such as
`compton`

to enable effects like window fading and transparency. - Use
`dmenu`

or`rofi`

to enable customizable menus that can be launched from a keyboard shortcut. - Use
`dunst`

for desktop notifications.

I3 is fully configurable, and you can control every aspect of it by updating the default configuration file. From changing all keyboard shortcuts, to redefining the name of the workspaces, to modifying the status bar, you can make i3 behave in any way that makes the most sense for your needs.

![i3 with rofi menu and dunst desktop notifications i3 with rofi menu and dunst desktop notifications](https://opensource.com/sites/default/files/uploads/rofi_dunst.png)

i3 with rofi menu and dunst desktop notifications


Finally, for more advanced users, i3 provides a full interprocess communication ([IPC](https://i3wm.org/docs/ipc.html)) interface that allows you to use your favorite language to develop scripts or programs for even more customization options.

## 5. Workspaces

In i3, a workspace is an easy way to group windows. You can group them in different ways according to your workflow. For example, you can put the browser on one workspace, the terminal on another, an email client on a third, etc. You can even change i3's configuration to always assign specific applications to their own workspaces.

Switching workspaces is quick and easy. As usual in i3, do it with a keyboard shortcut. Press `<SUPER>+num`

to switch to workspace `num`

. If you get into the habit of always assigning applications/groups of windows to the same workspace, you can quickly switch between them, which makes workspaces a very useful feature.

In addition, you can use workspaces to control multi-monitor setups, where each monitor gets an initial workspace. If you switch to that workspace, you switch to that monitor—without moving your hand off the keyboard.

Finally, there is another, special type of workspace in i3: the scratchpad. It is an invisible workspace that shows up in the middle of the other workspaces by pressing a shortcut. This is a convenient way to access windows or programs that you frequently use, such as an email client or your music player.

## Give it a try

If you value simplicity and efficiency and are not afraid of working with the keyboard, i3 is the window manager for you. Some say it is for advanced users, but that is not necessarily the case. You need to learn a few basic shortcuts to get around at the beginning, but they'll soon feel natural and you'll start using them without thinking.

This article just scratches the surface of what i3 can do. For more details, consult [i3's documentation](https://i3wm.org/docs/userguide.html).

## 16 Comments