translating

This commit is contained in:
geekpi 2019-06-27 09:01:19 +08:00
parent a90d6a4ba7
commit 32898915d7
2 changed files with 192 additions and 192 deletions

View File

@ -1,192 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Using i3 with multiple monitors)
[#]: via: (https://fedoramagazine.org/using-i3-with-multiple-monitors/)
[#]: author: (Adam Šamalík https://fedoramagazine.org/author/asamalik/)
Using i3 with multiple monitors
======
![][1]
Are you using multiple monitors with your Linux workstation? Seeing many things at once might be beneficial. But there are often much more windows in our workflows than physical monitors — and thats a good thing, because seeing too many things at once might be distracting. So being able to switch what we see on individual monitors seems crucial.
Lets talk about i3 — a popular tiling window manager that works great with multiple monitors. And there is one handy feature that many other window managers dont have — the ability to switch workspaces on individual monitors independently.
### Quick introduction to i3
The [Fedora Magazine has already covered i3][2] about three years ago. And it was one of the most popular articles ever published! Even though thats not always the case, i3 is pretty stable and that article is still very accurate today. So — not to repeat ourselves too much — this article only covers the very minimum to get i3 up and running, and youre welcome to go ahead and read it if youre new to i3 and want to learn more about the basics.
To install i3 on your system, run the following command:
```
$ sudo dnf install i3
```
When thats done, log out, and on the log in screen choose i3 as your window manager and log back in again.
When you run i3 for the first time, youll be asked if you wish to proceed with automatic configuration — answer yes here. After that, youll be asked to choose a “mod key”. If youre not sure here, just accept the default which sets you Windows/Super key as the mod key. Youll use this key for mostly all the shortcuts within the window manager.
At this point, you should see a little bar at the bottom and an empty screen. Lets have a look at some of the basic shortcuts.
Open a terminal using:
```
$mod + enter
```
Switch to a second workspace using:
```
$mod + 2
```
Open firefox in two steps, first by:
```
$mod + d
```
… and then by typing “firefox” and pressing enter.
Move it to the first workspace by:
```
$mod + shift + 1
```
… and switch to the first workspace by:
```
$mod + 1
```
At this point, youll see a terminal and a firefox window side by side. To close a window, press:
```
$mod + shift + q
```
There are more shortcuts, but these should give you the minimum to get started with i3.
Ah! And to exit i3 (to log out) press:
```
$mod + shift + e
```
… and then confirm using your mouse at the top-right corner.
### Getting multiple screens to work
Now that we have i3 up and running, lets put all those screens to work!
To do that, well need to use the command line as i3 is very lightweight and doesnt have gui to manage additional screens. But dont worry if that sounds difficult — its actually quite straightforward!
The command well use is called xrandr. If you dont have xrandr on your system, install it by running:
```
$ sudo dnf install xrandr
```
When thats installed, lets just go ahead and run it:
```
$ xrandr
```
The output lists all the available outputs, and also indicated which have a screen attached to them (a monitor connected with a cable) by showing supported resolutions. Good news is that we dont need to really care about the specific resolutions to make the them work.
This specific example shows a primary screen of a laptop (named eDP1), and a second monitor connected to the HDMI-2 output, physically positioned right of the laptop. To turn it on, run the following command:
```
$ xrandr --output HDMI-2 --auto --right-of eDP1
```
And thats it! Your screen is now active.
![Second screen active. The commands shown on this screenshot are slightly different than in the article, as they set a smaller resolution to make the screenshots more readable.][3]
### Managing workspaces on multiple screens
Switching workspaces and creating new ones on multiple screens is very similar to having just one screen. New workspaces get created on the screen thats currently active — the one that has your mouse cursor on it.
So, to switch to a specific workspace (or to create a new one in case it doesnt exist), press:
```
$mod + NUMBER
```
And you can switch workspaces on individual monitors independently!
![Workspace 2 on the left screen, workspace 4 on the right screen.][4]
![Left screen switched to workspace 3, right screen still showing workspace 4.][5]
![Right screen switched to workspace 4, left screen still showing workspace 3.][6]
### Moving workspaces between monitors
The same way we can move windows to different workspaces by the following command:
```
$mod + shift + NUMBER
```
… we can move workspaces to different screens as well. However, there is no default shortcut for this action — so we have to create it first.
To create a custom shortcut, youll need to open the configuration file in a text editor of your choice (this article uses _vim_):
```
$ vim ~/.config/i3/config
```
And add the following lines to the very bottom of the configuration file:
```
# Moving workspaces between screens
bindsym $mod+p move workspace to output right
```
Save, close, and to reload and apply the configuration, press:
```
$mod + shift + r
```
Now youll be able to move your active workspace to the second monitor by:
```
$mod + p
```
![Workspace 2 with Firefox on the left screen][7]
![Workspace 2 with Firefox moved to the second screen][8]
And thats it! Enjoy your new multi-monitor experience, and to learn more about i3, youre welcome to read the previous article about i3 on the Fedora Magazine, or consult the official i3 documentation.
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/using-i3-with-multiple-monitors/
作者:[Adam Šamalík][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://fedoramagazine.org/author/asamalik/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2019/06/i3-title-816x345.jpg
[2]: https://fedoramagazine.org/getting-started-i3-window-manager/
[3]: https://fedoramagazine.org/wp-content/uploads/2019/06/0-1-1024x384.png
[4]: https://fedoramagazine.org/wp-content/uploads/2019/06/1-1-1024x384.png
[5]: https://fedoramagazine.org/wp-content/uploads/2019/06/1-2-1024x384.png
[6]: https://fedoramagazine.org/wp-content/uploads/2019/06/1-3-1024x384.png
[7]: https://fedoramagazine.org/wp-content/uploads/2019/06/2-1-1024x384.png
[8]: https://fedoramagazine.org/wp-content/uploads/2019/06/2-2-1024x384.png

View File

@ -0,0 +1,192 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Using i3 with multiple monitors)
[#]: via: (https://fedoramagazine.org/using-i3-with-multiple-monitors/)
[#]: author: (Adam Šamalík https://fedoramagazine.org/author/asamalik/)
将 i3 与多个显示器配合使用
======
![][1]
你在 Linux 工作站上使用多个显示器吗?一次看到很多东西可能是有益的。但在我们的工作中通常有比实际显示器更多的窗口 - 这是一件好事,因为一次看到太多东西可能会分散注意力。因此能够切换我们在单个显示器上看到的内容似乎很重要。
让我们来谈谈 i3它是一个流行的平铺窗口管理器可以与多个显示器配合使用。并且有许多其他窗口管理器没有的便利功能它能够独立地在各个显示器上切换工作区。
### 快速介绍 i3
大约三年前,[Fedora Magazine 已经写了一篇关于 i3 的文章][2]。这是有史以来最受欢迎的文章之一!虽然情况并非总是如此,但 i3 非常稳定,而且这篇文章如今也很准确。所以,这次不会重复太多,本篇只涵盖了让 i3 启动和运行,如果你是 i3 的新手,想要了解更多基础知识的话,欢迎你继续阅读。
要在系统上安装 i3请运行以下命令
```
$ sudo dnf install i3
```
完成后,注销,然后在登录屏幕上选择 i3 作为窗口管理器,然后重新登录。
当你第一次运行 i3 时,系统会询问你是否要继续进行自动配置 - 在此处回答是。之后,你将被要求选择 “mod 键”。如果你在这里不确定,只需接受默认值,即将 Windows/Super 键设置为 mod 键。你将主要使用此键用于窗口管理器中的快捷方式。
此时,你应该在底部看到一个小条和一个空白屏幕。我们来看看一些基本的快捷方式。
打开终端:
```
$mod + enter
```
切换到第二个工作区:
```
$mod + 2
```
通过以下两个步骤打开 firefox首先
```
$mod + d
```
然后输入 “firefox” 并按回车键。
将其移动到第一个工作区:
```
$mod + shift + 1
```
切换到第一个工作区:
```
$mod + 1
```
此时,你将并排看到一个终端和一个 firefox 窗口。要关闭窗口,请按:
```
$mod + shift + q
```
还有更多的快捷方式,但这些足够让你开始使用 i3。
要退出 i3退出登录
```
$mod + shift + e
```
然后在右上角使用鼠标确认。
### 同时让多个屏幕工作
现在我们已经启动并运行了 i3让我们把所有这些屏幕都用到
为此,我们需要使用命令行,因为 i3 非常轻量级,并且没有 gui 来管理其他屏幕。如果这听起来很难也不用担心,它实际上非常简单!
我们将使用的命令称为 xrandr。如果你的系统上没有 xrandr请运行以下命令安装
```
$ sudo dnf install xrandr
```
当它安装完毕后,让我们继续运行它:
```
$ xrandr
```
输出列出了所有可用输出,并通过显示支持的分辨率指示哪些输出连接了屏幕(通过电缆连接的显示器)。好消息是,我们不需要关心使它们工作的分辨率。
这个例子显示了笔记本电脑的主屏幕(名为 eDP1以及连接到 HDMI-2 输出的第二个显示器,它位于笔记本电脑的右侧。要打开它,请运行以下命令:
```
$ xrandr --output HDMI-2 --auto --right-of eDP1
```
就是这样!你的屏幕现已激活。
![Second screen active. The commands shown on this screenshot are slightly different than in the article, as they set a smaller resolution to make the screenshots more readable.][3]
### 在多个屏幕上管理工作区
在多个屏幕上切换工作区和创建新工作区非常类似于只有一个屏幕的情况。新工作区会在当前处于活动状态(鼠标光标所在位置)的屏幕上创建。
因此,要切换到特定工作区(或在不存在的情况下创建新工作区),请按:
```
$mod + NUMBER
```
你可以独立切换各个显示器上的工作区!
![Workspace 2 on the left screen, workspace 4 on the right screen.][4]
![Left screen switched to workspace 3, right screen still showing workspace 4.][5]
![Right screen switched to workspace 4, left screen still showing workspace 3.][6]
### 在显示器之间移动工作区
我们可以通过以下命令将窗口移动到不同的工作区:
```
$mod + shift + NUMBER
```
我们也可以将工作区移动到不同的屏幕。但是,此操作没有默认快捷方式,因此我们必须先创建它。
要创建自定义快捷方式,你需要在你选择的文本编辑器中打开配置文件(本文使用 _vim_
```
$ vim ~/.config/i3/config
```
并将以下行添加到配置文件的最底部:
```
# Moving workspaces between screens
bindsym $mod+p move workspace to output right
```
保存、关闭并重新加载以使配置生效,按下:
```
$mod + shift + r
```
现在你可以将活跃的工作区移动到第二个显示器:
```
$mod + p
```
![Workspace 2 with Firefox on the left screen][7]
![Workspace 2 with Firefox moved to the second screen][8]
就是这些了!享受你的新多显示器体验,并了解更多 i3欢迎阅读 Fedora Magazine 上之前关于 i3 的文章,或者查看官方 i3 文档。
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/using-i3-with-multiple-monitors/
作者:[Adam Šamalík][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://fedoramagazine.org/author/asamalik/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2019/06/i3-title-816x345.jpg
[2]: https://fedoramagazine.org/getting-started-i3-window-manager/
[3]: https://fedoramagazine.org/wp-content/uploads/2019/06/0-1-1024x384.png
[4]: https://fedoramagazine.org/wp-content/uploads/2019/06/1-1-1024x384.png
[5]: https://fedoramagazine.org/wp-content/uploads/2019/06/1-2-1024x384.png
[6]: https://fedoramagazine.org/wp-content/uploads/2019/06/1-3-1024x384.png
[7]: https://fedoramagazine.org/wp-content/uploads/2019/06/2-1-1024x384.png
[8]: https://fedoramagazine.org/wp-content/uploads/2019/06/2-2-1024x384.png