Ape / samsungctl

Remote control Samsung televisions via a TCP/IP connection
MIT License
711 stars 191 forks source link

Bind KEY_EXIT to q in interactive mode #70

Closed kucharskim closed 6 years ago

kucharskim commented 6 years ago

I'm using OpenELEC / LibreELEC with multiple Samsung TVs and they use KEY_EXIT to navigate back menus in Kodi. I tested stdscr.notimeout(True) on the top of _control() function, but that didn't bring any effect. Decided to use this hacky solution of ESCDELAY environment variable set to zero, to not introduce 1000 milliseconds (per curses(3) manual page) delay while pressing Escape key.

kucharskim commented 6 years ago

I had also version of this diff, when I mapped curses KEY_BACKSPACE to remotes KEY_EXIT and curses r to remotes KEY_RETURN, to avoid using ESC and avoid modifying run() function. Not sure would that kind of remapping would be desired.

Ape commented 6 years ago

ESC delay of 0 will probably cause issues at least on some terminals. We could use some other short delay, but using ESC is still a bit problematic.

I'd be happy to add KEY_EXIT to the default mapping, but we should probably use some other key instead of ESC. Also, I would avoid remapping any existing keys.

kucharskim commented 6 years ago

Sure, no problem. Any opinion for q or e?

Ape commented 6 years ago

You can choose.

Ape commented 6 years ago

Getting ready for merge. Please squash the two commits together.

Ape commented 6 years ago

Thanks!

lervag commented 5 years ago

I think this introduce a minor annoyance: The Q key for KEY_EXIT interfers with Q for exiting interactive mode. Is there any way to customize the keys from the user perspective?

kucharskim commented 5 years ago

@Ape, could you release new version with my fix for the conflict included?