Wow, I actually managed to do this myself. Probably in the worst way ever, and everyone who knows coding will cringe. But at least I’m happy.
I took the code from a PIR-guide (this one: https://diyhacking.com/raspberry-pi-gpio-control/). Basically just to show how it works. And then I googled as hell for other commands. And finally mashed them togheter to this AWESOME python script.
//import RPi.GPIO as GPIO
import time
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.IN) #Read output from PIR motion sensor
GPIO.setup(3, GPIO.OUT) #LED output pin
while True:
i=GPIO.input(11)
if i==0: #When output from motion sensor is LOW
print "No intruders",i
GPIO.output(3, 0) #Turn OFF LED
time.sleep(0.1)
elif i==1: #When output from motion sensor is HIGH
import os
os.system("xscreensaver-command -deactivate"),i
GPIO.output(3, 1) #Turn ON LED
time.sleep(0.1)
And I put this in autostart. So I guess it checks the GPIO every 0.1 second. And I made the true to deactivate xscreensaver. I didn’t even remove the other code so I guess my command line are getting spammed by “No intruders” all the time hahaha.
This is really the first time coding something. Otherwise I have just followed step-by-step guides when RPIng. So this is a big step for me.
Anyway, if someone has a better way for this then I am happy to hear!