Exemple #1
0
 def __init__(self, parent=None):
     super(HookThread, self).__init__(parent)
     self.tap = osxmmkeys.Tap()
     print("tapping play_pause, next_track, prev_track")
     self.tap.on('play_pause', lambda: emit(self.playpause))
     self.tap.on('next_track', lambda: emit(self.play_next))
     self.tap.on('prev_track', lambda: emit(self.play_prev))
Exemple #2
0
    def bind_osx(self):
        try:
            import osxmmkeys
        except ImportError:
            logging.warning(
                'Please install osxmmkeys: https://github.com/pushrax/osxmmkeys'
            )
            return False
        except RuntimeError as e:
            logging.warning('osxmmkeys failed to import: {}'.format(e))
            return False

        tap = osxmmkeys.Tap()
        tap.on('play_pause', self.osx_playpause_handler)
        tap.on('next_track', self.osx_skip_handler)
        tap.start()

        return True