diff --git a/scripts/GUI.sh b/scripts/GUI.sh index c35ee13..359b54f 100644 --- a/scripts/GUI.sh +++ b/scripts/GUI.sh @@ -1,9 +1,33 @@ #!/bin/sh +USCT_USER="usct" +USCT_HOME="/home/$USCT_USER" +XAUTH_FILE="$USCT_HOME/.Xauthority" + +MAX_WAIT_SECONDS=30 +WAIT_INTERVAL=1 +ELAPSED_TIME=0 + +while [ $ELAPSED_TIME -lt $MAX_WAIT_SECONDS ]; do + if [ -f "$XAUTH_FILE" ] && pgrep -u "$USCT_USER" kwin_x11 > /dev/null; then + echo "User $USCT_USER's X session and .Xauthority found." + break + fi + sleep $WAIT_INTERVAL + ELAPSED_TIME=$((ELAPSED_TIME + WAIT_INTERVAL)) + echo "Waiting for $USCT_USER's X session... ($ELAPSED_TIME/$MAX_WAIT_SECONDS seconds)" +done + +if [ $ELAPSED_TIME -ge $MAX_WAIT_SECONDS ]; then + echo "Timeout waiting for $USCT_USER's X session. Exiting." + exit 1 +fi + # debug标志,可用于试运行的debug export QT_DEBUG_PLUGINS=1 # 获取应用名称(如应用名称为app,那么脚本为app.sh appname=`basename $0 | sed s,\.sh$,,` # 获取应用当前目录 +cd /home/GUI dirname=`dirname $0` tmp="${dirname#?}" # 判断目录是不是根目录 @@ -24,4 +48,4 @@ unset DESKTOP_SESSION # unset XDG_SEAT_PATH # set XDG_SESSION_TYPE=tty # 运 - $dirname/$appname "$@" --no-sandbox \ No newline at end of file +$dirname/$appname --no-sandbox "$@" diff --git a/src/windows/MainWindow.cpp b/src/windows/MainWindow.cpp index 313154f..37000a6 100644 --- a/src/windows/MainWindow.cpp +++ b/src/windows/MainWindow.cpp @@ -59,7 +59,7 @@ MainWindow::MainWindow(QWidget* aParent) connect(EventCenter::Default(), &EventCenter::LoginSuccess, this, [this]() { - mTopbarWidget->setVisible(true);qDebug()<size(); + mTopbarWidget->setVisible(true); mInitializWidget->setVisible(false); });