Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new_window_on_connect: Don't always spawn a new window #35

Closed
Feltzer opened this issue Aug 15, 2014 · 9 comments
Closed

new_window_on_connect: Don't always spawn a new window #35

Feltzer opened this issue Aug 15, 2014 · 9 comments

Comments

@Feltzer
Copy link
Contributor

Feltzer commented Aug 15, 2014

Hey guys,

I've been using the new_window_on_connect option for the past couple of weeks now. It's a very useful feature to have if you use GhostText while working on a different project.

I do feel that the way new Sublime instances are spawned could be improved, though. Most importantly, I don't think that GhostText should open a new window under the following circumstances:

  1. Connection to text field has already been established at least once.

    Currently if you start editing a text field, then close the connection and reconnect, a new empty Sublime window is spawned. So while GhostText does reestablish the right connection, it opens and focuses an unnecessary new window

  2. Only existing Sublime Text instance is empty.

    If you aren't working on something else before, you have to launch a new instance to be able to establish the connection. Even if this instance is empty GhostText will launch a new window when establishing the connection. A better solution, if feasible, would be to use the existing empty ST instance.

Thank you very much for considering this.

BR, Feltzer

@Cacodaimon
Copy link
Contributor

I like the idea about reusing "closed" views in existing windows rather than creating a new one, but don't expect a quick implementation because my current focus lies on: Cacodaimon/GhostText-for-Chrome#26 .

@Feltzer
Copy link
Contributor Author

Feltzer commented Aug 15, 2014

@Cacodaimon

That's fine. Take all the time you need. Thanks for the response!

@fregante
Copy link
Owner

From what I remember GT already reuses inactive GT-Sublime tabs if that option is disabled. Try just disabling it and moving a GT-Sublime tab to its own window to have a behavior similar to what you want.

@Cacodaimon
Copy link
Contributor

No currently when new_windows_on_connect is enabled a new windows gets created on each request , regardless if there is already a window with an disconnected view.

@Cacodaimon
Copy link
Contributor

I took the time to make some thoughts about this issue.

The main problem is that ST has no method to focus (bring to top) a window, therefore we had to build https://github.com/Cacodaimon/GhostText-for-SublimeText/blob/master/FocusSublimeWindow.py which uses some OS tools like nircmd on Microsoft Windows to bring a window to the top. This works but it focuses a random ST window.

The idea behind new_window_on_connect was to create a new window, which gets focused by ST, on each connect. By reusing "empty" ST windows we are not able to focus the particular window.

Reusing an "empty" window would be possible but we are currently not able to ensure that the right window gets focused, so I'm thinking that this issue is currently not feasible although I like your idea.

Maybe we can reopen this issue when ST extends it's API.

@Feltzer
Copy link
Contributor Author

Feltzer commented Sep 29, 2014

I understand your decision. Thanks for the comment!

@Cacodaimon
Copy link
Contributor

Maybe this feature come very close to your needs: #39

@Feltzer
Copy link
Contributor Author

Feltzer commented Oct 12, 2014

Thanks for the heads-up! I will give it a try over the next few days.

@Feltzer
Copy link
Contributor Author

Feltzer commented Oct 18, 2014

@Cacodaimon close_view_on_disconnect is working great for me so far. Kudos and thanks for the continued effort you guys put into this plugin! Can't imagine writing lengthy comments without GhostText any more :)!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants