Skip to content

Commit

Permalink
update readme and comment
Browse files Browse the repository at this point in the history
  • Loading branch information
gwenzek committed Nov 8, 2019
1 parent 769c346 commit 86e9f87
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 26 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ better API for this (relevant issues:
* (Linux) For some reason some chars aren't displayed correctly.

* (Windows) The plugin is more brittle on Windows, some features have been
disabled as a consequence. If you have knowledge of the `user32` API we might
use your help !
disabled as a consequence.
In particular you'll have to manually select windows before their name is changed.
If you have knowledge of the `user32` API we might use your help !

## Thanks

Expand Down
49 changes: 25 additions & 24 deletions set_window_title.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import sublime

import os
import time
from sublime_plugin import EventListener

WAS_DIRTY = "set_window_title_was_dirty"
Expand Down Expand Up @@ -41,29 +40,30 @@ def plugin_loaded():
global _READY_
_READY_ = True

if PLATFORM == "linux":
# Update all window titles on setting change.
settings = sublime.load_settings("set_window_title.sublime-settings")
setting_keys = [
"unregistered",
"template",
"has_project_true",
"has_project_false",
"is_dirty_true",
"is_dirty_false",
"path_display",
"untitled",
]
for k in setting_keys:
settings.add_on_change(k, refresh_all)

# Update all window titles on plugin loaded for Linux.
refresh_all()

# Reported to freeze ST on Windows for some reason to update top or all window titles on loading. TODO: Find how to update window title on plugin loaded for Windows wthout freezing.
# Reference - https://github.com/gwenzek/SublimeSetWindowTitle/pull/16
#elif PLATFORM == "windows":
#SetWindowTitle().run(sublime.active_window().active_view())
# TODO: Find how to update window title on plugin loaded for Windows without freezing.
# Both regresh_all and refreshing only the current window fail.
# https://github.com/gwenzek/SublimeSetWindowTitle/issues/15
# refresh current: SetWindowTitle().run(sublime.active_window().active_view())
if PLATFORM != "linux":
return

# Update all window titles on setting change.
settings = sublime.load_settings("set_window_title.sublime-settings")
setting_keys = [
"unregistered",
"template",
"has_project_true",
"has_project_false",
"is_dirty_true",
"is_dirty_false",
"path_display",
"untitled",
]
for k in setting_keys:
settings.add_on_change(k, refresh_all)

# Update all window titles on plugin loaded for Linux.
refresh_all()


def refresh_all():
Expand Down Expand Up @@ -149,6 +149,7 @@ def rename_window_windows(self, new_title):
if(hwndSublime):
ctypes.windll.user32.SetWindowTextW(hwndSublime, new_title)


def get_project(window):
"""Returns the project name for the given window.
Expand Down

0 comments on commit 86e9f87

Please sign in to comment.