我想知道如何使用 Qt做这样的事情(源代码)。我查看了文档,但找不到任何方法来检查外部进程是否正在运行。
if [ "$(pidof ksmserver)" ]; then
echo "KDE running."
# KDE-specific stuff here
elif [ "$(pidof gnome-session)" ]; then
echo "GNOME running."
# GNOME-specific stuff here
elif [ "$(pidof xfce-mcs-manage)" ]; then
echo "Xfce running."
# Xfce-specific stuff here
fi