diff --git a/sources/tech/20200124 Run multiple consoles at once with this open source window environment.md b/sources/tech/20200124 Run multiple consoles at once with this open source window environment.md deleted file mode 100644 index 91d5ef0fa0..0000000000 --- a/sources/tech/20200124 Run multiple consoles at once with this open source window environment.md +++ /dev/null @@ -1,115 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Run multiple consoles at once with this open source window environment) -[#]: via: (https://opensource.com/article/20/1/multiple-consoles-twin) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -Run multiple consoles at once with this open source window environment -====== -Simulate the old-school DESQview experience with twin in the fourteenth -in our series on 20 ways to be more productive with open source in 2020. -![Digital creative of a browser on the internet][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### Overcome "one screen, one app" limits with twin - -Who remembers [DESQview][2]? It allowed for things in DOS we take for granted now in Windows, Linux, and MacOS—namely the ability to run and have multiple programs running onscreen at once. In my early days running a dial-up BBS, DESQview was a necessity—it enabled me to have the BBS running in the background while doing other things in the foreground. For example, I could be working on new features or setting up new external programs while someone was dialed in without impacting their experience. Later, in my early days in support, I could have my work email ([DaVinci email on MHS][3]), the support ticket system, and other DOS programs running all at once. It was amazing! - -![twin][4] - -Running multiple console applications has come a long way since then. But applications like [tmux][5] and [Screen][6] still follow the "one screen, one app" kind of display. OK, yes, tmux has screen splitting and panes, but not like DESQview, with the ability to "float" windows over others, and I, for one, miss that. - -Enter [twin][7], the text-mode window environment. This relatively young project is, in my opinion, a spiritual successor to DESQview. It supports console and graphical environments, as well as the ability to detach from and reattach to sessions. It's not as easy to set up as some things, but it will run on most modern operating systems. - -Twin is installed from source (for now). But first, you need to install the required development libraries. The library names will vary by operating system. The following example shows it for my Ubuntu 19.10 installation. Once the libraries are installed, check out the twin source from Git and run **./configure** and **make**, which should auto-detect everything and build twin: - - -``` -sudo apt install libx11-dev libxpm-dev libncurses-dev zlib1g-dev libgpm-dev -git clone [git@github.com][8]:cosmos72/twin.git -cd twin -./configure -make -sudo make install -``` - -Note: If you are compiling this on MacOS or BSD, you will need to comment out **#define socklen_t int** in the files **include/Tw/autoconf.h** and **include/twautoconf.h** before running **make**. This should be addressed by [twin issue number 57][9]. - -![twin text mode][10] - -Invoking twin for the first time can be a bit of a challenge. You need to tell it what kind of display it is using with the **\--hw** parameter. For example, to launch a text-mode version of twin, you would enter **twin --hw=tty,TERM=linux**. The **TERM** variable specifies an override to the current terminal variable in your shell. To launch a graphical version, run **twin --hw=X@$DISPLAY**. On Linux, twin mostly "just works," and on MacOS, it mostly only works in terminals. - -The _real_ fun comes with the ability to attach to running sessions with the **twattach** and **twdisplay** commands. They allow you to attach to a running twin session somewhere else. For example, on my Mac, I can run the following command to connect to the twin session running on my demo box: - - -``` -`twdisplay --twin@20days2020.local:0 --hw=tty,TERM=linux` -``` - -![remote twin session][11] - -With some extra work, you can also use it as a login shell in place of [getty][12] on consoles. This requires the gdm mouse daemon, the twdm application (included), and a little extra configuration. On systems that use systemd, start by installing and enabling gdm (if it isn't already installed). Then use systemctl to create an override for a console (I used tty6). The commands must be run as the root user; on Ubuntu, they look something like this: - - -``` -apt install gdm -systemctl enable gdm -systemctl start gdm -systemctl edit getty@tty6 -``` - -The **systemctl edit getty@tty6** command will open an empty file named **override.conf**. This defines systemd service settings to override the default for console 6. Update the contents to: - - -``` -[service] -ExecStart= -ExecStart=-/usr/local/sbin/twdm --hw=tty@/dev/tty6,TERM=linux -StandardInput=tty -StandardOutput=tty -``` - -Now, reload systemd and restart tty6 to get a twin login prompt: - - -``` -systemctl daemon-reload -systemctl restart getty@tty6 -``` - -![twin][13] - -This will launch a twin session for the user who logs in. I do not recommend this for a multi-user system, but it is pretty cool for a personal desktop. And, by using **twattach** and **twdisplay**, you can access that session from the local GUI or remote desktops. - -I think twin is pretty darn cool. It has some rough edges, but the basic functionality is there, and it has some pretty good documentation. Also, it scratches the itch I have for a DESQview-like experience on modern operating systems. I look forward to improvements over time, and I hope you like it as much as I do. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/multiple-consoles-twin - -作者:[Kevin Sonney][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://opensource.com/users/ksonney -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) -[2]: https://en.wikipedia.org/wiki/DESQview -[3]: https://en.wikipedia.org/wiki/Message_Handling_System -[4]: https://opensource.com/sites/default/files/uploads/productivity_14-1.png (twin) -[5]: https://github.com/tmux/tmux/wiki -[6]: https://www.gnu.org/software/screen/ -[7]: https://github.com/cosmos72/twin -[8]: mailto:git@github.com -[9]: https://github.com/cosmos72/twin/issues/57 -[10]: https://opensource.com/sites/default/files/uploads/productivity_14-2.png (twin text mode) -[11]: https://opensource.com/sites/default/files/uploads/productivity_14-3.png (remote twin session) -[12]: https://en.wikipedia.org/wiki/Getty_(Unix) -[13]: https://opensource.com/sites/default/files/uploads/productivity_14-4.png (twin) diff --git a/translated/tech/20200124 Run multiple consoles at once with this open source window environment.md b/translated/tech/20200124 Run multiple consoles at once with this open source window environment.md new file mode 100644 index 0000000000..5ff4e84e64 --- /dev/null +++ b/translated/tech/20200124 Run multiple consoles at once with this open source window environment.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Run multiple consoles at once with this open source window environment) +[#]: via: (https://opensource.com/article/20/1/multiple-consoles-twin) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +使用此开源窗口环境一次运行多个控制台 +====== + +> 在我们的 20 个使用开源提升生产力的系列的第十四篇文章中用 twin 模拟了老式的 DESQview 体验。 + +![Digital creative of a browser on the internet][1] + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 + +### 通过 twin 克服“一个屏幕,一个应用程序”的限制 + +还有人记得 [DESQview][2] 吗?我们在 Windows、Linux 和 MacOS 中理所当然地可以在屏幕上同时运行多个程序,而它赋予了 DOS 同样的功能。在我运营拨号 BBS 服务的初期,DESQview 是必需的,它使我能够使 BBS 在后台运行,同时在前台进行其他操作。例如,当有人拨打电话时,我可能正在开发新功能或设置新的外部程序而不会影响他们的体验。后来,在我早期支持的时候,我可以同时运行我的工作电子邮件([MHS 上的 DaVinci 电子邮件] [3])、支持票证系统和其他 DOS 程序。这是令人吃惊的! + +![twin][4] + +从那时起,运行多个控制台应用程序的功能已经发展了很多。但是 [tmux][5] 和 [Screen][6] 等应用仍然遵循“一个屏幕,一个应用”的显示方式。好吧,是的,tmux 具有屏幕拆分和窗格,但是不像 DESQview 那样具有将窗口“浮动”在其他窗口上的功能,就我个人而言,我怀念那个功能。 + +让我们来看看 [twin][7](文本模式窗口环境)。我认为,这个相对年轻的项目是 DESQview 的精神继任者。它支持控制台和图形环境,并具有与会话脱离和重新接驳的功能。设置起来并是那么容易,但是它可以在大多数现代操作系统上运行。 + +Twin 是从源代码安装的(现在是这样)。但是首先,你需要安装所需的开发库。库名称将因操作系统而异。 以下示例显示了在我的 Ubuntu 19.10 系统中的情况。一旦安装了依赖库,请从 Git 中检出 twin 源代码,并运行 `./configure` 和 `make`,它们应自动检测所有内容并构建 twin: + +``` +sudo apt install libx11-dev libxpm-dev libncurses-dev zlib1g-dev libgpm-dev +git clone git@github.com:cosmos72/twin.git +cd twin +./configure +make +sudo make install +``` + +注意:如果要在 MacOS 或 BSD 上进行编译,则需要在运行 `make` 之前在文件 `include/Tw/autoconf.h` 和 `include/twautoconf.h` 中注释掉 `#define socklen_t int`。这应该在 [twin #57][9] 解决了。 + +![twin text mode][10] + +第一次调用 twin 是一个挑战。你需要通过 `--hw` 参数告诉它正在使用哪种显示。例如,要启动文本模式的 twin,请输入 `twin --hw=tty,TERM=linux`。这里 `TERM` 变量指定替代了你当前 Shell 中终端变量。要启动图形版本,运行 `twin --hw=X@$DISPLAY`。在 Linux 上,twin 一般都“可以正常工作”,而在 MacOS 上,Twin 基本是只能在终端上使用。 + +*真正*的乐趣是可以通过 `twattach` 和 `twdisplay` 命令接驳到正在运行的会话的功能。它们使你可以接驳到其他正在运行的 twin 会话。例如,在 Mac 上,我可以运行以下命令以接驳到演示机器上运行的 twin 会话: + +``` +twdisplay --twin@20days2020.local:0 --hw=tty,TERM=linux +``` + +![remote twin session][11] + +通过多做一些工作,你还可以将其用作登录外壳,以代替控制台上的 [getty][12]。这需要 gdm 鼠标守护程序、twdm 应用程序(包括)和一些额外的配置。在使用 systemd 的系统上,首先安装并启用 gdm(如果尚未安装),然后使用 `systemctl` 为控制台创建一个替代(我使用 tty6)。这些命令必须以 root 用户身份运行;在 Ubuntu 上,它们看起来像这样: + +``` +apt install gdm +systemctl enable gdm +systemctl start gdm +systemctl edit getty@tty6 +``` + +`systemctl edit getty@tty6` 命令将打开一个名为 `override.conf` 的空文件。它可以定义 systemd 服务设置以覆盖 6 号控制台的默认设置。将内容更新为: + +``` +[service] +ExecStart= +ExecStart=-/usr/local/sbin/twdm --hw=tty@/dev/tty6,TERM=linux +StandardInput=tty +StandardOutput=tty +``` + +现在,重新加载 systemd 并重新启动 tty6 以获得 twin 登录提示: + +``` +systemctl daemon-reload +systemctl restart getty@tty6 +``` + +![twin][13] + +这将为登录的用户启动一个 twin 会话。我不建议在多用户系统中使用此会话,但是对于个人桌面来说,这是很酷的。并且,通过使用 `twattach` 和 `twdisplay`,你可以从本地 GUI 或远程桌面访问该会话。 + +我认为 twin 真是太酷了。它还有一些细节不够好,但是基本功能都已经有了,并且有一些非常好的文档。另外,它也使我可以在现代操作系统上稍解 DESQview 式的体验的渴望。我希望随着时间的推移它会有所改进,希望你和我一样喜欢它。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/multiple-consoles-twin + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) +[2]: https://en.wikipedia.org/wiki/DESQview +[3]: https://en.wikipedia.org/wiki/Message_Handling_System +[4]: https://opensource.com/sites/default/files/uploads/productivity_14-1.png (twin) +[5]: https://github.com/tmux/tmux/wiki +[6]: https://www.gnu.org/software/screen/ +[7]: https://github.com/cosmos72/twin +[8]: mailto:git@github.com +[9]: https://github.com/cosmos72/twin/issues/57 +[10]: https://opensource.com/sites/default/files/uploads/productivity_14-2.png (twin text mode) +[11]: https://opensource.com/sites/default/files/uploads/productivity_14-3.png (remote twin session) +[12]: https://en.wikipedia.org/wiki/Getty_(Unix) +[13]: https://opensource.com/sites/default/files/uploads/productivity_14-4.png (twin)