karpathy / ulogme

Automatically collect and visualize usage statistics in Ubuntu/OSX environments.
1.03k stars 195 forks source link

Make it work under xmonad and Docker #32

Open csmarosi opened 8 years ago

csmarosi commented 8 years ago

First, thanks for the great project!

To use it with my window manager (xmonad) and under Docker (so I can remove the network access, check also (In)Security) I needed some changes (in sort: using only X11-tools).

I have some strong feelings against this pull request, as I wanted something more elegant. It comes with the 'works for me (TM)' warranty; in particular I don't have any lock screen/screensaver.

Whether you merge it or no, I hope someone can profit form this PR.

ypid commented 8 years ago

Looks good! Related to #34.

karpathy commented 8 years ago

Hi i want to merge this but I'm worried about the sleep times:

sleep $windowLength
sleep .5 #make sure that all `xinput test` finished

since $windowLength is 9, wouldn't this make the total sleep time ~9.5 seconds and offset all the measurements?

ypid commented 8 years ago

@karpathy I guess you are right. I think it would be safe to drop the sleep .5.

karpathy commented 8 years ago

It's not clear to me what two sleeps in a row accomplish. Alternatively the first one could be set to 8.5? I don't think I fully understand the intent here.

csmarosi commented 8 years ago

I did not actually test whether I need the two sleep, but the reasoning:

There could be some race condition, so I sleep a little bit more (.5s) to wait for the files. I just wanted to make this explicit with the 2 consecutive sleeps. I have little experience, how bash works/handles these. In PR #36 there is the jobs shell built-in, which seems like the tool I should have been used.

BTW, yes with this 1/17th of the keystrokes are lost :) Feel free to steal/merge it with #36 if I don't have the time for that.

csmarosi commented 8 years ago

Updated (learned some bash). My original intention was this, but did not know about wait

ypid commented 8 years ago

timeout in combination with wait seems like the best fit when potentially reading from multiple input devices. Do you want to combine our to PR into one?

csmarosi commented 8 years ago

Your PR has additional features (and I'm lazy to check/test them), so would leave the credit :). You can take these ideas (or fork my branch), if you would like. Also note that this PR changes how the window title is determined, which should be tested under other WMs.