Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it work under xmonad and Docker #32

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

csmarosi
Copy link

@csmarosi csmarosi commented Jan 3, 2016

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.

Under xmonad, `xdotool getactivewindow` fails with
    Your windowmanager claims not to support _NET_ACTIVE_WINDOW, so the attempt to query the active window aborted.
    xdo_get_active_window reported an error
despite claiming to be 'reliable than getwindowfocus'.
@ypid
Copy link
Contributor

ypid commented May 7, 2016

Looks good! Related to #34.

@karpathy
Copy link
Owner

karpathy commented May 8, 2016

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
Copy link
Contributor

ypid commented May 8, 2016

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

@karpathy
Copy link
Owner

karpathy commented May 8, 2016

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
Copy link
Author

csmarosi commented May 9, 2016

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

  • I spawn many background tasks with timeout $windowLength xinput test $id > $fileName &
  • these tasks terminated by the timeout

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.

This change removes the sudo dependency.
Note: inside a Docker container showkey does not work.
@csmarosi
Copy link
Author

csmarosi commented May 9, 2016

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

@ypid
Copy link
Contributor

ypid commented May 9, 2016

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
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants