ScreenLockDetector/run.sh

61 lines
1.6 KiB
Bash
Raw Normal View History

2025-11-07 10:56:45 +08:00
#!/bin/bash
# Qt Screen Lock Detection Demo - Run Script
# This script runs the compiled Qt application
set -e # Exit on error
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
echo "========================================"
echo "Qt Screen Lock Detection Demo - Run"
echo "========================================"
echo ""
# Check if build directory exists
BUILD_DIR="build"
if [ ! -d "$BUILD_DIR" ]; then
echo -e "${RED}Error: Build directory not found!${NC}"
echo "Please run ./build.sh first to compile the application"
exit 1
fi
# Check if executable exists
EXECUTABLE="$BUILD_DIR/bin/ScreenLockDemo"
if [ ! -f "$EXECUTABLE" ]; then
echo -e "${RED}Error: Executable not found at $EXECUTABLE${NC}"
echo "Please run ./build.sh first to compile the application"
exit 1
fi
echo -e "${GREEN}✓ Executable found${NC}"
echo ""
echo "Starting application..."
echo "----------------------------------------"
echo ""
echo "Usage Tips:"
echo " • The application will monitor screen lock events via DBus"
echo " • Lock your screen (Ctrl+Alt+L or Super+L) to test"
echo " • Watch the animation stop when locked"
echo " • Animation resumes automatically when unlocked"
echo ""
echo "----------------------------------------"
echo ""
# Set Qt5 library path and GCC library path
export QT5_DIR="$HOME/sdk/qt-5.15.2"
export LD_LIBRARY_PATH="$QT5_DIR/lib:/usr/local/lib64:/usr/local/lib:$LD_LIBRARY_PATH"
# Run the application
cd "$BUILD_DIR/bin"
./ScreenLockDemo
echo ""
echo "========================================"
echo "Application terminated"
echo "========================================"