Sublime Forum

Event on window size change?

#1

Dear friends,
could you help with next questions?

I want to create simple plugin to hide Tabs and StatusBar if window has height less than let’s say 100px.
And I can’t figure out, how to capture this even.
Thnx

class compact_on_resize(sublime_plugin.ViewEventListener ):
    def on_modified(self):
        # print('VSizes:', view.viewport_extent())
        # print('LSizes:', view.layout_extent())
        # print('Sizes:', view.layout_extent())
        h, w = self.view.viewport_extent()
        print(w)
        if w <100:
            self.view.window().set_tabs_visible(False)
        if w >150:
            self.view.window().set_tabs_visible(True)
0 Likes

#2

Hi,

There is currently no event for this, you’d have to use a timer and poll it I believe. You can vote for such an event here:

1 Like