Closed aaronjanse closed 3 years ago
So here are my thoughts on sleeping channels:
ListenToQueue
is applied on all the panes, but it should be a good idea to be able to idle individual panesPanes handle all that stuff quite well (TM), the same way as tmux [1]. This PR is about the global renderer.... and your comment made me realize we should just re-use logic from pane drawing for the global renderer!
I'll make a new PR to do this :-)
[1] https://github.com/tmux/tmux/issues/849#issuecomment-291828893
With #97 now merged, 3mux no longer writes to stdout when idling (none of the panes are changing). This PR tells the renderer to "sleep" if it hasn't received any HandleCh calls for the past second. "Sleeping" means waiting on a channel then letting HandleCh send something to that channel to restart the renderer's loop.
This reduces idle CPU usage from ~1.5% to ~0% on my laptop.
I'm unsure how the pause/resume channels should be handled while asleep? (thus, this PR is marked as a draft)