1.添加配置
bash
# 在 ~/.bashrc 末尾添加
if ! systemctl is-active --quiet graphical.target 2>/dev/null; then
echo "你的密码" | sudo -S systemctl start graphical.target 2>/dev/null
fi