SOLVED Glyph window became active/inactive event

  • Hi,

    Is there any event that indicates if the glyph window has become active/inactive? Actually becoming inactive is more important in my case.


  • @gferreira Thank you Gustavo. I had no idea those notifications are also for the glyph window focus. Great!

  • hello @bahman,

    I think you’re looking for viewDidChangeGlyph and viewWillChangeGlyph. (I found them using the EventObserver extension)

    here’s an example:

    from vanilla import FloatingWindow
    from import addObserver, removeObserver
    from import BaseWindowController
    class TestWindow(BaseWindowController):
        def __init__(self):
            self.w = FloatingWindow((123, 123))
            addObserver(self, 'viewDidChangeGlyphCallback', "viewDidChangeGlyph")
            addObserver(self, 'viewWillChangeGlyphCallback', "viewWillChangeGlyph")
        def windowCloseCallback(self, sender):
            removeObserver(self, 'viewDidChangeGlyph')
            removeObserver(self, 'viewWillChangeGlyph')
            super(TestWindow, self).windowCloseCallback(sender)
        def viewDidChangeGlyphCallback(self, notification):
            glyph = notification['glyph']
            print(f'entering glyph window ({})')
        def viewWillChangeGlyphCallback(self, notification):
            glyph = notification['glyph']
            print(f'exiting glyph window ({})')