VMware 虚拟机安装 Arch Linux + Hyprland

kamisamak 发布于 2025-10-04 39 次阅读


image-20260131221335345a8fe118a891fec9c867594329677096e1808164
a44b5c7f6efea5a813e5803a7b00fb631808164


前言

本文记录了我从零开始在 VMware Workstation 上安装 Arch Linux + Hyprland,并进行部分美化的全过程。


1. 基础环境与 AUR 配置

进入 Arch 系统后,首先解决国内网络环境下安装软件慢的问题,特别是 Go 语言编写的工具(如 yay)。

# 1. 更新系统并安装基础开发包
sudo pacman -Syu git base-devel

# 2. 设置 Go 代理(加速 yay 编译)
export GO111MODULE=on
export GOPROXY=[https://goproxy.cn](https://goproxy.cn),direct

# 3. 安装 yay (AUR 助手)
git clone [https://aur.archlinux.org/yay.git](https://aur.archlinux.org/yay.git)
cd yay
makepkg -si
cd ..

2. 安装 Hyprland 及核心组件

安装 Hyprland 本体以及必要的 Wayland 周边工具。

# 核心组件安装
# mesa: 3D 驱动
# open-vm-tools: 虚拟机增强工具
# kitty: 终端
# waybar: 状态栏
# sddm: 登录管理器
# swww: 动态壁纸服务
# fastfetch: 系统信息展示
# starship: 命令行提示符美化

sudo pacman -S hyprland mesa open-vm-tools kitty waybar wofi dolphin \
    dunst pipewire wireplumber qt5-wayland qt6-wayland polkit-kde-agent \
    ttf-jetbrains-mono-nerd noto-fonts-cjk sddm fastfetch starship

# 使用 yay 安装 swww (如果 git 慢,会自动走代理)
yay -S swww

启用必要的服务:

sudo systemctl enable --now vmtoolsd
sudo systemctl enable --now vmware-vmblock-fuse
sudo systemctl enable sddm

3. 解决 VMware 兼容性问题

创建或编辑 ~/.config/hypr/hyprland.conf,写入以下基础配置:

# 显示器配置 (VMware通常识别为Virtual-1)
monitor=Virtual-1, 1920x1080, 0x0, 1

# === 关键修复:找回消失的光标 ===
env = WLR_NO_HARDWARE_CURSORS,1
env = WLR_RENDERER_ALLOW_SOFTWARE,1
cursor {
    no_hardware_cursors = true
}

# === 关键修复:启动 VMware 剪贴板和分辨率自适应 ===
exec-once = vmware-user-suid-wrapper

# 启动其他组件
exec-once = waybar
exec-once = swww-daemon
exec-once = dunst

# === 关键修复:Kitty 终端崩溃问题 ===
# VMware 的虚拟显卡对 OpenGL 支持不完美,强制 Kitty 使用软件渲染以防崩溃
$terminal = env LIBGL_ALWAYS_SOFTWARE=1 kitty
$menu = wofi --show drun

# 快捷键绑定
$mainMod = SUPER
bind = $mainMod, Q, exec, $terminal
bind = $mainMod, C, killactive,
bind = $mainMod, M, exit,
bind = $mainMod, E, exec, dolphin
bind = $mainMod, V, togglefloating,
bind = $mainMod, R, exec, $menu

# 窗口外观
general {
    gaps_in = 5
    gaps_out = 10
    border_size = 2
    col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg
    col.inactive_border = rgba(595959aa)
    layout = dwindle
}

decoration {
    rounding = 10
    # 虚拟机中如果卡顿建议关闭模糊
    blur {
        enabled = true
        size = 3
        passes = 2
    }
}

4. UI 美化

默认的 Waybar 很简陋。对默认CSS进行修改。

配置文件:~/.config/waybar/config.jsonc

{
    "layer": "top",
    "position": "top",
    "height": 40,
    "modules-left": ["clock", "hyprland/workspaces"],
    "modules-center": [],
    "modules-right": ["network", "pulseaudio", "memory", "cpu", "tray"],
    "hyprland/workspaces": {
        "disable-scroll": true,
        "format": "{name}"
    },
    "clock": {
        "format": " {:%H:%M   %m-%d}"
    },
    "cpu": { "format": " {usage}%" },
    "memory": { "format": " {}%" },
    "network": {
        "format-wifi": "  {essid}",
        "format-ethernet": "  Eth"
    },
    "pulseaudio": {
        "format": "{icon} {volume}%",
        "format-icons": { "default": ["", "", ""] }
    }
}

样式表:~/.config/waybar/style.css

* {
    font-family: "JetBrainsMono Nerd Font";
    font-weight: bold;
    min-height: 0;
    border: none;
}
window#waybar {
    background: transparent; /* 背景透明 */
    color: #cdd6f4;
}
/* 胶囊样式核心 */
#clock, #network, #pulseaudio, #memory, #cpu, #tray, #workspaces {
    background: #313244;
    color: #cdd6f4;
    padding: 5px 15px;
    margin: 5px;
    border-radius: 24px;
    opacity: 0.9;
}
/* 独立配色 */
#clock { background: #89dceb; color: #1e1e2e; }
#network { background: #89b4fa; color: #1e1e2e; }
#cpu { background: #f38ba8; color: #1e1e2e; }
#workspaces button.active { background: #f9e2af; color: #1e1e2e; }

5. 壁纸与登录界面美化

壁纸 (swww)

Hyprpaper 在虚拟机中经常无法识别显示器,推荐使用 swww

  • 换壁纸命令:
    swww img /path/to/your/wallpaper.jpg

    (这一步无需配置文件,exec-once 守护进程启动后直接命令行切换,重启自动记忆)

登录界面 (SDDM + Sugar Candy)

如果遇到 git clone 连接 github 失败,推荐直接下载解压安装。

# 1. 下载主题包 (如果 wget 慢,可手动下载传进虚拟机)
wget [https://ghproxy.net/https://github.com/Kangie/sddm-sugar-candy/archive/refs/heads/master.zip](https://ghproxy.net/https://github.com/Kangie/sddm-sugar-candy/archive/refs/heads/master.zip) -O theme.zip

# 2. 安装
unzip theme.zip
sudo mkdir -p /usr/share/sddm/themes/
sudo mv sddm-sugar-candy-master /usr/share/sddm/themes/sugar-candy

# 3. 启用配置
sudo mkdir -p /etc/sddm.conf.d
echo -e "[Theme]\nCurrent=sugar-candy" | sudo tee /etc/sddm.conf.d/theme.conf

6. 终端美化 (Kitty + Starship)

让终端不仅不崩,还要好看。

编辑 ~/.config/kitty/kitty.conf

font_family      JetBrainsMono Nerd Font
font_size        14.0
background_opacity 0.8
window_padding_width 15
sync_to_monitor no

配置 Shell:
~/.bashrc~/.zshrc 中添加:

# 启动时显示系统信息
fastfetch

# 初始化 Starship 提示符
eval "$(starship init bash)"

安装主题:
运行 kitten themes 命令,选择 Catppuccin-MochaTokyo Night

此作者没有提供个人介绍。
最后更新于 2026-01-31