{"action":"created","issue":{"url":"https://api.github.com/repos/Otto-AA/aw-watcher-terminal/issues/1","repository_url":"https://api.github.com/repos/Otto-AA/aw-watcher-terminal","labels_url":"https://api.github.com/repos/Otto-AA/aw-watcher-terminal/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/Otto-AA/aw-watcher-terminal/issues/1/comments","events_url":"https://api.github.com/repos/Otto-AA/aw-watcher-terminal/issues/1/events","html_url":"https://github.com/Otto-AA/aw-watcher-terminal/issues/1","id":335211324,"node_id":"MDU6SXNzdWUzMzUyMTEzMjQ=","number":1,"title":"Add a PID file so only one instance of aw-watcher-terminal is needed","user":{"login":"johan-bjareholt","id":1398500,"node_id":"MDQ6VXNlcjEzOTg1MDA=","avatar_url":"https://avatars1.githubusercontent.com/u/1398500?v=4","gravatar_id":"","url":"https://api.github.com/users/johan-bjareholt","html_url":"https://github.com/johan-bjareholt","followers_url":"https://api.github.com/users/johan-bjareholt/followers","following_url":"https://api.github.com/users/johan-bjareholt/following{/other_user}","gists_url":"https://api.github.com/users/johan-bjareholt/gists{/gist_id}","starred_url":"https://api.github.com/users/johan-bjareholt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johan-bjareholt/subscriptions","organizations_url":"https://api.github.com/users/johan-bjareholt/orgs","repos_url":"https://api.github.com/users/johan-bjareholt/repos","events_url":"https://api.github.com/users/johan-bjareholt/events{/privacy}","received_events_url":"https://api.github.com/users/johan-bjareholt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-06-24T21:02:11Z","updated_at":"2018-06-27T18:50:30Z","closed_at":null,"author_association":"NONE","body":"Seems to me like you currently start a aw-watcher-terminal instance for each terminal which is opened. Since you are using one-way communication via fifo-files multiple instances should not be needed.\r\n\r\nI am suggesting to use the activity watch data dir (.local/share/activitywatch/aw-watcher-terminal on linux, accessible via aw-core.dirs.get_data_dir) for both the fifo-file and a pid-file. Then we can check every time aw-watcher-terminal starts if a aw-watcher-terminal process is already running and if it is we can simply just utilize that instance and its fifo-file instead. This should also fix issues on multi-user systems when you have the fifo file in /tmp."},"comment":{"url":"https://api.github.com/repos/Otto-AA/aw-watcher-terminal/issues/comments/400790795","html_url":"https://github.com/Otto-AA/aw-watcher-terminal/issues/1#issuecomment-400790795","issue_url":"https://api.github.com/repos/Otto-AA/aw-watcher-terminal/issues/1","id":400790795,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMDc5MDc5NQ==","user":{"login":"Otto-AA","id":21040751,"node_id":"MDQ6VXNlcjIxMDQwNzUx","avatar_url":"https://avatars2.githubusercontent.com/u/21040751?v=4","gravatar_id":"","url":"https://api.github.com/users/Otto-AA","html_url":"https://github.com/Otto-AA","followers_url":"https://api.github.com/users/Otto-AA/followers","following_url":"https://api.github.com/users/Otto-AA/following{/other_user}","gists_url":"https://api.github.com/users/Otto-AA/gists{/gist_id}","starred_url":"https://api.github.com/users/Otto-AA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Otto-AA/subscriptions","organizations_url":"https://api.github.com/users/Otto-AA/orgs","repos_url":"https://api.github.com/users/Otto-AA/repos","events_url":"https://api.github.com/users/Otto-AA/events{/privacy}","received_events_url":"https://api.github.com/users/Otto-AA/received_events","type":"User","site_admin":false},"created_at":"2018-06-27T18:50:30Z","updated_at":"2018-06-27T18:50:30Z","author_association":"OWNER","body":"> My idea with the PID file was to have it running as a daemon and check at every startup if it is already running, and if not start aw-watcher-terminal as a daemon.\r\n\r\nI think, the best outcome would be, that it also can be autostarted with aw-qt. (I guess, [this](https://github.com/ActivityWatch/aw-qt/blob/master/aw_qt/manager.py#L112) todo needs to be done beforehand)\r\nAs far as I have seen, this would require the watcher to be compiled into an executable which could be done with PyInstaller.\r\n\r\nChecking on every terminal startup seems like a good idea to me. I'd prefer to keep this logic separate from aw-watcher-bash (or other shell specific watchers) and rather implement it somehow in aw-watcher-terminal and/or aw-qt, but if that's not possible we can do it this way.\r\n\r\nBut to be honest, I don't really have a clue how to do any of the above, so help (e.g. links to related documentation or examples) would be appreciated :)"}}
{"actor":{"display_login":"Otto-AA"}}