winapps - 在 Linux (Ubuntu/Fedora) 和 GNOME/KDE 中运行 Windows 应用程序,例如 Microsoft Office/Adobe,就好像它们是本机操作系统的一部分,包括 Nautilus 集成。

Created at: 2020-11-08 05:19:24
Language: Shell

适用于 Linux 的 WinApp

寻找维护者,见:https : //github.com/Fmstrat/winapps/issues/269

在 Linux (Ubuntu/Fedora) 和 GNOME/KDE 中运行 Windows 应用程序,例如 Microsoft Office/Adobe,就好像它们是本机操作系统的一部分一样,包括 Nautilus 集成,用于右键单击特定 mime 类型的文件以打开它们。

自豪地在发布当天成为r/linux 的头把交椅。

这个怎么运作

WinApps 被创建为一种简单的命令方式,可以将在 VM(或任何 RDP 服务器上)内运行的应用程序直接包含到 GNOME 中,就好像它们是本机应用程序一样。WinApps 的工作原理是:

  • 在后台 VM 容器中运行 Windows RDP 服务器
  • 检查 RDP 服务器是否安装了 Microsoft Office 等应用程序
  • 如果安装了这些程序,它会为 CLI 和 GNOME 托盘创建利用 FreeRDP 的快捷方式
  • 主目录中的文件可以通过
    \\tsclient\home
    虚拟机内的挂载访问
  • 你也可以右键单击主目录中的任何文件以使用应用程序打开

目前支持的应用

WinApps 支持你系统上安装的任何应用程序。

它通过以下方式做到这一点:

  1. 扫描你的系统以查找正式配置的应用程序(如下)
  2. 使用 Windows 注册表中的安装记录扫描你的系统中的任何其他 EXE 文件

任何正式配置的应用程序都将支持高分辨率图标和 mime 类型,以自动检测每个应用程序可以打开哪些文件。任何其他检测到的可执行文件都将利用从 EXE 中提取的图标。

注意:以下官方配置的应用程序列表是由社区提供的,因此某些应用程序可能未经 WinApps 团队测试。

Adobe Acrobat Pro
(X)
Adobe Acrobat Reader
(DC)
Adobe After Effects
(CC)
Adobe Audition
(CC)
Adobe Bridge
(CS6, CC)
Adobe 创意云
(CC)
Adobe Illustrator
(CC)
Adobe InDesign
(CC)
Adobe Lightroom
(CC)
Adobe Photoshop
(CS6, CC)
Adobe Premiere Pro
(CC)
Command Prompt
(cmd.exe)
Explorer
(File Manager)
Internet Explorer
(11)
Microsoft Access
(2016, 2019, o365)
Microsoft Excel
(2016, 2019, o365)
Microsoft Word
(2016, 2019, o365)
Microsoft OneNote
(2016, 2019, o365)
Microsoft Outlook
(2016, 2019, o365)
Microsoft PowerPoint
(2016, 2019, o365)
Microsoft Project
(2016, 2019, o365)
Microsoft Publisher
(2016, 2019, o365)
Powershell
(Standard, Core)
Visual Studio
(2019 - Ent|Pro|Com)
Windows
(Full RDP session)
   

Installation

Step 1: Set up a Windows Virtual Machine

The best solution for running a VM as a subsystem for WinApps would be KVM. KVM is a CPU and memory-efficient virtualization engine bundled with most major Linux distributions. To set up the VM for WinApps, follow this guide:

If you already have a Virtual Machine or server you wish to use with WinApps, you will need to merge

kvm/RDPApps.reg
into the VM's Windows Registry. If this VM is in KVM and you want to use auto-IP detection, you will need to name the machine
RDPWindows
. Directions for both of these can be found in the guide linked above.

Step 2: Download the repo and prerequisites

To get things going, use:

sudo apt-get install -y freerdp2-x11
git clone https://github.com/Fmstrat/winapps.git
cd winapps

Step 3: Creating your WinApps configuration file

You will need to create a

~/.config/winapps/winapps.conf
configuration file with the following information in it:

RDP_USER="MyWindowsUser"
RDP_PASS="MyWindowsPassword"
#RDP_DOMAIN="MYDOMAIN"
#RDP_IP="192.168.123.111"
#RDP_SCALE=100
#RDP_FLAGS=""
#MULTIMON="true"
#DEBUG="true"

The username and password should be a full user account and password, such as the one created when setting up Windows or a domain user. It cannot be a user/PIN combination as those are not valid for RDP access.

Options:

  • When using a pre-existing non-KVM RDP server, you can use the
    RDP_IP
    to specify it's location
  • If you are running a VM in KVM with NAT enabled, leave
    RDP_IP
    commented out and WinApps will auto-detect the right local IP
  • For domain users, you can uncomment and change
    RDP_DOMAIN
  • On high-resolution (UHD) displays, you can set
    RDP_SCALE
    to the scale you would like [100|140|160|180]
  • To add flags to the FreeRDP call, such as
    /audio-mode:1
    to pass in a mic, use the
    RDP_FLAGS
    configuration option
  • For multi-monitor setups, you can try enabling
    MULTIMON
    , however if you get a black screen (FreeRDP bug) you will need to revert back
  • If you enable
    DEBUG
    , a log will be created on each application start in
    ~/.local/share/winapps/winapps.log

Step 4: Run the WinApps installer

Lastly, check that FreeRDP can connect with:

bin/winapps check

You will see output from FreeRDP, as well as potentially have to accept the initial certificate. After that, a Windows Explorer window should pop up. You can close this window and press

Ctrl-C
to cancel out of FreeRDP.

If this step fails, try restarting the VM, or your problem could be related to:

  • You need to accept the security cert the first time you connect (with 'check')
  • Not enabling RDP in the Windows VM
  • Not being able to connect to the IP of the VM
  • Incorrect user credentials in
    ~/.config/winapps/winapps.conf
  • 不合并
    install/RDPApps.reg
    到虚拟机

然后最后一步是运行安装程序,它会提示你进行系统或用户安装:

./installer.sh

这将带你完成以下过程:

添加预定义的应用程序

将带有自定义图标和 mime 类型的应用程序添加到安装程序很容易。只需复制

apps
文件夹中的应用程序配置之一,然后:

  • 编辑应用程序的变量
  • 将 替换
    icon.svg
    为应用程序的 SVG(适当许可)
  • 重新运行安装程序
  • 提交 Pull Request 正式添加到 WinApps

运行安装程序时,它会检查是否安装了任何配置的应用程序,如果安装了,它将在主机操作系统上创建适当的快捷方式。

手动运行应用程序

WinApps 为运行未配置的应用程序提供了手动模式。这是用

manual
标志完成的。路径中的可执行文件不需要完整路径定义。

./bin/winapps manual "C:\my\directory\executableNotInPath.exe"
./bin/winapps manual executableInPath.exe

检查新的应用程序支持

安装程序可以多次运行,因此只需再次运行以下命令,它将删除所有当前安装并更新最新应用程序。

./installer.sh

可选的安装程序命令行参数

以下可选命令可用于在没有提示的情况下管理你的应用程序配置:

./installer.sh --user                # Configure applications for the current user
./installer.sh --system              # Configure applications for the entire system
./installer.sh --user --uninstall    # Remove all configured applications for the current user
./installer.sh --system --uninstall  # Remove all configured applications for the entire system

常见问题

  • 黑窗:这是一个有时会出现的 FreeRDP 错误。尝试重新启动应用程序或重新运行命令。如果这不起作用,请确保你已
    MULTIMON
    禁用。

大喊大叫