Created
December 15, 2015 09:40
-
-
Save ozcan/768c56baaa4578057002 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from libpebble2.communication import PebbleConnection | |
| from libpebble2.communication.transports.serial import SerialTransport | |
| from libpebble2.services.appmessage import * | |
| from libpebble2.protocol import * | |
| from libpebble2.exceptions import * | |
| import os | |
| pebble = PebbleConnection(SerialTransport("/dev/cu.PebbleTime189F-SerialPo")) | |
| pebble.connect() | |
| pebble.run_async() | |
| def sendKeycode(keycode): | |
| os.system("osascript -e 'tell application \"LibreOffice\" to activate'") | |
| os.system("osascript -e 'tell application \"System Events\"' -e 'key code " + keycode + "' -e 'end tell'") | |
| while pebble.connected: | |
| try: | |
| packet = pebble.read_from_endpoint(MusicControl) | |
| if packet.command == 4: | |
| sendKeycode("124") | |
| elif packet.command == 5: | |
| sendKeycode("123") | |
| else: | |
| print packet | |
| except TimeoutError: | |
| pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment