Skip to content

Commit 192dcd0

Browse files
FichteFollclaude
andcommitted
Add a setting that disables the tab preview
With `preview_tabs` set to `false`, highlighting an entry in the quick panel no longer switches to its tab; the selection is only applied when the switch is committed. Closes #11 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 7091e9f commit 192dcd0

5 files changed

Lines changed: 30 additions & 2 deletions

File tree

‎AGENTS.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
It reuses an open instructions view (marked by the `tab_stack_setup_instructions` view setting) and selects it together with the source, instructions on the left.
2828
The plugin never runs `sudo`, a compiler or `setcap`; the user installs the helper to `keystate_helper_path` (default `/usr/local/libexec/tabstack-keystate`) with `cap_dac_read_search`, which the helper drops right after opening the input devices.
2929
- `tab_stack_open` arms a pending session, starts a Ctrl-release poller, and opens the quick panel after a short delay unless Ctrl is released first.
30+
- Highlighting a quick-panel entry previews its tab via `preview_entry`, unless `preview_tabs` is `false`; the selection is then only applied on commit.
3031
- Wrap-around cycling is implemented by intentionally closing and reopening the quick panel at the opposite boundary.
3132
That handoff keeps the session active and reuses the existing Ctrl-release poller.
3233
- `tab_stack.session_active` is the quick-panel session context key.

‎README.md‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
TabStack is a [Sublime Text][] (build 4100+) package
44
for switching between open tabs using an MRU-style stack.
55
It keeps tab order per window
6-
and previews tabs in the quick panel
6+
and, optionally, previews tabs in the quick panel
77
before committing the switch.
88
It also preserves tab ordering across sessions
99
and supports multiple selections.
@@ -39,6 +39,19 @@ Release `ctrl` to commit the selected tab.
3939
Press `ctrl+escape` to cancel.
4040

4141

42+
## Settings
43+
44+
In `TabStack.sublime-settings`,
45+
which `Preferences: TabStack Settings` opens from the Command Palette:
46+
47+
- `preview_tabs`:
48+
set to `false` to stay on the current tab while moving through the quick panel.
49+
The highlighted tab is then only shown once the switch is committed.
50+
51+
The settings for the Ctrl-release helper
52+
are described under [Wayland Setup](#wayland-setup).
53+
54+
4255
## Platform Support
4356

4457
TabStack supports **Linux, Windows, and macOS**.

‎TabStack.sublime-settings‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
{
2+
// Switch to the highlighted tab while the quick panel is open.
3+
// When `false`, the tab only changes once the switch is committed.
4+
"preview_tabs": true,
5+
26
// Path to the `tabstack-keystate` helper that detects Ctrl releases on Linux.
37
// It is used whenever it works, and it is required under native Wayland.
48
"keystate_helper_path": "/usr/local/libexec/tabstack-keystate",

‎plugin/session.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
CTRL_STATE_TIMEOUT_MS = 1000
1313
CTRL_STATE_RETRY_MS = 10
1414

15+
_SETTINGS_FILE = "TabStack.sublime-settings"
16+
1517

1618
def _ensure_ctrl_release_poller(window: sublime.Window, state: TabStackWindowState) -> None:
1719
if state.ctrl_release_poller:
@@ -45,6 +47,8 @@ def show_panel(window: sublime.Window, state: TabStackWindowState) -> None:
4547
for entry in entries
4648
]
4749

50+
preview_tabs = bool(sublime.load_settings(_SETTINGS_FILE).get("preview_tabs", True))
51+
4852
def on_select(index: int) -> None:
4953
if index < 0:
5054
handle_panel_closed(window, state)
@@ -56,7 +60,8 @@ def on_highlight(index: int) -> None:
5660
if index < 0 or index >= len(entries):
5761
return
5862
state.session_selected_index = index
59-
preview_entry(window, state)
63+
if preview_tabs:
64+
preview_entry(window, state)
6065

6166
window.show_quick_panel(
6267
items,

‎sublime-package.json‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
"$id": "sublime://settings/TabStack",
88
"type": "object",
99
"properties": {
10+
"preview_tabs": {
11+
"type": "boolean",
12+
"default": true,
13+
"markdownDescription": "Switch to the highlighted tab while the quick panel is open.\n\nWhen `false`, the tab only changes once the switch is committed."
14+
},
1015
"keystate_helper_path": {
1116
"type": "string",
1217
"default": "/usr/local/libexec/tabstack-keystate",

0 commit comments

Comments
 (0)