node-pyatv icon indicating copy to clipboard operation
node-pyatv copied to clipboard

Is it possible to support double tap key press?

Open zhiningq opened this issue 1 year ago • 3 comments

My goal is to be able to force quit an app using double tap home key and swipe up:

It can only be achieved using workaround

  • atvremote -s home home // calling this can show a list of background apps
  • atvremote -s up up // calling this can exit the current app

Is it possible to allow keyPress to take an array instead of just a single key? https://github.com/sebbo2002/node-pyatv/blob/7e6eefa8df87d73c4129bdc6d24148fe8ea9976d/src/lib/device.ts#L350

or if we could support double tap on keyPress with InputAction https://github.com/postlund/pyatv/blob/master/pyatv/interface.py#L372

zhiningq avatar Jun 27 '24 22:06 zhiningq

Sounds absolutely feasible, implementing InputAction would probably make more sense. Unfortunately I have a lot to do at the moment, but if it's not urgent I would take care of it in the next few weeks. Otherwise, I'm also happy to accept pull requests if it's urgent.

sebbo2002 avatar Jun 28 '24 07:06 sebbo2002

I had a quick look at the whole thing. Currently InputAction does not seem to be available for atvscript (which is used by this library for most key actions), also home home or up up does not work here:

❯❯❯ atvscript -s up up
usage: atvscript [-h] [--storage {file,none}] [--storage-filename STORAGE_FILENAME] [-i ID] [--protocol PROTOCOL] [-s SCAN_HOSTS] [--output OUTPUT] [--debug]
                 [--dmap-credentials DMAP_CREDENTIALS] [--mrp-credentials MRP_CREDENTIALS] [--airplay-credentials AIRPLAY_CREDENTIALS]
                 [--companion-credentials COMPANION_CREDENTIALS] [--raop-credentials RAOP_CREDENTIALS]
                 command
atvscript: error: unrecognized arguments: up

Do you happen to know how to double-click in atvscript? Otherwise this feature would have to be implemented in pyatv's atvscript first. The best thing to do is to open a ticket there and explain your requirements.

sebbo2002 avatar Jul 10 '24 18:07 sebbo2002

That is how I implemented it in homebridge-appletv-enhanced. "Avadra Kedavra" closes opened apps. This is of course not very configurable and specific to my plugin but you should get an idea how it works.

https://github.com/maxileith/homebridge-appletv-enhanced/blob/e76051886273fef47abd6f24559ca6e9dfe82f58/src/RocketRemote.ts#L191-L204

maxileith avatar Jul 11 '24 17:07 maxileith

This issue has been automatically marked as stale because it has not had recent activity :sleeping: It will be closed in 14 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation. Thank you for your contributions :heart:

github-actions[bot] avatar Sep 10 '24 10:09 github-actions[bot]

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related issues and reference this one.

github-actions[bot] avatar May 02 '25 00:05 github-actions[bot]