Skip to content

feat(sidebar): middle-click to close workspace / 中键关闭工作区 - #94

Merged
chenbstack merged 1 commit into
chenbstack:mainfrom
Rladmsrl:feat/middle-click-close-workspace
Jul 30, 2026
Merged

feat(sidebar): middle-click to close workspace / 中键关闭工作区#94
chenbstack merged 1 commit into
chenbstack:mainfrom
Rladmsrl:feat/middle-click-close-workspace

Conversation

@Rladmsrl

Copy link
Copy Markdown
Contributor

变更内容 / Summary

在侧边栏工作区卡片上添加中键点击关闭功能,等同于右键菜单的「关闭工作区」。新增设置开关(Settings → General → Workspace),默认开启,可在设置中关闭。

  • 新增 MiddleClickCatcher (NSViewRepresentable):透明覆盖层,仅在按下中键时拦截事件,左/右键、拖拽、hover、右键菜单均不受影响
  • 新增持久化设置 glint.middleClickClosesWorkspace(默认 true),在 Workspace 设置卡片中暴露开关
  • 中文本地化已补齐

验证方式 / Testing

  • Release 构建后启动,中键点击工作区卡片 → 触发关闭(含 busy 确认对话框)
  • 设置中关闭开关 → 中键不再触发关闭,事件穿透到下层视图
  • 归档工作区卡片不挂载 catcher(归档卡片暴露 Unarchive/Delete)
  • 编辑名称时不挂载 catcher
  • 左键选中、右键菜单、拖拽排序均正常

关联议题 / Related issues

N/A

Add a MiddleClickCatcher NSViewRepresentable overlay on workspace cards
that fires deleteWorkspace on middle-mouse press. Transparent to all
other input (hitTest returns nil unless button 2 is down) so left/right
click, drag, hover, and context menu are unaffected.

Gated behind a new setting (Settings → General → Workspace →
"Middle-click closes workspace"), persisted as
glint.middleClickClosesWorkspace, default on.

zh-Hans localization included.
@chenbstack
chenbstack merged commit f9e36c6 into chenbstack:main Jul 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants