Skip to content

armgit / Wake

Public Imported from GitHub
0

All your AI agent sessions in one place — browse, search, resume. Rust + GPUI.

Rust

Unify the window chrome

Corey Chiuc92ecccb5db1
diff --git a/DESIGN.md b/DESIGN.md
index 31cb1f4..603a58e 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -37,12 +37,12 @@ Wake 的目标不是展示技术感,而是让用户在几秒内重新找到并
|---|---|
| 默认窗口 | 1180 × 760,居中(14" 屏约占 78% × 77%) |
| 最小窗口 | 940 × 620 |
-| 窗口顶部 | macOS 不设全宽标题栏,交通灯与拖拽区收在侧栏顶部;Windows 用原生标题栏,Linux 视 compositor 装饰协商而定 |
+| 窗口顶部 | 内容区使用贯穿三栏的 34px chrome;macOS 交通灯嵌入左段,Windows 原生标题栏保留在其外,Linux 视 compositor 装饰协商而定 |
| 资料库侧栏 | 224px 固定宽度 |
| 会话流 | 336px 固定宽度 |
| 阅读区 | 剩余宽度,`min_w(0)`;正文最大宽度 720px |
-窗口不绘制全宽标题栏。侧栏承接交通灯、窗口拖拽区和唯一的全文搜索入口;会话流与阅读区直接延伸到窗口顶部。侧栏、会话流、详情头和正文分别使用 `sidebar`、`list`、`background`、`popover` 材质表达层级,不加投影。
+窗口内容顶部先绘制一条统一的 34px chrome:左段承接交通灯与 Wake,中段承接当前范围、会话数和排序,右段承接来源上下文与当前会话操作;三段共享高度、材质、底部分隔和拖拽区域。chrome 下方的侧栏、会话流、详情头和正文再分别使用 `sidebar`、`list`、`background`、`popover` 材质表达层级,不加投影。
## 颜色
@@ -52,7 +52,7 @@ Wake 的目标不是展示技术感,而是让用户在几秒内重新找到并
| token | 浅色 | 深色 | 用途 |
|---|---:|---:|---|
-| `title_bar` | `#EDEDEA` | `#1B1B1A` | 侧栏顶部窗口拖拽区 |
+| `title_bar` | `#EDEDEA` | `#1B1B1A` | 贯穿三栏的窗口顶部 chrome |
| `sidebar` | `#EDEDEA` | `#1B1B1A` | 资料库侧栏 |
| `list` | `#F7F7F5` | `#20201F` | 会话流 |
| `background` | `#F1F1EF` | `#242422` | 阅读区外层 |
@@ -121,11 +121,11 @@ UI 语言英文;会话正文保持原语言。元信息分隔符固定为前后
### 窗口顶部
-macOS 不设置横跨三栏的自定义 header。系统交通灯保留在侧栏顶部,其所在拖拽区与侧栏使用完全相同的材质和颜色;会话流与阅读区不为标题栏预留另一条色带。Windows 保留系统原生标题栏(贴靠布局与深色模式经 DWM 处理);Linux 由 compositor 装饰协商决定,报 Client 时侧栏顶部挂自绘 TitleBar。
+内容区顶部固定为 34px:三栏均使用 `title_bar` 材质、同一条底部 hairline 和垂直中心线。macOS 左段复用真实 TitleBar,把 Wake 放在交通灯之后;中段依次放当前范围与会话数,排序靠右;右段依次放 Agent、项目、分支,当前会话操作靠右。未选择会话时右段仍保留空 chrome,不能让顶栏在中栏末端突然断开。Windows 保留系统原生标题栏(贴靠布局与深色模式经 DWM 处理),内容区下方仍使用同一条 34px chrome;Linux 由 compositor 装饰协商决定,报 Client 时左段使用自绘 TitleBar。
### 资料库侧栏
-- 顶部是唯一的全文搜索入口,文案 "Search sessions",右侧显示 `⌘K`;Search/All Sessions/Starred 固定不随滚动。
+- 顶部 chrome 在交通灯后显示 Wake;其下是唯一的全文搜索入口,文案 "Search sessions",右侧显示 `⌘K`;Search/All Sessions/Starred 固定不随滚动。
- 搜索行必须有防溢出结构:标签文字 `flex_1 + min_w_0 + truncate`,图标与 `⌘K` 徽标显式 `flex_shrink_0`。裸文字子元素的最小宽度被内容锁死,侧栏一窄就会把右侧元素挤出边界裁掉。
- **行分两级**(侧栏纵向层级的来源,不得拉平):主导航 All Sessions/Starred 32px 行高 + Body 14;分组展开项(agent/项目)26px 行高 + Caption 12 + 整行右移 `SUB_INDENT` 12px 表达从属。
- **每行必须有行首元素**,由 `RowLead` 枚举强制(`Icon` 或 `Brand` 两态,无 `None`):主导航用 Lucide 单线图标,agent 行用品牌 PNG,项目行用 `folder.svg`。槽位定宽 `LEAD_BOX` 管右侧文字起点统一,槽内居中管中轴对齐。
@@ -140,8 +140,7 @@ macOS 不设置横跨三栏的自定义 header。系统交通灯保留在侧栏
### 会话流
-- 顶部由 22px 上下文标题、会话总数角标和 icon-only 排序按钮组成;排序按钮与详情工具栏统一为 16px 图标、透明 ghost 常态、6px 圆角,当前排序字段和方向放在 tooltip 与菜单选中态中。
-- 会话流固定 336px;顶部使用 22px 上下文标题、Label 11 会话数量和 icon-only 排序按钮。
+- 会话流固定 336px;顶部 chrome 使用 Body 14 semibold 上下文标题、Label 11 会话数量和 icon-only 排序按钮,三者单行垂直居中。排序按钮与详情工具栏统一为 16px 图标、透明 ghost 常态、6px 圆角,当前排序字段和方向放在 tooltip 与菜单选中态中。
- 会话行使用 Body 14 标题与 Label 11 元信息,共两行;行内 `SPACE_SM` 上下内边距 + `SPACE_XS` 两行间距。
- 第二行固定为品牌图标 15px、项目名 badge、弹性空隙和右对齐相对时间。
- 分支、token 和归档状态不在列表重复展示,移入详情元信息。
@@ -153,13 +152,13 @@ macOS 不设置横跨三栏的自定义 header。系统交通灯保留在侧栏
层级从上到下为:
-1. Agent、项目、分支等来源上下文与右侧操作工具条。
+1. 34px 顶部 chrome 中的 Agent、项目、分支等来源上下文与右侧操作工具条;两组必须处于同一个 Flex 行,不使用绝对定位或负偏移。
2. 独占整行、最多两行的 22px 会话标题。
3. 独占一行的项目路径。
4. 模型、来源 badge 与消息数、token 组成的统计行。
5. 精确到秒的创建时间与更新时间;两者作为同一组从信息区左边界依次排列。
-五层信息一项不减,但不可压回同一横行。层内保持紧凑,层间至少 8–12px,让来源、标题、位置、运行统计和时间上下文能被分别扫读。
+五层信息一项不减。第一层属于全窗 chrome,后四层属于独立的详情信息区;层内保持紧凑,层间至少 8–12px,让来源、标题、位置、运行统计和时间上下文能被分别扫读。
“在终端继续”是唯一主按钮。收藏、置顶保留为独立图标按钮;导出、Finder 和删除进入“更多”菜单。按钮圆角固定 6px,危险操作在菜单中用分组隔开并继续走确认框。
diff --git a/crates/wake/src/ui.rs b/crates/wake/src/ui.rs
index a0ef506..62adc47 100644
--- a/crates/wake/src/ui.rs
+++ b/crates/wake/src/ui.rs
@@ -124,10 +124,6 @@ pub const SUB_INDENT: Pixels = px(12.);
/// 12.125 实测落位 −0.125;调到 12.25 反而变成 +0.375——2x 屏光栅化步长是
/// 0.5px,两者落进不同物理像素,别再往小数点后调了。
pub const GROUP_HEAD_INSET: Pixels = px(12.125);
-/// 侧栏标题 "Wake" 的左内边距:同样让首字母 W 的字形中心落在轴上。
-/// 实测 16px semibold 的 W 宽 14.25、左承距 0.5,文字左缘需 19.65;
-/// 减去容器的 SIDEBAR_EDGE 得 9.15,取 9.0(2x 屏下 0.5px 以下的差会被光栅化吃掉)。
-pub const TITLE_INSET: Pixels = px(9.);
/// 侧栏主导航行高(固定区:All Sessions/Starred;搜索框同高)
pub const ROW_HEIGHT: Pixels = px(32.);
/// 侧栏子级行高(分组展开项:agent/项目)——比主导航低一级,
diff --git a/crates/wake/src/workbench.rs b/crates/wake/src/workbench.rs
index 0ed04e5..58f2440 100644
--- a/crates/wake/src/workbench.rs
+++ b/crates/wake/src/workbench.rs
@@ -70,6 +70,9 @@ pub const PALETTE_CONTEXT: &str = "WakePalette";
const PALETTE_HEIGHT: Pixels = px(492.);
/// location 表单标签列宽(Agent/Folder 两行共用)
const FORM_LABEL_W: Pixels = px(52.);
+/// gpui-component TitleBar 的固定高度。中栏与详情栏用同一高度延续窗口 chrome;
+/// 依赖升级若修改 TitleBar::TITLE_BAR_HEIGHT,需同步此值。
+const WINDOW_CHROME_HEIGHT: Pixels = px(34.);
type SharedAdapters = Arc<Vec<Box<dyn AgentAdapter>>>;
type SharedLocations = Arc<Vec<AdapterLocation>>;
@@ -2258,24 +2261,39 @@ impl Workbench {
.h_full()
.flex_shrink_0()
.bg(theme.sidebar)
- // 压平 titlebar 靠 theme.rs 的 title_bar/title_bar_border token,不再叠加覆写
- .when(show_titlebar, |this| this.child(TitleBar::new()))
- .child(
- div()
- .flex_shrink_0()
- .px(SIDEBAR_EDGE)
- .pt(SPACE_SM)
- .pb(SPACE_MD)
- .child(
- div()
- .pl(TITLE_INSET)
- .pr(SIDEBAR_EDGE)
- .text_size(FONT_HEADING)
- .font_semibold()
- .text_color(theme.foreground)
- .child("Wake"),
- ),
- )
+ // 三栏共用 34px 顶部 chrome。macOS / CSD 直接把品牌放进真实
+ // TitleBar;有系统标题栏的平台补同高栏,保证内容区仍是同一骨架。
+ .when(show_titlebar, |this| {
+ this.child(
+ TitleBar::new()
+ .bg(theme.title_bar)
+ .border_color(theme.border)
+ .child(
+ div()
+ .pl(SPACE_SM)
+ .text_size(FONT_BODY)
+ .font_semibold()
+ .text_color(theme.foreground)
+ .child("Wake"),
+ ),
+ )
+ })
+ .when(!show_titlebar, |this| {
+ this.child(
+ h_flex()
+ .h(WINDOW_CHROME_HEIGHT)
+ .flex_shrink_0()
+ .px(SPACE_LG)
+ .items_center()
+ .border_b_1()
+ .border_color(theme.border)
+ .bg(theme.title_bar)
+ .text_size(FONT_BODY)
+ .font_semibold()
+ .text_color(theme.foreground)
+ .child("Wake"),
+ )
+ })
.child(
div().flex_shrink_0().px(SIDEBAR_EDGE).pb(SPACE_MD).child(
h_flex().gap(SPACE_SM).child(
@@ -2566,36 +2584,41 @@ impl Workbench {
.flex_shrink_0()
.bg(theme.list)
.child(
- v_flex()
+ h_flex()
.id("list-header")
.w_full()
+ .h(WINDOW_CHROME_HEIGHT)
.flex_shrink_0()
.window_control_area(WindowControlArea::Drag)
.px(SPACE_LG)
- .pt(SPACE_XL)
- .pb(SPACE_MD)
+ .items_center()
+ .justify_between()
+ .gap(SPACE_MD)
+ .border_b_1()
+ .border_color(theme.border)
+ .bg(theme.title_bar)
.child(
h_flex()
- .items_start()
- .justify_between()
+ .min_w_0()
+ .items_center()
+ .gap(SPACE_SM)
.child(
- v_flex()
- .gap(px(2.))
- .child(
- div()
- .text_size(FONT_TITLE)
- .font_semibold()
- .child(self.context_title()),
- )
- .child(
- div()
- .text_size(FONT_LABEL)
- .text_color(theme.muted_foreground)
- .child(shown_label),
- ),
+ div()
+ .min_w_0()
+ .truncate()
+ .text_size(FONT_BODY)
+ .font_semibold()
+ .child(self.context_title()),
)
- .child(div().pt(px(2.)).child(sort_menu)),
- ),
+ .child(
+ div()
+ .flex_shrink_0()
+ .text_size(FONT_LABEL)
+ .text_color(theme.muted_foreground)
+ .child(shown_label),
+ ),
+ )
+ .child(div().flex_shrink_0().child(sort_menu)),
)
.child(if shown == 0 {
if library_empty && self.scan.scanning {
@@ -2838,27 +2861,37 @@ impl Workbench {
return v_flex()
.flex_1()
.h_full()
- .items_center()
- .justify_center()
.bg(theme.background)
.child(
- div()
- .w(px(360.))
- .px(SPACE_XXL)
- .py(SPACE_XXL)
- .rounded(theme.radius_lg)
- .bg(theme.popover)
- .child(empty_state(
- "icons/message-square.svg",
- px(58.),
- px(26.),
- "No session selected",
- format!(
- "Pick one from the list, or press {} to search.",
- search_key_hint()
- ),
- cx,
- )),
+ h_flex()
+ .w_full()
+ .h(WINDOW_CHROME_HEIGHT)
+ .flex_shrink_0()
+ .window_control_area(WindowControlArea::Drag)
+ .border_b_1()
+ .border_color(theme.border)
+ .bg(theme.title_bar),
+ )
+ .child(
+ v_flex().flex_1().items_center().justify_center().child(
+ div()
+ .w(px(360.))
+ .px(SPACE_XXL)
+ .py(SPACE_XXL)
+ .rounded(theme.radius_lg)
+ .bg(theme.popover)
+ .child(empty_state(
+ "icons/message-square.svg",
+ px(58.),
+ px(26.),
+ "No session selected",
+ format!(
+ "Pick one from the list, or press {} to search.",
+ search_key_hint()
+ ),
+ cx,
+ )),
+ ),
)
.into_any_element();
};
@@ -2944,225 +2977,233 @@ impl Workbench {
.h_full()
.bg(theme.background)
.child(
- v_flex()
- .id("detail-header")
+ h_flex()
+ .id("detail-chrome")
+ .w_full()
+ .h(WINDOW_CHROME_HEIGHT)
.flex_shrink_0()
- .relative()
.window_control_area(WindowControlArea::Drag)
- .px(SPACE_XXL)
- .pt(SPACE_XL)
- .pb(SPACE_XL)
+ .px(SPACE_LG)
+ .items_center()
+ .justify_between()
.gap(SPACE_MD)
.border_b_1()
.border_color(theme.border)
+ .bg(theme.title_bar)
.child(
h_flex()
+ .flex_1()
.min_w_0()
- .pr(px(156.))
.gap(SPACE_SM)
.items_center()
.text_size(FONT_LABEL)
.text_color(theme.muted_foreground)
- .child(img(meta.agent.brand_icon(theme.mode.is_dark())).size(px(15.)).flex_shrink_0())
+ .child(
+ img(meta.agent.brand_icon(theme.mode.is_dark()))
+ .size(px(15.))
+ .flex_shrink_0(),
+ )
.child(div().flex_shrink_0().child(meta.agent.display_name()))
- .child(badge(meta.project_name.clone(), theme.muted, theme.muted_foreground))
+ .child(badge(
+ meta.project_name.clone(),
+ theme.muted,
+ theme.muted_foreground,
+ ))
.when_some(meta.git_branch.clone(), |this, branch| {
this.child(
h_flex()
.min_w_0()
.gap(SPACE_XS)
- .child(icon("icons/git-branch.svg").with_size(px(11.)).flex_shrink_0())
+ .child(
+ icon("icons/git-branch.svg")
+ .with_size(px(11.))
+ .flex_shrink_0(),
+ )
.child(div().min_w_0().truncate().child(branch)),
)
}),
)
.child(
h_flex()
- .items_start()
- .justify_between()
- .gap(SPACE_LG)
- .child(
- div()
- .flex_1()
- .min_w_0()
- .max_h(px(54.))
- .overflow_hidden()
- .text_size(FONT_TITLE)
- .line_height(relative(1.15))
- .font_semibold()
- .child(meta.title.clone()),
- )
- .child(
+ .flex_shrink_0()
+ .gap(SPACE_XS)
+ .child({
+ // Open In split 按钮(Codex/kooky 风):左段 = 上次
+ // 目标的应用图标,点击直开;右段 chevron 展开列表。
+ // 目标列表按 agent 过滤(Kooky 深链不认 dsh);
+ // 偏好目标不在列表时(如 dsh 会话 + 偏好 Kooky)回退首项
+ let terms = terminal::terminals_for(meta.agent);
+ let current = self
+ .preferred_terminal
+ .filter(|t| terms.contains(t))
+ .or_else(|| terms.first().copied());
+ // 偏好已存在时 current 要么就是它、要么是回退值,
+ // 两种情况点左段都不该改写偏好(见 do_resume)
+ let remember_current = self.preferred_terminal.is_none();
+ let current_icon =
+ current.and_then(|t| self.terminal_icons.get(t.id()).cloned());
+ let term_items: Vec<(terminal::TerminalApp, Option<PathBuf>)> =
+ terms
+ .iter()
+ .map(|t| (*t, self.terminal_icons.get(t.id()).cloned()))
+ .collect();
+ let menu_entity = cx.entity();
+ // 无常显分隔线,hover 分段高亮暗示两段(Codex 同款);
+ // 右段 Button 用 custom variant 与左段 hover 完全一致
h_flex()
- .absolute()
- // 当前元素属于标题行,回移到上一层来源行。先按几何
- // 中心线对齐,再向上补 3px,抵消按钮描边带来的视觉下沉。
- .top(-px(36.5))
- .right(SPACE_XXL)
- .flex_shrink_0()
- .gap(SPACE_XS)
- .child({
- // Open In split 按钮(Codex/kooky 风):左段 = 上次
- // 目标的应用图标,点击直开;右段 chevron 展开列表。
- // 目标列表按 agent 过滤(Kooky 深链不认 dsh);
- // 偏好目标不在列表时(如 dsh 会话 + 偏好 Kooky)回退首项
- let terms = terminal::terminals_for(meta.agent);
- let current = self
- .preferred_terminal
- .filter(|t| terms.contains(t))
- .or_else(|| terms.first().copied());
- // 偏好已存在时 current 要么就是它、要么是回退值,
- // 两种情况点左段都不该改写偏好(见 do_resume)
- let remember_current = self.preferred_terminal.is_none();
- let current_icon = current
- .and_then(|t| self.terminal_icons.get(t.id()).cloned());
- let term_items: Vec<(terminal::TerminalApp, Option<PathBuf>)> =
- terms
- .iter()
- .map(|t| {
- (*t, self.terminal_icons.get(t.id()).cloned())
- })
- .collect();
- let menu_entity = cx.entity();
- // 无常显分隔线,hover 分段高亮暗示两段(Codex 同款);
- // 右段 Button 用 custom variant 与左段 hover 完全一致
- h_flex()
- .h(px(28.))
- .rounded(RADIUS_BUTTON)
- .border_1()
- .border_color(theme.border)
- .bg(theme.secondary)
- .overflow_hidden()
- .child(
- div()
- .id("open-in-main")
- .h_full()
- .px(px(7.))
- .flex()
- .items_center()
- .cursor_pointer()
- .hover(|s| s.bg(theme.secondary_hover))
- .active(|s| s.bg(theme.secondary_active))
- .child(match &current_icon {
- Some(p) => img(p.clone())
- .size(px(14.))
- .into_any_element(),
- None => icon("icons/terminal.svg")
- .with_size(px(13.))
- .text_color(theme.secondary_foreground)
- .into_any_element(),
- })
- .tooltip({
- let label: SharedString = match current {
- Some(t) => format!("Open this session in {}", t.display_name()).into(),
- None => "Open this session".into(),
- };
- move |window, cx| {
- gpui_component::tooltip::Tooltip::new(label.clone()).build(window, cx)
- }
- })
- .on_click(cx.listener(move |this, _, window, cx| {
- if let Some(term) = current {
- this.do_resume(term, remember_current, window, cx);
- } else {
- // 空列表在 macOS 不可能(Terminal.app 恒在),
- // Windows/Linux 上 PATH 被启动器改写时会发生
- // ——静默无操作是死按钮,至少说一声为什么
- window.push_notification(
- Notification::warning(
- "No terminal application found on PATH",
- ),
- cx,
- );
- }
- })),
- )
- .child(
- div()
- .w(px(1.))
- .h_full()
- .flex_shrink_0()
- .bg(theme.border),
- )
- .child(
- Button::new("open-in-more")
- .custom(
- ButtonCustomVariant::new(cx)
- .foreground(theme.muted_foreground)
- .hover(theme.secondary_hover)
- .active(theme.secondary_active),
+ .h(px(28.))
+ .rounded(RADIUS_BUTTON)
+ .border_1()
+ .border_color(theme.border)
+ .bg(theme.secondary)
+ .overflow_hidden()
+ .child(
+ div()
+ .id("open-in-main")
+ .h_full()
+ .px(px(7.))
+ .flex()
+ .items_center()
+ .cursor_pointer()
+ .hover(|s| s.bg(theme.secondary_hover))
+ .active(|s| s.bg(theme.secondary_active))
+ .child(match &current_icon {
+ Some(p) => {
+ img(p.clone()).size(px(14.)).into_any_element()
+ }
+ None => icon("icons/terminal.svg")
+ .with_size(px(13.))
+ .text_color(theme.secondary_foreground)
+ .into_any_element(),
+ })
+ .tooltip({
+ let label: SharedString = match current {
+ Some(t) => format!(
+ "Open this session in {}",
+ t.display_name()
)
- .rounded(px(0.))
- .h(px(26.))
- .w(px(22.))
- .icon(
- icon("icons/chevron-down.svg")
- .with_size(px(12.)),
+ .into(),
+ None => "Open this session".into(),
+ };
+ move |window, cx| {
+ gpui_component::tooltip::Tooltip::new(
+ label.clone(),
)
- .tooltip("Open this session in…")
- .dropdown_menu(move |menu, _, _| {
- let mut menu = menu.min_w(px(170.));
- for (term, icon_path) in term_items.clone() {
- let entity = menu_entity.clone();
- menu = menu.item(
- PopupMenuItem::element(move |_, _| {
- h_flex()
- .gap(SPACE_SM)
- .items_center()
- .child(match &icon_path {
- Some(p) => img(p.clone())
- .size(px(16.))
- .into_any_element(),
- None => icon("icons/terminal.svg")
- .with_size(px(15.))
- .into_any_element(),
- })
- .child(term.display_name())
- })
- .on_click(move |_, window, cx| {
- entity.update(cx, |this, cx| {
- this.do_resume(term, true, window, cx);
- });
- }),
- );
- }
- menu
- })
- .anchor(Corner::TopRight),
+ .build(window, cx)
+ }
+ })
+ .on_click(cx.listener(move |this, _, window, cx| {
+ if let Some(term) = current {
+ this.do_resume(
+ term,
+ remember_current,
+ window,
+ cx,
+ );
+ } else {
+ // 空列表在 macOS 不可能(Terminal.app 恒在),
+ // Windows/Linux 上 PATH 被启动器改写时会发生
+ // ——静默无操作是死按钮,至少说一声为什么
+ window.push_notification(
+ Notification::warning(
+ "No terminal application found on PATH",
+ ),
+ cx,
+ );
+ }
+ })),
+ )
+ .child(
+ div().w(px(1.)).h_full().flex_shrink_0().bg(theme.border),
+ )
+ .child(
+ Button::new("open-in-more")
+ .custom(
+ ButtonCustomVariant::new(cx)
+ .foreground(theme.muted_foreground)
+ .hover(theme.secondary_hover)
+ .active(theme.secondary_active),
)
- })
- .child(tool_btn(
- "fav",
- "icons/star.svg",
- "icons/star-filled.svg",
- rgb(crate::theme::STAR_YELLOW).into(),
- if meta.favorite {
- "Unstar"
- } else {
- "Star"
- },
- meta.favorite,
- cx.listener(|this, _, window, cx| {
- this.toggle_favorite(window, cx)
- }),
- ))
- .child(tool_btn(
- "pin",
- "icons/pin.svg",
- "icons/pin-filled.svg",
- theme.primary,
- if meta.pinned {
- "Unpin"
- } else {
- "Pin"
- },
- meta.pinned,
- cx.listener(|this, _, window, cx| {
- this.toggle_pinned(window, cx)
- }),
- ))
- .child(more_menu),
- ),
+ .rounded(px(0.))
+ .h(px(26.))
+ .w(px(22.))
+ .icon(icon("icons/chevron-down.svg").with_size(px(12.)))
+ .tooltip("Open this session in…")
+ .dropdown_menu(move |menu, _, _| {
+ let mut menu = menu.min_w(px(170.));
+ for (term, icon_path) in term_items.clone() {
+ let entity = menu_entity.clone();
+ menu = menu.item(
+ PopupMenuItem::element(move |_, _| {
+ h_flex()
+ .gap(SPACE_SM)
+ .items_center()
+ .child(match &icon_path {
+ Some(p) => img(p.clone())
+ .size(px(16.))
+ .into_any_element(),
+ None => {
+ icon("icons/terminal.svg")
+ .with_size(px(15.))
+ .into_any_element()
+ }
+ })
+ .child(term.display_name())
+ })
+ .on_click(move |_, window, cx| {
+ entity.update(cx, |this, cx| {
+ this.do_resume(
+ term, true, window, cx,
+ );
+ });
+ }),
+ );
+ }
+ menu
+ })
+ .anchor(Corner::TopRight),
+ )
+ })
+ .child(tool_btn(
+ "fav",
+ "icons/star.svg",
+ "icons/star-filled.svg",
+ rgb(crate::theme::STAR_YELLOW).into(),
+ if meta.favorite { "Unstar" } else { "Star" },
+ meta.favorite,
+ cx.listener(|this, _, window, cx| this.toggle_favorite(window, cx)),
+ ))
+ .child(tool_btn(
+ "pin",
+ "icons/pin.svg",
+ "icons/pin-filled.svg",
+ theme.primary,
+ if meta.pinned { "Unpin" } else { "Pin" },
+ meta.pinned,
+ cx.listener(|this, _, window, cx| this.toggle_pinned(window, cx)),
+ ))
+ .child(more_menu),
+ ),
+ )
+ .child(
+ v_flex()
+ .id("detail-header")
+ .flex_shrink_0()
+ .px(SPACE_XXL)
+ .pt(SPACE_LG)
+ .pb(SPACE_XL)
+ .gap(SPACE_MD)
+ .border_b_1()
+ .border_color(theme.border)
+ .child(
+ div()
+ .min_w_0()
+ .max_h(px(54.))
+ .overflow_hidden()
+ .text_size(FONT_TITLE)
+ .line_height(relative(1.15))
+ .font_semibold()
+ .child(meta.title.clone()),
)
.child(
v_flex()
@@ -3176,9 +3217,7 @@ impl Workbench {
.min_w_0()
.gap(px(6.))
.child(
- icon("icons/folder.svg")
- .with_size(px(12.))
- .flex_shrink_0(),
+ icon("icons/folder.svg").with_size(px(12.)).flex_shrink_0(),
)
.child(div().min_w_0().truncate().child(detail_path)),
)
@@ -3204,12 +3243,7 @@ impl Workbench {
this.child(outline_badge(source, color))
},
)
- .child(
- div()
- .min_w_0()
- .truncate()
- .child(detail_fact_line),
- ),
+ .child(div().min_w_0().truncate().child(detail_fact_line)),
)
.when(created_time.is_some() || updated_time.is_some(), |this| {
this.child(