I have developed an application time tracking app in python for linux, I am using xprop to get the active window, then it's PID , window name and process name. This app sends the tracking data to a remote server and so with all the dependencies i make a linux package using pyinstaller.
I'm currently working in CentOS 7. I have written a service which will keep the application open ( i made all the required changes for the service to run in user's desktop environment ).
while testing the service I saw that after a reboot with a fresh desktop, the service is running fine, but the data is not getting collected on the server. But as soon as i open a terminal everything works fine.
Is it necessary to have a terminal open for subprocess.check_output / subprocess.Popen() if the code is as follows :
active_win = subprocess.check_output(["xprop", "-root", "_NET_ACTIVE_WINDOW"]).decode('utf-8').split('#')[1].strip()
or
root = Popen( ['xprop', '-root', '_NET_ACTIVE_WINDOW'], stdout = PIPE )
stdout, stderr = root.communicate()
m = re.search( b'^_NET_ACTIVE_WINDOW.* ([\w]+)$', stdout )
if m is not None:
window_id = m.group( 1 )