How to most accurately update my Window numbers?

Table of Contents

img

I use EXWM and three monitors, so knowing my window numbers is crucial to my navigation. I used to use Ace Window to present a red digit at the corner of emacs screens with which number to press to get there. The two problems with this are that you can’t know your numbers until you invoke Ace Windows, and more damningly, you can’t get these numbers on exwm (non-emacs) windows, such as my ever-present browsers.

Now my current solution along with its major flaw. I stick these window numbers into my modeline (since modeline is still present on exwm windows). The flaw with this is that sometimes they get out of sync. For example, a window gets added by a gnus or dired command or any of my constant window splitting, and soon disappears – but for a while other Windows are still numbered incorrectly. For instance, in the gif above, after the quad-split and un-split of the left-most frame, the right-most is originally (correctly) bumped to window #7; but upon going single on the quad split, the digit is strangely set to “6”, although you will navigate there with “3”. gEventually, such as with a call to list-buffers, all the numbers are reset appropriately; but I’d like to prevent them from ever getting out of sync.

Clearly I should put a hook to update something, but which update function and which hook to put it on, I don’t know. Any recommendations?

  • Modeline: Telephone1

  • Way I get the window number: (eval (cadr winum--mode-line-segment))

Footnotes

1 Telephone Line and other mode-lines as of 2020: https://www.reddit.com/r/emacs/comments/izksoi/2020_modelines_besides_doom/g6jgdyk

Tory Anderson avatar
Tory Anderson
Full-time Web App Engineer, Digital Humanist, Researcher, Computer Psychologist