-
Notifications
You must be signed in to change notification settings - Fork 244
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
examples not working on mac.. #39
Comments
Ok so I'm getting this to work - kinda..
that actually just sends shift 3 (£ on my layout) - not creating a screenshot (apple shift 3 is a system wide shortcut for creating a screenshot). I'm guessing what its doing is sending command key and not holding it down with the other two.. (i.e. its just tapping it). I'm grasping at straws here (i.e. I can't figure this out) but is that because there is only a sticky state for shift - and not the other command keys? (UPDATE: I see that I should have read the previous issue #38 . Apologies for adding to the list..) |
Actually I think you are demonstrating some facets of how the Mac implementation is incomplete. I am not so knowledgeable when it comes to Mac and don't have one to test on. It looks like it could use some fleshing out. |
Im wondering if its something to do with it needing kCGEventFlagMaskCommand (I'm still getting my head around this but it looks like the modifier keys need a different approach: http://stackoverflow.com/questions/15206825/cmdoptiond-simulation-in-cocoa/15207244#15207244) - I've done some test code and this works..
NB: It does work but it also leads to a segmentation fault. I'm not sure why. It does though tend to suggest you can save pretending to press all the modifier keys - just the keys that you need with the kCGEventFlagMaskCommand set on them.. (also are you aware of this @SavinaRoja : https://github.com/abarnert/pykeycode ? - it may be more reliable than the lookup table - particularly when detecting keystrokes?) Happy to pay for a remote mac hosting plan for a little while if it helps ;) |
I've written an adaption to the current code which seems to be more reliable.. https://github.com/willwade/PyUserInput/blob/master/pykeyboard/mac.py - I would do a pull request but I'm not 100% confident its that much better - the eval is horrible and there is a shift problem (see this gist for an example: https://gist.github.com/willwade/52ccf1455772d6597c30) Note that for the examples to work, run them in the terminal then switch to the finder.. more example shortcuts to test: http://support.apple.com/kb/HT1343 UPDATE: It does now work - I realised it was only sending one modifier so now it can send multiple including a shift modifier. I'm still a little concerned this may mess up the standard shift configuration - let me know if you want me to do a pull request. |
I may be being stupid..
gives:
AttributeError: 'PyKeyboard' object has no attribute 'numpad_keys'
(and if I comment the numpad line)
AttributeError: 'PyKeyboard' object has no attribute 'function_keys'
(running latest zip on mac)
The initial readme could do with a one liner on how to send a normal key as well as a function key..
The text was updated successfully, but these errors were encountered: