mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-03-06 01:20:12 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
00002b1896
@ -1,29 +1,34 @@
|
|||||||
我为什么喜欢 Xonsh
|
我为什么喜欢 Xonsh
|
||||||
======
|
======
|
||||||
|
|
||||||
|
> 有没有想过用 Python 做你的 shell?
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
Shell 语言对交互式使用很有用。但是在使用它们作为编程语言时这种优化需要权衡,这有时在编写 shell 脚本时会感觉到。
|
Shell 语言对交互式使用很有用。但是在使用它们作为编程语言时这种优化就需要权衡,有时在编写 shell 脚本时会感觉到这点。
|
||||||
|
|
||||||
如果你的 shell 时一种更可伸缩的语言会怎样?比如说,Python?
|
如果你的 shell 也能理解一种更可伸缩的语言会怎样?比如说,Python?
|
||||||
|
|
||||||
进入 [Xonsh][1]。
|
进入 [Xonsh][1]。
|
||||||
|
|
||||||
安装 Xonsh 就像创建虚拟环境一样简单,运行 `pip install xonsh [ptk,linux]`,然后运行 `xonsh`。
|
安装 Xonsh 就像创建虚拟环境一样简单,运行 `pip install xonsh [ptk,linux]`,然后运行 `xonsh`。
|
||||||
|
|
||||||
首先,你可能想知道为什么你的 Python shell 有一个奇怪的提示:
|
首先,你可能奇怪为什么你的 Python shell 有一个奇怪的提示:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ 1+1
|
$ 1+1
|
||||||
2
|
2
|
||||||
```
|
```
|
||||||
|
|
||||||
好的计算器!
|
好的,计算器!
|
||||||
|
|
||||||
```
|
```
|
||||||
$ print("hello world")
|
$ print("hello world")
|
||||||
hello world
|
hello world
|
||||||
```
|
```
|
||||||
|
|
||||||
我们还可以调用其他函数:
|
我们还可以调用其他函数:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ from antigravity import geohash
|
$ from antigravity import geohash
|
||||||
$ geohash(37.421542, -122.085589, b'2005-05-26-10458.68')
|
$ geohash(37.421542, -122.085589, b'2005-05-26-10458.68')
|
||||||
@ -31,12 +36,14 @@ $ geohash(37.421542, -122.085589, b'2005-05-26-10458.68')
|
|||||||
```
|
```
|
||||||
|
|
||||||
然而,我们仍然可以像常规 shell 一样使用它:
|
然而,我们仍然可以像常规 shell 一样使用它:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ echo "hello world"
|
$ echo "hello world"
|
||||||
hello world
|
hello world
|
||||||
```
|
```
|
||||||
|
|
||||||
我们甚至可以混搭!
|
我们甚至可以混搭!
|
||||||
|
|
||||||
```
|
```
|
||||||
$ for i in range(3):
|
$ for i in range(3):
|
||||||
. echo "hello world"
|
. echo "hello world"
|
||||||
@ -49,12 +56,14 @@ hello world
|
|||||||
Xonsh 支持使用 [Prompt Toolkit][2] 补全 shell 命令和 Python 表达式。补全有可视化提示,会显示可能的补全并有下拉列表。
|
Xonsh 支持使用 [Prompt Toolkit][2] 补全 shell 命令和 Python 表达式。补全有可视化提示,会显示可能的补全并有下拉列表。
|
||||||
|
|
||||||
它还支持访问环境变量。它使用简单但强大的启发式方法将 Python 类型应用于环境变量。默认值为 “string”,但是,例如,路径变量是自动列表。
|
它还支持访问环境变量。它使用简单但强大的启发式方法将 Python 类型应用于环境变量。默认值为 “string”,但是,例如,路径变量是自动列表。
|
||||||
|
|
||||||
```
|
```
|
||||||
$ '/usr/bin' in $PATH
|
$ '/usr/bin' in $PATH
|
||||||
True
|
True
|
||||||
```
|
```
|
||||||
|
|
||||||
Xonsh 接受 shell 形式或 Python 形式的布尔快捷运算符:
|
Xonsh 接受 shell 形式或 Python 形式的布尔快捷运算符:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ cat things
|
$ cat things
|
||||||
foo
|
foo
|
||||||
@ -66,13 +75,15 @@ $ grep -q bar things || echo "found"
|
|||||||
found
|
found
|
||||||
```
|
```
|
||||||
|
|
||||||
这意味着 Python 关键字是被解释了。如果我们想要打印著名的 Dr. Seuss 书的标题,我们需要引用关键词。
|
这意味着 Python 关键字是被解释了。如果我们想要打印著名的《苏斯博士》书的标题,我们需要引用关键词。
|
||||||
|
|
||||||
```
|
```
|
||||||
$ echo green eggs "and" ham
|
$ echo green eggs "and" ham
|
||||||
green eggs and ham
|
green eggs and ham
|
||||||
```
|
```
|
||||||
|
|
||||||
如果我们不这样做,我们会感到惊讶:
|
如果我们不这样做,我们会感到惊讶:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ echo green eggs and ham
|
$ echo green eggs and ham
|
||||||
green eggs
|
green eggs
|
||||||
@ -88,9 +99,10 @@ Did you mean one of the following?
|
|||||||
|
|
||||||
虚拟环境可能会有点棘手。一般的虚拟环境(取决于它们类似 Bash 的语法)无法工作。但是,Xonsh 自带了一个名为 `vox` 的虚拟环境管理系统。
|
虚拟环境可能会有点棘手。一般的虚拟环境(取决于它们类似 Bash 的语法)无法工作。但是,Xonsh 自带了一个名为 `vox` 的虚拟环境管理系统。
|
||||||
|
|
||||||
`vox` 可以创建,激活和停用 `~/.virtualenvs` 中的环境。如果你用过 `virtualenvwrapper`,这就是环境变量所在的地方。
|
`vox` 可以创建、激活和停用 `~/.virtualenvs` 中的环境。如果你用过 `virtualenvwrapper`,这就是环境变量所在的地方。
|
||||||
|
|
||||||
请注意,当前激活的环境不会影响 `xonsh`。它无法从激活的环境中导入任何内容。
|
请注意,当前激活的环境不会影响 `xonsh`。它无法从激活的环境中导入任何内容。
|
||||||
|
|
||||||
```
|
```
|
||||||
$ xontrib load vox
|
$ xontrib load vox
|
||||||
$ vox create my-environment
|
$ vox create my-environment
|
||||||
@ -108,7 +120,7 @@ xonsh: For full traceback set: $XONSH_SHOW_TRACEBACK = True
|
|||||||
ModuleNotFoundError: No module named 'money'
|
ModuleNotFoundError: No module named 'money'
|
||||||
```
|
```
|
||||||
|
|
||||||
第一行启用 `vox`:它是一个 `xontrib`,Xonsh 的一个第三方扩展。`xontrib` 管理器可以列出所有可能的 `xontribs` 及其当前状态(已安装,已加载或未加载)。
|
第一行启用 `vox`:它是一个 `xontrib`,是 Xonsh 的一个第三方扩展。`xontrib` 管理器可以列出所有可能的 `xontribs` 及其当前状态(已安装、已加载或未加载)。
|
||||||
|
|
||||||
可以编写一个 `xontrib` 并上传到 `PyPi` 以使其可用。但是,最好将它添加到 `xontrib` 索引中,以便 Xonsh 提前知道它。比如,这能让配置向导建议它。
|
可以编写一个 `xontrib` 并上传到 `PyPi` 以使其可用。但是,最好将它添加到 `xontrib` 索引中,以便 Xonsh 提前知道它。比如,这能让配置向导建议它。
|
||||||
|
|
||||||
@ -121,7 +133,7 @@ via: https://opensource.com/article/18/9/xonsh-bash-alternative
|
|||||||
作者:[Moshe Zadka][a]
|
作者:[Moshe Zadka][a]
|
||||||
选题:[lujun9972](https://github.com/lujun9972)
|
选题:[lujun9972](https://github.com/lujun9972)
|
||||||
译者:[geekpi](https://github.com/geekpi)
|
译者:[geekpi](https://github.com/geekpi)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
@ -1,9 +1,9 @@
|
|||||||
可视化查看 Linux 系统上的磁盘使用情况
|
Filelight:可视化查看 Linux 系统上的磁盘使用情况
|
||||||
======
|
======
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
查看硬盘使用情况对于类 Unix 操作系统来说不是什么大问题。我们有一个名为 [**du**][1] 的内置命令,可以在分钟之内计算和汇总磁盘空间的使用情况。此外,我们还有一些第三方工具,比如 [**Ncdu**][2] and [**Agedu**][3],它们也可以用来追踪磁盘使用情况。如您所见,这些都是命令行中的实用程序,磁盘使用情况将以纯文本的形式显示。但是,有些人希望以可视化、图表的形式查看结果。别担心!我知道一个 GUI 工具可以显示磁盘使用细节。它就是“**Filelight**”,这是一个图形化实用程序,用于可视化显示 Linux 系统上的磁盘使用情况,并以彩色径向图显示结果。Filelight 是历史最悠久的项目之一,它已经存在了很长时间,它完全免费使用并开源。
|
查看硬盘使用情况对于类 Unix 操作系统来说不是什么大问题。我们有一个名为 [du][1] 的内置命令,可以在几分钟之内计算和汇总磁盘空间的使用情况。此外,我们还有一些第三方工具,比如 [Ncdu][2] 和 [Agedu][3],它们也可以用来追踪磁盘使用情况。如您所见,这些都是命令行中的实用程序,磁盘使用情况将以纯文本的形式显示。但是,有些人希望以可视化、图表的形式查看结果。别担心!我知道一个 GUI 工具可以显示磁盘使用细节。它就是 “**Filelight**”,这是一个图形化实用程序,用于可视化显示 Linux 系统上的磁盘使用情况,并以彩色径向图显示结果。Filelight 是历史最悠久的项目之一,它已经存在了很长时间,它完全免费使用并开源。
|
||||||
|
|
||||||
### 安装 Filelight
|
### 安装 Filelight
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ Filelight 是 KDE 应用程序的一部分,并预装在基于 KDE 的 Linux
|
|||||||
|
|
||||||
如果您使用的是非 KDE 发行版,官方存储库中包含了 Filelight,因此您可以使用默认的包管理器进行安装。
|
如果您使用的是非 KDE 发行版,官方存储库中包含了 Filelight,因此您可以使用默认的包管理器进行安装。
|
||||||
|
|
||||||
在 Arch Linux 及其衍生版,如 Antergos,Manjaro Linux 中,Filelight 可以按照如下方法安装。
|
在 Arch Linux 及其衍生版,如 Antergos、Manjaro Linux 中,Filelight 可以按照如下方法安装。
|
||||||
|
|
||||||
```
|
```
|
||||||
$ sudo pacman -S filelight
|
$ sudo pacman -S filelight
|
||||||
@ -43,36 +43,34 @@ Filelight 以图形方式将您的文件系统表示为一组同心圆环段。
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
如您所见,Filelight 默认显示磁盘中 **/** 和 **/boot** 文件系统的使用情况。
|
如您所见,Filelight 默认显示磁盘中 `/` 和 `/boot` 文件系统的使用情况。
|
||||||
|
|
||||||
您还可以选择扫描的各个文件夹,以查看该特定文件夹的磁盘使用情况。为此,请到 **Filelight - > Scan -> Scan Folder** 并选择要扫描的文件夹。
|
您还可以选择扫描的各个文件夹,以查看该特定文件夹的磁盘使用情况。为此,请到 “Filelight -> Scan -> Scan Folder” 并选择要扫描的文件夹。
|
||||||
|
|
||||||
Filelight 在扫描时排除以下目录:
|
Filelight 在扫描时排除以下目录:
|
||||||
|
|
||||||
* /dev
|
* `/dev`
|
||||||
* /proc
|
* `/proc`
|
||||||
* /sys
|
* `/sys`
|
||||||
* /root
|
* `/root`
|
||||||
|
|
||||||
|
此选项有助于跳过您可能没有权限读取的目录,或者属于虚拟文件系统的文件夹,例如 `/proc`。
|
||||||
|
|
||||||
|
如果您想要在此列表中增加文件夹,请到 “Filelight -> Settings -> Scanning” 并点击 “Add” 按钮然后选择您想要增加的文件夹。
|
||||||
此选项有助于跳过您可能没有权限读取的目录,或者属于虚拟文件系统的文件夹,例如 **/proc**。
|
|
||||||
|
|
||||||
如果您想要在此列表中增加文件夹,请到 **Filelight - > Settings -> Scanning** 并点击“Add”按钮然后选择您想要增加的文件夹。
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
类似的,要想从此列表中移除某个文件夹,选择文件夹并点击“Remove”。
|
类似的,要想从此列表中移除某个文件夹,选择文件夹并点击 “Remove”。
|
||||||
|
|
||||||
如果您想要改变 Filelight 的外观,请到 **Settings - > Appearance** 栏,按照您的喜好改变配色方案。
|
如果您想要改变 Filelight 的外观,请到 “Settings - > Appearance” 栏,按照您的喜好改变配色方案。
|
||||||
|
|
||||||
径向图中的每个段用不同的颜色表示。下图显示了 **/** 文件系统的整个径向布局。要查看文件和文件夹的完整信息,只需将鼠标指针悬停在它们上边。
|
径向图中的每个段用不同的颜色表示。下图显示了 `/` 文件系统的整个径向布局。要查看文件和文件夹的完整信息,只需将鼠标指针悬停在它们上边。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
只需点击相应的段即可浏览文件系统。要查看某个文件或文件夹的磁盘使用情况,只需单击它们即可获得该特定文件夹、文件的完整磁盘使用情况。
|
只需点击相应的段即可浏览文件系统。要查看某个文件或文件夹的磁盘使用情况,只需单击它们即可获得该特定文件夹、文件的完整磁盘使用情况。
|
||||||
|
|
||||||
不仅仅是本地文件系统,Filelight 还能够扫描远程磁盘和可移动磁盘。 如果您使用任何基于 KDE 的 Linux 发行版,它可以集成到 Konqueror,Dolphin 和 Krusader 等文件管理器中。
|
不仅仅是本地文件系统,Filelight 还能够扫描远程磁盘和可移动磁盘。 如果您使用任何基于 KDE 的 Linux 发行版,它可以集成到 Konqueror、Dolphin 和 Krusader 等文件管理器中。
|
||||||
|
|
||||||
与 CLI 实用程序不同,您不必使用任何额外的参数或选项来以易读的(而非乱码的)格式查看结果。 默认情况下,Filelight 将自动以易读的格式显示磁盘使用情况。
|
与 CLI 实用程序不同,您不必使用任何额外的参数或选项来以易读的(而非乱码的)格式查看结果。 默认情况下,Filelight 将自动以易读的格式显示磁盘使用情况。
|
||||||
|
|
||||||
@ -91,7 +89,7 @@ via: https://www.ostechnix.com/filelight-visualize-disk-usage-on-your-linux-syst
|
|||||||
作者:[SK][a]
|
作者:[SK][a]
|
||||||
选题:[lujun9972](https://github.com/lujun9972)
|
选题:[lujun9972](https://github.com/lujun9972)
|
||||||
译者:[XiatianSummer](https://github.com/XiatianSummer)
|
译者:[XiatianSummer](https://github.com/XiatianSummer)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
@ -1,3 +1,5 @@
|
|||||||
|
HankChow translating
|
||||||
|
|
||||||
7 Python libraries for more maintainable code
|
7 Python libraries for more maintainable code
|
||||||
======
|
======
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
ucasFL translating
|
||||||
|
|
||||||
What is ZFS? Why People Use ZFS? [Explained for Beginners]
|
What is ZFS? Why People Use ZFS? [Explained for Beginners]
|
||||||
======
|
======
|
||||||
Today, we will take a look at ZFS, an advanced file system. We will discuss where it came from, what it is, and why it is so popular among techies and enterprise.
|
Today, we will take a look at ZFS, an advanced file system. We will discuss where it came from, what it is, and why it is so popular among techies and enterprise.
|
||||||
|
77
sources/tech/20180913 ScreenCloud- The Screenshot-- App.md
Normal file
77
sources/tech/20180913 ScreenCloud- The Screenshot-- App.md
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
ScreenCloud: The Screenshot++ App
|
||||||
|
======
|
||||||
|
[ScreenCloud][1] is an amazing little app, that you don’t even know you need. The default screenshot procedure on desktop Linux is great (Prt Scr Button) and we even have some[powerful screenshot utilities][2]like [Shutter][3]. But ScreenCloud brings one more really simple yet really convenient feature that I just fell in love with. But before we get into it, let’s catch a little backstory.
|
||||||
|
|
||||||
|
I take a lot of screenshots. A lot more than average. Receipts, registration details, development work, screenshots of applications for articles, and lot more. The next thing I do is open a browser, browse to my favorite cloud storage and dump the important ones there so that I can access them on my phone and also across multiple operating systems on my PC. This also allows me to easily share screenshots of the apps that I’m working on with my team.
|
||||||
|
|
||||||
|
I had no complaints with this standard procedure of taking screenshots, opening a browser and logging into my cloud and then uploading the screenshots manually, until I came across ScreenCloud.
|
||||||
|
|
||||||
|
### ScreenCloud
|
||||||
|
|
||||||
|
ScreenCloud is cross-platform utility that provides easy screenshot capture and management along with flexible [cloud backup options][4]. including your own [FTP server][5].
|
||||||
|
|
||||||
|
![][6]
|
||||||
|
|
||||||
|
ScreenCloud is really streamlined with a lot of attention given to the smaller things. It provides you very easy to remember hotkeys to capture the full screen, the active window or capture an area selected with the mouse.
|
||||||
|
|
||||||
|
![][7]Default keyboard shortcuts for ScreenCloud
|
||||||
|
|
||||||
|
Once a screenshot is taken, you can either set ScreenCloud to ask what to do with the image or to directly upload it the cloud service of your choice. Even SFTP is supported. Once the screenshot it uploaded, generally within a couple of seconds, the link to the image is automatically copied to the clipboard, which you can easily share.
|
||||||
|
|
||||||
|
![][8]
|
||||||
|
|
||||||
|
You can also do some basic editing with ScreenCloud. For this, you should have “Save to” set to “Ask me”. This setting is available from the application indicator and is usually set by default. With this, when you take a screenshot, you’ll see the option for editing the file. Here, you can add arrows, text and numbers to the screenshot.
|
||||||
|
|
||||||
|
![Editing screenshots with ScreenCloud][9]Editing screenshots with ScreenCloud
|
||||||
|
|
||||||
|
### Installing ScreenCloud on Linux
|
||||||
|
|
||||||
|
ScreenCloud is available in the [Snap store][10]. So you can easily install it on Ubuntu and other [Snap enabled][11] distros by visiting the [Snap store][12] or by running the following command.
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo snap install screencloud
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
And for Linux distros which can’t install apps through Snap, You can download the AppImage [here][1]. The browse to the download location, right click and open a terminal there. Then run the command below.
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo chmod +x ScreenCloud-v1.4.0-x86_64.AppImage
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
You can then launch the app by double clicking on the downloaded file.
|
||||||
|
|
||||||
|
![][13]
|
||||||
|
|
||||||
|
### Wrapping up
|
||||||
|
|
||||||
|
Is ScreenCloud for everybody? Probably not. Is it better than the default screenshot? Probably yes. See if you’re taking a screenshot of something, then chances are, that it’s probably important or you intend to share it. ScreenCloud makes backing up or sharing that screenshot easier and considerably faster. So yeah, you should give ScreenCloud a try if you want these features.
|
||||||
|
|
||||||
|
Your thoughts and comments are always welcome, use the comments section below. And don’t forget to share this article with your friends. Cheers.
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://itsfoss.com/screencloud-app/
|
||||||
|
|
||||||
|
作者:[Aquil Roshan][a]
|
||||||
|
选题:[lujun9972](https://github.com/lujun9972)
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://itsfoss.com/author/aquil/
|
||||||
|
[1]: https://screencloud.net
|
||||||
|
[2]: https://itsfoss.com/take-screenshot-linux/
|
||||||
|
[3]: http://shutter-project.org
|
||||||
|
[4]: https://itsfoss.com/cloud-services-linux/
|
||||||
|
[5]: https://itsfoss.com/set-ftp-server-linux/
|
||||||
|
[6]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/09/screencloud3.jpg
|
||||||
|
[7]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/09/screencloud2.jpg
|
||||||
|
[8]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/09/ScrenCloud6.jpg
|
||||||
|
[9]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/09/editing-with-screencloud.png
|
||||||
|
[10]: https://snapcraft.io/
|
||||||
|
[11]: https://itsfoss.com/install-snap-linux/
|
||||||
|
[12]: https://snapcraft.io/screencloud
|
||||||
|
[13]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/09/ScrenCloud4.jpg
|
@ -1,118 +0,0 @@
|
|||||||
Getting started with the i3 window manager on Linux
|
|
||||||
======
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
In my article [5 reasons the i3 window manager makes Linux better][1], I shared the top five reasons I use and recommend the [i3 window manager][2] as an alternative Linux desktop experience.
|
|
||||||
|
|
||||||
In this post, I will walk through the installation and basic configuration of i3 on Fedora 28 Linux.
|
|
||||||
|
|
||||||
### 1\. Installation
|
|
||||||
|
|
||||||
Log into a Fedora workstation and open up a terminal. Use `dnf` to install the required package, like this:
|
|
||||||
```
|
|
||||||
[ricardo@f28i3 ~]$ sudo dnf install -y i3 i3-ipc i3status i3lock dmenu terminator --exclude=rxvt-unicode
|
|
||||||
Last metadata expiration check: 1:36:15 ago on Wed 08 Aug 2018 12:04:31 PM EDT.
|
|
||||||
Dependencies resolved.
|
|
||||||
================================================================================================
|
|
||||||
Package Arch Version Repository Size
|
|
||||||
================================================================================================
|
|
||||||
Installing:
|
|
||||||
dmenu x86_64 4.8-1.fc28 fedora 33 k
|
|
||||||
i3 x86_64 4.15-1.fc28 fedora 323 k
|
|
||||||
i3-ipc noarch 0.1.4-12.fc28 fedora 14 k
|
|
||||||
i3lock x86_64 2.9.1-2.fc28 fedora 33 k
|
|
||||||
i3status x86_64 2.12-1.fc28 updates 62 k
|
|
||||||
terminator noarch 1.91-4.fc28 fedora 570 k
|
|
||||||
Installing dependencies:
|
|
||||||
dzen2 x86_64 0.8.5-21.20100104svn.fc28 fedora 60 k
|
|
||||||
|
|
||||||
... Skipping dependencies/install messages
|
|
||||||
|
|
||||||
Complete!
|
|
||||||
[ricardo@f28i3 ~]$
|
|
||||||
```
|
|
||||||
|
|
||||||
**Note:** In this command, I'm explicitly excluding the package `rxvt-unicode` because I prefer `terminator` as my terminal emulator.
|
|
||||||
|
|
||||||
Depending on the status of your system, it may install many dependencies. Wait for the installation to complete successfully and then reboot your machine.
|
|
||||||
|
|
||||||
### 2. First login and initial setup
|
|
||||||
|
|
||||||
After your machine restarts, you're ready to log into i3 for the first time. In the GNOME Display Manager (GDM) screen, click on your username but—before typing the password to log in—click on the small gear icon and change the session to i3 instead of GNOME, like this:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
Type your password and click `Sign In`. On your first login, you are presented with the i3 configuration screen:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
Press `ENTER` to generate a config file in your `$HOME/.config/i3` directory. Later you can use this config file to further customize i3's behavior.
|
|
||||||
|
|
||||||
On the next screen, you need to select your `Mod` key. This is important, as the `Mod` key is used to trigger most of i3's keyboard shortcuts. Press `ENTER` to use the default `Win` key as the `Mod` key. If you don't have a `Win` key on your keyboard or prefer to use `Alt` instead, use the arrow key to select it and press `ENTER` to confirm.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
You're now logged into your i3 session. Because i3 is a minimalist window manager, you see a black screen with the status bar on the bottom:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
Next, let's look at navigating in i3.
|
|
||||||
|
|
||||||
### 3\. Basic shortcuts
|
|
||||||
|
|
||||||
Now that you're logged into an i3 session, you'll need a few basic keyboard shortcuts to get around.
|
|
||||||
|
|
||||||
The majority of i3 shortcuts use the `Mod` key you defined during the initial configuration. When I refer to `Mod` in the following examples, press the key you defined. This will usually be the `Win` key, but it can also be the `Alt` key.
|
|
||||||
|
|
||||||
First, to open up a terminal, use `Mod+ENTER`. Open more than one terminal and notice how i3 automatically tiles them to occupy all available space. By default, i3 splits the screen horizontally; use `Mod+v` to split vertically and press `Mod+h` to go back to the horizontal split.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
To start other applications, press `Mod+d` to open `dmenu`, a simple text-based application menu. By default, `dmenu` presents a list of all applications available on your `$PATH`. Select the application you want to start by using the arrow keys or narrow down the search by typing parts of the application's name. Press `ENTER` to start the selected application.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
If your application does not provide a way to close it, you can use i3 to kill a window by pressing `Mod+Shift+q`. Be careful, as you may lose unsaved work—this behavior depends on each application.
|
|
||||||
|
|
||||||
Finally, to end your session and exit i3, press `Mod+Shift+e`. You are presented with a confirmation message at the top of your screen. Click on `Yes, exit i3` to exit or `X` to cancel.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
This is just an initial list of shortcuts you can use to get around i3. For many more, consult i3's official [documentation][3].
|
|
||||||
|
|
||||||
### 4\. Replacing GDM
|
|
||||||
|
|
||||||
Using i3 window manager reduces the memory utilization on your system; however, Fedora still uses the default GDM as its login screen. GDM loads several GNOME-related libraries and applications that consume memory.
|
|
||||||
|
|
||||||
If you want to further reduce your system's memory utilization, you can replace GDM with a more lightweight display manager, such as `lightdm`, like this:
|
|
||||||
```
|
|
||||||
[ricardo@f28i3 ~]$ sudo dnf install -y lightdm
|
|
||||||
[ricardo@f28i3 ~]$ sudo systemctl disable gdm
|
|
||||||
Removed /etc/systemd/system/display-manager.service.
|
|
||||||
[ricardo@f28i3 ~]$ sudo systemctl enable lightdm
|
|
||||||
Created symlink /etc/systemd/system/display-manager.service -> /usr/lib/systemd/system/lightdm.service.
|
|
||||||
[ricardo@f28i3 ~]$
|
|
||||||
```
|
|
||||||
|
|
||||||
Restart your machine to see the Lightdm login screen.
|
|
||||||
|
|
||||||
Now you're ready to log in and use i3.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://opensource.com/article/18/8/getting-started-i3-window-manager
|
|
||||||
|
|
||||||
作者:[Ricardo Gerardi][a]
|
|
||||||
选题:[lujun9972](https://github.com/lujun9972)
|
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]: https://opensource.com/users/rgerardi
|
|
||||||
[1]: https://opensource.com/article/18/8/i3-tiling-window-manager
|
|
||||||
[2]: https://i3wm.org
|
|
||||||
[3]: https://i3wm.org/docs/userguide.html#_default_keybindings
|
|
@ -0,0 +1,117 @@
|
|||||||
|
在Linux上使用 i3 作为窗口管理器的入门教程
|
||||||
|
======
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
在我的文章[5 reasons the i3 window manager makes Linux better][1],我分享了选择 [i3 window manager][2] 作为一种Linux桌面替代方案的最主要五个理由。
|
||||||
|
在本篇文章中,我将向大家展示,如何在 Fedora 28 上安装与配置 i3。
|
||||||
|
|
||||||
|
### 1\. 安装
|
||||||
|
|
||||||
|
首先进入 Fedora 系统中,打开一个终端。使用 `dnf` 来安装需要的软件包,如下:
|
||||||
|
```
|
||||||
|
[ricardo@f28i3 ~]$ sudo dnf install -y i3 i3-ipc i3status i3lock dmenu terminator --exclude=rxvt-unicode
|
||||||
|
Last metadata expiration check: 1:36:15 ago on Wed 08 Aug 2018 12:04:31 PM EDT.
|
||||||
|
Dependencies resolved.
|
||||||
|
================================================================================================
|
||||||
|
Package Arch Version Repository Size
|
||||||
|
================================================================================================
|
||||||
|
Installing:
|
||||||
|
dmenu x86_64 4.8-1.fc28 fedora 33 k
|
||||||
|
i3 x86_64 4.15-1.fc28 fedora 323 k
|
||||||
|
i3-ipc noarch 0.1.4-12.fc28 fedora 14 k
|
||||||
|
i3lock x86_64 2.9.1-2.fc28 fedora 33 k
|
||||||
|
i3status x86_64 2.12-1.fc28 updates 62 k
|
||||||
|
terminator noarch 1.91-4.fc28 fedora 570 k
|
||||||
|
Installing dependencies:
|
||||||
|
dzen2 x86_64 0.8.5-21.20100104svn.fc28 fedora 60 k
|
||||||
|
|
||||||
|
... Skipping dependencies/install messages
|
||||||
|
|
||||||
|
Complete!
|
||||||
|
[ricardo@f28i3 ~]$
|
||||||
|
```
|
||||||
|
|
||||||
|
注意:在这个命令中,我排除了 `rxvt-unicode` 这个包,因为我更喜欢 `terminator` 作为我的终端模拟器。
|
||||||
|
|
||||||
|
据用户目前的系统状态,在命令执行过程中可能会安装很多依赖。等待所有的依赖安装完成,之后重启你的电脑。
|
||||||
|
|
||||||
|
### 2. 登录与初始化
|
||||||
|
|
||||||
|
在你的机器重启之后,你便可以第一次体验 i3 了。在 GNOME Display Manager (GDM),选择你的用户名,之后先别着急输密码,点击下方的密码输入框下方的小齿轮,之后选择 i3 ,像下方这样:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
输入你的密码,并点击 `Sign In`。在你第一次登入之后,会先看到 i3 的配置界面:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
点击 `ENTER` 就会在 `$HOME/.config/i3` 生成一个配置文件,之后你可以通过这个配置文件来定制化 i3's 的一些行为。
|
||||||
|
|
||||||
|
在下一屏,你需要选择你的 `Mod` 键。这一步很关键,因为 `Mod` 键通常都会作为 i3's 命令快捷键的发起键。按 `ENTER` 会选择 `Win` 键作为默认的 `Mod` 键。如果你的键盘没有 `Win` 键,用 `Alt` 键做替代,用方向键键选择后按 `ENTER` 确认。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
现在你就登录到了 i3 的系统中。由于 i3 是一个最小化的窗口管理器,你会看到一个黑屏窗口,以及屏幕底端显式的状态栏:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
接下来,让我们看看 i3 的如何实际使用。
|
||||||
|
|
||||||
|
### 3\. 基本的快捷键
|
||||||
|
|
||||||
|
现在你已经登录到了 i3 的会话中,你需要几个基本的快捷键来应对基本的操作。
|
||||||
|
|
||||||
|
大多数的 i3 快捷键都会用到之前配置的 `Mod` 键。在下面的例子中,当我提到 `Mod` 键,请根据情况使用你定义的做替换。通常使用 `Win` 键或者 `Alt` 键。
|
||||||
|
|
||||||
|
首先,打开一个终端,使用 `Mod+ENTER`。重复打开几个终端,观察 i3 是如何自动将它们在桌面中排列。默认情况下, i3 会在水平的方向分割屏幕;使用 `Mod + v` 来垂直分割,再按 `Mod + h` 会恢复水平分割模式。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
当需要启动其他的应用,按 `Mod + d` 来打开 `dmenu`,一个简单的文字应用菜单。默认情况下,`dmenu` 会呈现出所有在你 `$PATH` 中设置的应用。使用方向键来选择你想启动的应用,同时你可以键入应用的名称,来缩小选择的范围,之后按 `ENTER` 来启动选择的应用。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
如果你的应用没有提供退出的方法,你可以使用 i3 来关闭对应的窗口,通过按 `Mod + Shift +q`。注意,你可能会丢失未保存的工作内容。
|
||||||
|
|
||||||
|
最后,当你想关闭会话并退出 i3,按 `Mod + Shift +e`。之后会在窗口的上方提示你是否退出。点击 `Yes, exit i3` 退出,或选择 `X` 来取消。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
这些就是 i3 中最基本的快捷键,如果想了解更多,请查阅官方文档 [documentation][3]。
|
||||||
|
|
||||||
|
### 4\. 替换GDM
|
||||||
|
|
||||||
|
使用 i3 window manager 会降低你操作系统的内存占用;然而,Fedora 依然会使用 GDM 作为登录的窗口。GDM 会载入几个与 GNOME 相关的库从而占用内存。
|
||||||
|
|
||||||
|
如果你想进一步的降低你的内存占用,你可以使用一些更轻量级的窗口管理器来替换 GDM,比如 `lightdm`:
|
||||||
|
```
|
||||||
|
[ricardo@f28i3 ~]$ sudo dnf install -y lightdm
|
||||||
|
[ricardo@f28i3 ~]$ sudo systemctl disable gdm
|
||||||
|
Removed /etc/systemd/system/display-manager.service.
|
||||||
|
[ricardo@f28i3 ~]$ sudo systemctl enable lightdm
|
||||||
|
Created symlink /etc/systemd/system/display-manager.service -> /usr/lib/systemd/system/lightdm.service.
|
||||||
|
[ricardo@f28i3 ~]$
|
||||||
|
```
|
||||||
|
|
||||||
|
之后重启你的机器来使用 Lightdm 的登录界面。
|
||||||
|
|
||||||
|
现在你可以继续登录并使用 i3了。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/18/8/getting-started-i3-window-manager
|
||||||
|
|
||||||
|
作者:[Ricardo Gerardi][a]
|
||||||
|
选题:[lujun9972](https://github.com/lujun9972)
|
||||||
|
译者:[sd886393](https://github.com/sd886393)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://opensource.com/users/rgerardi
|
||||||
|
[1]: https://opensource.com/article/18/8/i3-tiling-window-manager
|
||||||
|
[2]: https://i3wm.org
|
||||||
|
[3]: https://i3wm.org/docs/userguide.html#_default_keybindings
|
Loading…
Reference in New Issue
Block a user