diff --git a/README.md b/README.md index b9090c5..e80cba0 100644 --- a/README.md +++ b/README.md @@ -31,4 +31,15 @@ The easiest way to install is using [Package Control](https://packagecontrol.io) 2. Type `Switch: Window` and hit enter or hit ctrl+k, ctrl+tab in sequence -to show the `Switch Window` Quick Panel directly. \ No newline at end of file +to show the `Switch Window` Quick Panel directly. + +## Kind Info + +The kind of a window is displayed via icon. + +| icon | description +|:----:|:--- +| P | A project/workspace is opened in the window +| F | One or more folders are opened in the window. The best matching one according to the active file is displayed in description line. +| f | A file is displayed in active view of a window, which has no project or folder open. +| S | An unsaved view is displayed in active view of a window, which has no project or folder open. \ No newline at end of file diff --git a/preview.png b/preview.png index 32ade8b..c98b5e1 100644 Binary files a/preview.png and b/preview.png differ diff --git a/switch_window.py b/switch_window.py index 4179fdb..1696abb 100644 --- a/switch_window.py +++ b/switch_window.py @@ -16,7 +16,9 @@ def list_items(self): items = [] kind_project = [sublime.KIND_ID_NAMESPACE, "P", "Project"] - kind_file = [sublime.KIND_ID_NAVIGATION, "F", "File"] + kind_folder = [sublime.KIND_ID_NAMESPACE, "F", "Folder"] + kind_file = [sublime.KIND_ID_NAVIGATION, "f", "File"] + kind_scratch = [sublime.KIND_ID_AMBIGUOUS, "S", "Scratch"] active_window = sublime.active_window() for window in sublime.windows(): @@ -41,10 +43,10 @@ def list_items(self): else: title = active_file_name - kind = kind_file folders = window.folders() if folders: + kind = kind_folder for folder in window.folders(): if active_file_name.startswith(folder): second_line = f"Folder: {folder}" @@ -52,9 +54,11 @@ def list_items(self): else: second_line = f"Folder: {folders[0]}" elif active_file_location: + kind = kind_file second_line = f"Location: {active_file_location}" else: - second_line = "Scratch" + kind = kind_scratch + second_line = "Scratch Window" items.append( sublime.ListInputItem(