Sublime Forum

ST3: Detecting preview window in API

#1

Hi,

How can I detect if a view is actually the “preview” view? In ST2 you could check if the view would be in the list of open files (the preview would not be in that list), but in ST3 I see the preview shows up as a regular open file.

I thought “window.transient_view_in_group(group)” would do the trick, but I’m not getting very far. Maybe I’m misunderstanding.
I’d much appreciate it if anyone could help me out with this or point me in the right direction.

Kind regards!

0 Likes

on_load induced by preview in goto anything
#2

Bump.

I need this information in my plugin as well. Does anyone know how to check if a view is transient?

0 Likes

#3

In st3 there’s a concept of semi-transient views. I think they were introduced in the interest of user-friendliness. You’re problably looking at one of those, although I don’t know how they manifest themselves through the API…

0 Likes

#4

I think you can either do:

view == window.transient_view_in_group(window.active_group())

or

view in window.views()

Not sure it always works.

However, a property or settings in the view object will be a nice addition.

0 Likes

#5

Thanks bizoo! Both commands seem to work in the context that I am using them but I decided to go with the “window.transient_view_in_group” option.

0 Likes