Skip to content

Commit 9b28cf7

Browse files
committed
change tab position from context menu
1 parent f61531d commit 9b28cf7

3 files changed

Lines changed: 20 additions & 1 deletion

File tree

frontend/app/tab/tab.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@ import { buildTabContextMenu } from "./tabcontextmenu";
1919
export type TabEnv = WaveEnvSubset<{
2020
rpc: {
2121
ActivityCommand: WaveEnv["rpc"]["ActivityCommand"];
22+
SetConfigCommand: WaveEnv["rpc"]["SetConfigCommand"];
2223
SetMetaCommand: WaveEnv["rpc"]["SetMetaCommand"];
2324
UpdateTabNameCommand: WaveEnv["rpc"]["UpdateTabNameCommand"];
2425
};
2526
atoms: {
2627
fullConfigAtom: WaveEnv["atoms"]["fullConfigAtom"];
2728
};
2829
wos: WaveEnv["wos"];
30+
getSettingsKeyAtom: WaveEnv["getSettingsKeyAtom"];
2931
showContextMenu: WaveEnv["showContextMenu"];
3032
}>;
3133

frontend/app/tab/tabcontextmenu.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,22 @@ function buildTabContextMenu(
8585
}
8686
menu.push({ label: "Backgrounds", type: "submenu", submenu }, { type: "separator" });
8787
}
88+
const currentTabBar = globalStore.get(env.getSettingsKeyAtom("app:tabbar")) ?? "top";
89+
const tabBarSubmenu: ContextMenuItem[] = [
90+
{
91+
label: "Top",
92+
type: "checkbox",
93+
checked: currentTabBar === "top",
94+
click: () => fireAndForget(() => env.rpc.SetConfigCommand(TabRpcClient, { "app:tabbar": "top" })),
95+
},
96+
{
97+
label: "Left",
98+
type: "checkbox",
99+
checked: currentTabBar === "left",
100+
click: () => fireAndForget(() => env.rpc.SetConfigCommand(TabRpcClient, { "app:tabbar": "left" })),
101+
},
102+
];
103+
menu.push({ label: "Tab Bar Position", type: "submenu", submenu: tabBarSubmenu }, { type: "separator" });
88104
menu.push({ label: "Close Tab", click: () => onClose(null) });
89105
return menu;
90106
}

frontend/app/tab/vtabbarenv.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export type VTabBarEnv = WaveEnvSubset<{
1313
UpdateWorkspaceTabIdsCommand: WaveEnv["rpc"]["UpdateWorkspaceTabIdsCommand"];
1414
UpdateTabNameCommand: WaveEnv["rpc"]["UpdateTabNameCommand"];
1515
ActivityCommand: WaveEnv["rpc"]["ActivityCommand"];
16+
SetConfigCommand: WaveEnv["rpc"]["SetConfigCommand"];
1617
SetMetaCommand: WaveEnv["rpc"]["SetMetaCommand"];
1718
};
1819
atoms: {
@@ -23,7 +24,7 @@ export type VTabBarEnv = WaveEnvSubset<{
2324
};
2425
wos: WaveEnv["wos"];
2526
showContextMenu: WaveEnv["showContextMenu"];
26-
getSettingsKeyAtom: SettingsKeyAtomFnType<"tab:confirmclose">;
27+
getSettingsKeyAtom: SettingsKeyAtomFnType<"tab:confirmclose" | "app:tabbar">;
2728
mockSetWaveObj: WaveEnv["mockSetWaveObj"];
2829
isWindows: WaveEnv["isWindows"];
2930
isMacOS: WaveEnv["isMacOS"];

0 commit comments

Comments
 (0)