diff --git a/.gitignore b/.gitignore
index 6bbc21e9e2d93d91dba1af9ef3a18ec629bfd38c..f446f827eca08d01c5ed5bdc2064a6540d485b42 100644
--- a/.gitignore
+++ b/.gitignore
@@ -127,4 +127,5 @@ dmypy.json
 cython_debug/
 
 module_config.json
-hw_config.json
\ No newline at end of file
+hw_config.json
+app.log
diff --git a/run-pi.sh b/run-pi.sh
index 2552ef558a350b867d9070563dc7317f5ecf2f02..e5dc63532836be7c634746ff983aca7bd8e55c45 100755
--- a/run-pi.sh
+++ b/run-pi.sh
@@ -2,6 +2,9 @@
 
 cd "$(dirname "$0")" || exit
 
+# Sleep for 10 seconds
+sleep 10
+
 # Run the script
-xhost +SI:localuser:root
-sudo ./.venv/bin/python3 main.py
+DISPLAY=:0 xhost + && \
+    sudo DISPLAY=:0 ./.venv/bin/python3 main.py > ./app.log 2>&1