wsl安装桌面环境

安装 apt-fast 依赖

sudo apt purge -y acpid acpi-support modemmanager
sudo apt-mark hold acpid acpi-support modemmanager

安装 apt-fast

sudo apt update
sudo apt install aria2
sudo apt install software-properties-common
sudo add-apt-repository ppa:apt-fast/stable
sudo apt install apt-fast
# 然后弹出界面一路回车使用默认的即可

安装KDE

# 可以安装kubuntu-desktop或plasma-desktop,区别是前者更完整体积更大后者提供基本的桌面组件体积更小
sudo apt-fast install plasma-desktop
 
# 如果到后面的步骤打开桌面时就只看到壁纸,任务栏和别的东西看不见应该是分辨率设置不正确,把辨率改小就好了

启动桌面环境

3.1、安装xorg、Xephyr和GIMP

# 安装xorg
sudo apt-get install xorg
# 安装Xehpyr
sudo apt-get install xserver-xephyr

设置环境变量

echo "export XDG_SESSION_TYPE=x11" >> ~/.profile
echo "export GDK_PLATFORM=x11" >> ~/.profile
echo "export GDK_BACKEND=x11" >> ~/.profile
echo "export QT_QPA_PLATFORM=xcb" >> ~/.profile
echo "export WAYLAND_DISPLAY=" >> ~/.profile
 
source ~/.profile

原作的原话“儲存環境變數到~/.profile,告訴程式全數使用X渲染。如果你不這樣做,在X伺服器視窗開的Linux程式可能會跑到視窗外面。"

启动X Server

# 设置窗口可以改变大小,至于1920x1080是我笔记本屏幕的大小,大家可以根据需求自行修改
Xephyr -br -ac -noreset -resizeable -screen 1920x1080 :1 &

上面这条命令最后的“&”是指异步运行,这里需要异步运行后面还有命令需要输入

在另一个终端启动桌面

export DISPLAY=:1
dbus-launch --exit-with-session startplasma-x11 &

https://blog.csdn.net/qq_30448087/article/details/134897586

posted @ 2025-05-18 20:22  丘狸尾  阅读(206)  评论(0)    收藏  举报