{"action":"created","issue":{"url":"https://api.github.com/repos/compsoc-edinburgh/mapp-worker/issues/2","repository_url":"https://api.github.com/repos/compsoc-edinburgh/mapp-worker","labels_url":"https://api.github.com/repos/compsoc-edinburgh/mapp-worker/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/compsoc-edinburgh/mapp-worker/issues/2/comments","events_url":"https://api.github.com/repos/compsoc-edinburgh/mapp-worker/issues/2/events","html_url":"https://github.com/compsoc-edinburgh/mapp-worker/issues/2","id":364822392,"node_id":"MDU6SXNzdWUzNjQ4MjIzOTI=","number":2,"title":"Consider alternatives to loginctl for graphical session owner","user":{"login":"sleepyfoxen","id":15024086,"node_id":"MDQ6VXNlcjE1MDI0MDg2","avatar_url":"https://avatars0.githubusercontent.com/u/15024086?v=4","gravatar_id":"","url":"https://api.github.com/users/sleepyfoxen","html_url":"https://github.com/sleepyfoxen","followers_url":"https://api.github.com/users/sleepyfoxen/followers","following_url":"https://api.github.com/users/sleepyfoxen/following{/other_user}","gists_url":"https://api.github.com/users/sleepyfoxen/gists{/gist_id}","starred_url":"https://api.github.com/users/sleepyfoxen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sleepyfoxen/subscriptions","organizations_url":"https://api.github.com/users/sleepyfoxen/orgs","repos_url":"https://api.github.com/users/sleepyfoxen/repos","events_url":"https://api.github.com/users/sleepyfoxen/events{/privacy}","received_events_url":"https://api.github.com/users/sleepyfoxen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-09-28T10:00:45Z","updated_at":"2018-09-28T13:13:01Z","closed_at":null,"author_association":"NONE","body":"Currently, we use `loginctl` ([man page](http://man7.org/linux/man-pages/man1/loginctl.1.html)) to see who's logged in.\r\n\r\nAn alternative solution would be to check for a process that is launched along with a graphical session, such as those relating to `dbus`:\r\n\r\n```bash\r\nps -ef |\r\n    grep -e 'dbus-launch.*--exit-with-session' |\r\n    fgrep -v -e grep |\r\n    awk '{print $1}'\r\n```\r\n\r\nAnother option is to find which processes are children of the display manager, `lightdm`. (You can find the display manager by checking who spawned X, but on DICE it'll always be lightdm). The window manager should be a child, so checking the owner of the child processes will give you who has a graphical session.\r\n\r\n```bash\r\nps -ho user --ppid $(pidof lightdm) |\r\n    fgrep -v -e 'root'\r\n```\r\n\r\nI think the second option would be a lot neater and more reliable. Thoughts?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/compsoc-edinburgh/mapp-worker/issues/comments/425431286","html_url":"https://github.com/compsoc-edinburgh/mapp-worker/issues/2#issuecomment-425431286","issue_url":"https://api.github.com/repos/compsoc-edinburgh/mapp-worker/issues/2","id":425431286,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNTQzMTI4Ng==","user":{"login":"qaisjp","id":923242,"node_id":"MDQ6VXNlcjkyMzI0Mg==","avatar_url":"https://avatars3.githubusercontent.com/u/923242?v=4","gravatar_id":"","url":"https://api.github.com/users/qaisjp","html_url":"https://github.com/qaisjp","followers_url":"https://api.github.com/users/qaisjp/followers","following_url":"https://api.github.com/users/qaisjp/following{/other_user}","gists_url":"https://api.github.com/users/qaisjp/gists{/gist_id}","starred_url":"https://api.github.com/users/qaisjp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qaisjp/subscriptions","organizations_url":"https://api.github.com/users/qaisjp/orgs","repos_url":"https://api.github.com/users/qaisjp/repos","events_url":"https://api.github.com/users/qaisjp/events{/privacy}","received_events_url":"https://api.github.com/users/qaisjp/received_events","type":"User","site_admin":false},"created_at":"2018-09-28T13:13:01Z","updated_at":"2018-09-28T13:13:01Z","author_association":"MEMBER","body":"Sounds good. \r\n\r\n1. I hope `$()` and pipes will work in code without much refactor but lets try\r\n2. Can people run lightdm themselves and screw with this? It's fine if they can because a new command is better than what we have now, but it's good to know\r\n\r\nAlso, for reference, this is what squinney said:\r\n\r\n> Thanks for the report, it appears to be related to the gnome-keyring-daemon process not being killed when a user logs out. We'll investigate but I don't think it's a major problem."}}
{"actor":{"display_login":"qaisjp"}}