Merge pull request #16781 from geekpi/translating

Translated
This commit is contained in:
geekpi 2019-12-24 08:51:04 +08:00 committed by GitHub
commit 705c69acae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 219 additions and 221 deletions

View File

@ -1,220 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Build a retro Apple desktop with the Linux MLVWM)
[#]: via: (https://opensource.com/article/19/12/linux-mlvwm-desktop)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
Build a retro Apple desktop with the Linux MLVWM
======
This article is part of a special series of 24 days of Linux desktops.
What if old-school Apple computers were built around open source POSIX?
You can find out by building the Macintosh-like Virtual Window Manager.
![Person typing on a 1980's computer][1]
Imagine traveling into an alternate history where the Apple II GS and MacOS 7 were built upon open source [POSIX][2], using all the same conventions as modern Linux, like plain-text configuration files and modular system design. What would such an OS have enabled for its users? You can answer these questions (and more!) with the [Macintosh-like Virtual Window Manager (MLVWM)][3].
![MLVWM running on Slackware 14.2][4]
### Installing MLVWM
MLVWM is not an easy installation, and it's probably not in your distribution's software repository. If you have the time to decipher a poorly translated README file, edit some configuration files, gather and resize some old **.xpm** images, and edit an Xorg preference or two, then you can experience MLVWM. Otherwise, this is a novelty window manager with its latest release back in 2000.
To compile MLVWM, you must have **imake** installed, which provides the **xmkmf** command. You can install imake from your distribution's software repository, or get it directly from [Freedesktop.org][5]. Assuming you have the **xmkmf** command, change into the directory containing the MLVWM source code, and run these commands to build it:
```
$ xmkmf -a
$ make
```
After building, the compiled **mlvwm** binary is located in the **mlvwm** directory. Move it to any location [in your path][6] to install it:
```
`$ mv mlvwm/mlvwm /usr/local/bin/`
```
#### Editing the config files
MLVWM is now installed, but it won't launch correctly without adjusting several configuration files and carefully arranging required image files. Sample config files are located in the **sample_rc** directory of the source code you downloaded. Copy the files **Mlvwm-Netscape** and **Mlvwm-Xterm** to your home directory:
```
`$ cp sample_rc/Mlvwm-{Netscape,Xterm} $HOME`
```
Move the **Mlvwmrc** file to **$HOME/.mlvwmrc** (yes, you must use a lower-case "m" even though the sample file deceptively begins with a capital letter):
```
`$ cp sample_rc/Mlvwmrc $HOME/.mlvwmrc`
```
Open **.mlwmrc** and find lines 5455, which define the path (the "IconPath") for the pixmap images that MLVWM uses in its menus and UI:
```
# Set icon search path. It needs before "Style".
IconPath /usr/local/include/X11/pixmaps:/home2/tak/bin/pixmap
```
Adjust the path to match a directory you will fill with your own images (I suggest using **$HOME/.local/share/pixmaps**). MLVWM doesn't provide pixmaps, so it's up to you to provide pixmap icons for the desktop you're building.
Do this even if you have pixmaps located elsewhere on your system (such as **/usr/share/pixmaps**), because you're going to have to adjust the size of the pixmaps, and you probably don't want to do that on a system-wide level.
```
# Set icon search path. It needs before "Style".
IconPath /home/seth/.local/share/pixmaps
```
#### Choosing the pixmaps
You've defined the **.local/share/pixmaps** directory as the source of pixmaps, but neither the directory nor the images exist yet. Create the directory:
```
`$ mkdir -p $HOME/.local/share/pixmaps`
```
Right now, the config file assigns images to menu entries and UI elements, but none of those images exist on your system. To fix this, read through the configuration file and locate every **.xpm** image. For each image listed in the config, add an image with the same file name (or change the file name in the config file) to your IconPath directory.
The **.mlvwmrc** file is well commented, so you can get a general idea of what you're editing. This is just a first pass, anyway. You can always come back and change the look of your desktop later.
Here are some examples.
This code block sets the icon in the upper-left corner of the screen:
```
# Register the menu
Menu Apple, Icon label1.xpm, Stick
```
The **label1.xpm** image is actually provided in the source code download's **pixmap** directory, but I prefer to use **Penguin.xpm** from **/usr/share/pixmaps** (on Slackware). Whatever you use, you must place your custom pixmap in **~/.local/share/pixmaps** and either change the pixmap's name in the configuration or rename the pixmap file to match what's currently in the config file.
This code block defines the applications listed in the left menu:
```
"About this Workstation..." NonSelect, Gray, Action About
"" NonSelect
"Terminal"      Icon mini-display.xpm, Action Exec "kterm" exec kterm -ls
"Editor"  Action Exec "mule" exec mule, Icon mini-edit.xpm
"calculator" Action Exec "xcal" exec xcalc, Icon mini-calc.xpm
END
```
By following the same syntax as what you see in the configuration file, you can customize the pixmaps and add your own applications to the menu (for instance, I changed **mule** to **emacs**). This is your gateway to your applications in the MLVWM GUI, so list everything you want quick access to. You may also wish to include a shortcut to your **/usr/share/applications** folder.
```
`"Applications" Icon Penguin.xpm, Action Exec "thunar /usr/share/applications" exec thunar /usr/share/applications`
```
Once you're finished editing the configuration file and adding your own images to your IconPath directory, your pixmaps must all be resized to roughly 16x16 pixels. (MLVWM isn't consistent in its defaults, so there's room for variation.) You can do this as a bulk action using ImageMagick:
```
`$ for i in ~/.local/share/mlvwm-pixmaps/*xpm ; do convert -resize '16x16^' $i; done`
```
### Starting MLVWM
The easiest way to get up and running with MLVWM is to let Xorg do the bulk of the work. First, you must create a **$HOME/.xinitrc** file. I borrowed this one from Slackware, which borrowed it from Xorg:
```
#!/bin/sh
# $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap
# merge in defaults and keymaps
if [ -f $sysresources ]; then
    xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi
if [ -f $userresources ]; then
    xrdb -merge $userresources
fi
if [ -f $usermodmap ]; then
    xmodmap $usermodmap
fi
# Start the window manager:
if [ -z "$DESKTOP_SESSION" -a -x /usr/bin/ck-launch-session ]; then
  exec ck-launch-session /usr/local/bin/mlvwm
else
  exec /usr/local/bin/mlvwm
fi
```
According to this file, the default action for the **startx** command is to launch MLVWM. However, your distribution may have other ideas about what happens when your graphic server launches (or is killed to be restarted), so this file may do you little good. On many distributions, you can add a **.desktop** file to **/usr/share/xsessions** to have it listed in the GDM or KDM menu, so create a file called **mlvwm.desktop** and enter this text:
```
[Desktop Entry]
Name=Mlvwm
Comment=Macintosh-like virtual window manager
Exec=/usr/local/bin/mlvwm
TryExec=ck-launch-session /usr/local/bin/mlvwm
Type=Application
```
Log out from your desktop session and log back into MLVWM. By default, your session manager (KDM, GDM, or LightDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in.
With GDM:
![][7]
With SDDM:
![][8]
#### Launching with brute force
If MLVWM fails to start, try installing XDM, a lightweight session manager that doesn't look at **/usr/share/xsessions** and instead just does whatever the authenticated user's **.xinitrc** proscribes.
![MLVWM][9]
### Build your own retro Apple
The MLVWM desktop is unpolished, imperfect, accurate, and loads of fun. Many of the menu options you see are unimplemented, but you can make them active and meaningful.
This is your chance to step back in time, change history, and make the old-school Apple line of computers a bastion of open source. Be a revisionist, design your own retro Apple desktop, and, most importantly, have fun.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/linux-mlvwm-desktop
作者:[Seth Kenlon][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/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer)
[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains
[3]: http://www2u.biglobe.ne.jp/~y-miyata/mlvwm.html
[4]: https://opensource.com/sites/default/files/uploads/advent-mlvwm-file.jpg (MLVWM running on Slackware 14.2)
[5]: http://cgit.freedesktop.org/xorg/util/imake
[6]: https://opensource.com/article/17/6/set-path-linux
[7]: https://opensource.com/sites/default/files/advent-gdm_2.jpg
[8]: https://opensource.com/sites/default/files/advent-kdm_1.jpg
[9]: https://opensource.com/sites/default/files/uploads/advent-mlvwm-chess.jpg (MLVWM)

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -0,0 +1,218 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Build a retro Apple desktop with the Linux MLVWM)
[#]: via: (https://opensource.com/article/19/12/linux-mlvwm-desktop)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
使用 Linux MLVWM 打造复古苹果桌面
======
本文是 24 天 Linux 桌面特别系列的一部分。如果老式的苹果电脑用开源 POSIX 构建如何?你可以通过构建类 Macintosh 虚拟窗口管理器来实现。
![Person typing on a 1980's computer][1]
想象一下进入另外一个历史Apple II GS 和 MacOS 7 是基于开源 [POSIX][2] 构建的,它使用了与现代 Linux 相同的所有约定,例如纯文本配置文件和模块化系统设计。这样的操作系统将为其用户带来什么?你可以使用[类 Macintosh 虚拟窗口管理器MLVWM][3]来回答这些问题(甚至更多!)。
![MLVWM running on Slackware 14.2][4]
### 安装 MLVWM
MLVWM 安装并不容易,并且可能不在发行版的软件仓库中。如果你有时间理解翻译不佳的 README 文件,编辑一些配置文件,收集并调整一些旧的 **.xpm**图像,编辑一两个 Xorg 选项,那么你就可以体验 MLVWM。否则这是一个新奇的窗口管理器其最新版本可以追溯到 2000 年。
要编译 MLVWM你必须安装 **imake**,它提供 **xmkmf** 命令。你可以从发行版的软件仓库中安装 imake也可以直接从 [Freedesktop.org][5] 获得。假设你已经有 **xmkmf**命令,请进入包含 MLVWM 源码的目录,然后运行以下命令进行构建:
```
$ xmkmf -a
$ make
```
构建后,编译后的 **mlvwm** 二进制文件位于 **mlvwm** 目录中。将其移动到[你的 PATH ][6]的任何位置:
```
`$ mv mlvwm/mlvwm /usr/local/bin/`
```
#### 编辑配置文件
现在已经安装 MLVWM但是如果不调整几个配置文件并仔细排列所需的图像文件它将无法正确启动。示例配置文件位于你下载的源代码的 **sample_rc** 目录中。将文件 **Mlvwm-Netscape****Mlvwm-Xterm** 复制到你的主目录:
```
`$ cp sample_rc/Mlvwm-{Netscape,Xterm} $HOME`
```
**Mlvwmrc** 移动到 **$HOME/.mlvwmrc**(是的,即使示例文件的名称看似是大写字母,但你也必须使用小写的 “m”
```
`$ cp sample_rc/Mlvwmrc $HOME/.mlvwmrc`
```
打开 **.mlwmrc** 并找到第 54-55 行,它们定义了 MLVWM 在菜单和 UI 中使用的像素图的路径“IconPath”
```
# Set icon search path. It needs before "Style".
IconPath /usr/local/include/X11/pixmaps:/home2/tak/bin/pixmap
```
调整路径以匹配你填充图像的路径(我建议使用 **$HOME/.local/share/pixmaps**。MLVWM 不提供像素图,因此需要你提供构建桌面所需图标。
即使你有位于系统其他位置的像素图(例如 **/usr/share/pixmaps**)),也要这样做,因为你需要调整像素图的大小,你可能也不想在系统范围内执行此操作。
```
# Set icon search path. It needs before "Style".
IconPath /home/seth/.local/share/pixmaps
```
#### 选择像素图
你已将 **.local/share/pixmaps** 目录定义为像素图源路径,但是该目录和图像均不存在。创建目录:
```
`$ mkdir -p $HOME/.local/share/pixmaps`
```
现在,配置文件将图像分配给菜单项和 UI 元素,但是系统中不存在这些图像。要解决此问题,请通读配置文件并找到每个 **.xpm** 图像。对于配置中列出的每个图像,将具有相同文件名的图像(或更改配置文件中的文件名)添加到你的 IconPath 目录。
**.mlvwmrc** 文件的注释很好,因此你可以大致了解要编辑的内容。无论如何,这只是第一步。你可以随时回来更改桌面外观。
这有些例子
此代码块设置屏幕左上角的图标:
```
# Register the menu
Menu Apple, Icon label1.xpm, Stick
```
**label1.xpm** 图像实际上在源代码的 **pixmap**目录中,但我更喜欢使用来自 **/usr/share/pixmaps** 的 **Penguin.xpm**(在 Slackware 上)。无论使用什么,都必须将自定义像素图放在 **~/.local/share/pixmaps** 中,并在配置中更改像素图的名称,或者重命名像素图以匹配配置文件中当前的名称。
此代码块定义了左侧菜单中列出的应用:
```
"About this Workstation..." NonSelect, Gray, Action About
"" NonSelect
"Terminal"      Icon mini-display.xpm, Action Exec "kterm" exec kterm -ls
"Editor"  Action Exec "mule" exec mule, Icon mini-edit.xpm
"calculator" Action Exec "xcal" exec xcalc, Icon mini-calc.xpm
END
```
通过遵循与配置文件中相同的语法,你可以自定义像素图并将自己的应用添加到菜单中(例如,我将 **mule** 更改为 **emacs**)。 这是你在 MLVWM GUI 中打开应用的入口,因此请列出你要快速访问的所有内容。你可能还希望包括指向 **/usr/share/applications** 文件夹的快捷方式。
```
`"Applications" Icon Penguin.xpm, Action Exec "thunar /usr/share/applications" exec thunar /usr/share/applications`
```
完成编辑配置文件并将自己的图像添加到 IconPath 目录后,必须将所有像素图的大小都调整为大约 16x16 像素。MLVWM 的默认设置不一致,因此存在变化空间。)你可以使用 ImageMagick 进行批量操作:
```
`$ for i in ~/.local/share/mlvwm-pixmaps/*xpm ; do convert -resize '16x16^' $i; done`
```
### 启动 MLVWM
最简单的运行 MLVWM 的方式是让 Xorg 完成大部分工作。首先,你必须创建一个 **$HOME/.xinitrc** 文件。我从 Slackware 复制了这个,它也是从 Xorg 来的:
```
#!/bin/sh
# $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap
# merge in defaults and keymaps
if [ -f $sysresources ]; then
    xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi
if [ -f $userresources ]; then
    xrdb -merge $userresources
fi
if [ -f $usermodmap ]; then
    xmodmap $usermodmap
fi
# Start the window manager:
if [ -z "$DESKTOP_SESSION" -a -x /usr/bin/ck-launch-session ]; then
  exec ck-launch-session /usr/local/bin/mlvwm
else
  exec /usr/local/bin/mlvwm
fi
```
根据此文件,**startx** 命令的默认操作是启动 MLVWM。但是你的发行版可能对于图形服务器启动或被终止重新启动时会发生的情况有其他做法因此此文件可能对你没有什么帮助。在许多发行版上你可以添加 **.desktop** 文件到 **/usr/share/xsessions** 中,以将其列在 GDM 或 KDM 菜单中,因此创建名为 **mlvwm.desktop** 的文件并输入:
```
[Desktop Entry]
Name=Mlvwm
Comment=Macintosh-like virtual window manager
Exec=/usr/local/bin/mlvwm
TryExec=ck-launch-session /usr/local/bin/mlvwm
Type=Application
```
从桌面会话注销并重新登录到 MLVWM。默认情况下会话管理器KDM、GDM 或 LightDM具体取决于你的设置将继续登录到以前的桌面因此在登录之前必须覆盖它。
对于 GDM
![][7]
对于 SDDM
![][8]
#### 强制启动
如果 MLVWM 无法启动,请尝试安装 XDM这是一个轻量级会话管理器它不会查询 **/usr/share/xsessions** 的内容,而是执行经过身份验证用户的所有 **.xinitrc** 操作。
![MLVWM][9]
### 打造自己的复古苹果
MLVWM 桌面未经打磨、不完美、准确且充满乐趣。你看到的许多菜单项都是未实现的,但你可以使它们变得活跃且有意义。
这是一次让你时光倒流,改变历史,让老式苹果系列电脑成为开源堡垒的机会。成为一名修正主义者,设计你自己的复古苹果桌面,最重要的是,它有乐趣。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/linux-mlvwm-desktop
作者:[Seth Kenlon][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://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer)
[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains
[3]: http://www2u.biglobe.ne.jp/~y-miyata/mlvwm.html
[4]: https://opensource.com/sites/default/files/uploads/advent-mlvwm-file.jpg (MLVWM running on Slackware 14.2)
[5]: http://cgit.freedesktop.org/xorg/util/imake
[6]: https://opensource.com/article/17/6/set-path-linux
[7]: https://opensource.com/sites/default/files/advent-gdm_2.jpg
[8]: https://opensource.com/sites/default/files/advent-kdm_1.jpg
[9]: https://opensource.com/sites/default/files/uploads/advent-mlvwm-chess.jpg (MLVWM)