Is there a reliable way that an app can get its Window ID via the LCL?
When I needed this function, I did not find a way via the LCL. I installed 'xdotool' for that. With
xdotool search --onlyvisible --pid <PID>
you get a list of all Window-ID's which have a certain PID.
If your program is a console program, you must search for the Parent-PID of your program (if your program was started e.g. via /home/<user>/.config/autostart/) or for the Grand-Parent-ID of your program (if your program was started manually in a console).
If you need help finding the PID / Parent-PID of a program, let me know (but I think you know this better then me).
In order to keep it running usefully, it's necessary to disable the screensaver.
On Linux I use this way to disable the screensaver, when called periodically:
procedure noStandby;
const d: integer = 0; {'0' works in Ubuntu 18.04, otherwise use '1'}
var MP: TPoint;
begin
MP:=Mouse.CursorPos;
inc(MP.x,d);
inc(MP.y,d);
Mouse.CursorPos:=MP;
d:=-d;
Application.ProcessMessages;
end;
HTH