Skip to content

Commit bf62ec6

Browse files
committed
Add setting to show tab bar at bottom
1 parent 0b16593 commit bf62ec6

File tree

9 files changed

+29
-6
lines changed

9 files changed

+29
-6
lines changed

frontend/app/tab/tabbar.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,8 @@
122122
--os-handle-border-radius: 2px;
123123
}
124124
}
125+
126+
.tab-bar-wrapper.tab-bar-bottom {
127+
padding-top: 3px;
128+
padding-bottom: 3px;
129+
}

frontend/app/tab/tabbar.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { debounce } from "throttle-debounce";
1515
import { IconButton } from "../element/iconbutton";
1616
import { WorkspaceService } from "../store/services";
1717
import { Tab } from "./tab";
18+
import clsx from "clsx";
1819
import "./tabbar.scss";
1920
import { UpdateStatusBanner } from "./updatebanner";
2021
import { WorkspaceSwitcher } from "./workspaceswitcher";
@@ -648,18 +649,21 @@ const TabBar = memo(({ workspace }: TabBarProps) => {
648649
</div>
649650
) : undefined;
650651

652+
const tabBarPosition = settings?.["window:tabbarposition"];
653+
const workspaceSwitcherPlacement = tabBarPosition === "bottom" ? "top-start" : "bottom-start";
654+
651655
const addtabButtonDecl: IconButtonDecl = {
652656
elemtype: "iconbutton",
653657
icon: "plus",
654658
click: handleAddTab,
655659
title: "Add Tab",
656660
};
657661
return (
658-
<div ref={tabbarWrapperRef} className="tab-bar-wrapper">
662+
<div ref={tabbarWrapperRef} className={clsx("tab-bar-wrapper", tabBarPosition === "bottom" && "tab-bar-bottom")}>
659663
<WindowDrag ref={draggerLeftRef} className="left" />
660664
{appMenuButton}
661665
{devLabel}
662-
<WorkspaceSwitcher ref={workspaceSwitcherRef} />
666+
<WorkspaceSwitcher ref={workspaceSwitcherRef} placement={workspaceSwitcherPlacement} />
663667
<div className="tab-bar" ref={tabBarRef} data-overlayscrollbars-initialize>
664668
<div className="tabs-wrapper" ref={tabsWrapperRef} style={{ width: `${tabsWrapperWidth}px` }}>
665669
{tabIds.map((tabId, index) => {

frontend/app/tab/workspaceswitcher.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ import { waveEventSubscribe } from "../store/wps";
2525
import { WorkspaceEditor } from "./workspaceeditor";
2626
import "./workspaceswitcher.scss";
2727

28+
type WorkspaceSwitcherProps = {
29+
placement: "top-start" | "bottom-start";
30+
};
31+
2832
type WorkspaceListEntry = {
2933
windowId: string;
3034
workspace: Workspace;
@@ -34,7 +38,7 @@ type WorkspaceList = WorkspaceListEntry[];
3438
const workspaceMapAtom = atom<WorkspaceList>([]);
3539
const workspaceSplitAtom = splitAtom(workspaceMapAtom);
3640
const editingWorkspaceAtom = atom<string>();
37-
const WorkspaceSwitcher = forwardRef<HTMLDivElement>((_, ref) => {
41+
const WorkspaceSwitcher = forwardRef<HTMLDivElement, WorkspaceSwitcherProps>(({ placement }, ref) => {
3842
const setWorkspaceList = useSetAtom(workspaceMapAtom);
3943
const activeWorkspace = useAtomValueSafe(atoms.workspace);
4044
const workspaceList = useAtomValue(workspaceSplitAtom);
@@ -93,7 +97,7 @@ const WorkspaceSwitcher = forwardRef<HTMLDivElement>((_, ref) => {
9397
return (
9498
<Popover
9599
className="workspace-switcher-popover"
96-
placement="bottom-start"
100+
placement={placement}
97101
onDismiss={() => setEditingWorkspace(null)}
98102
ref={ref}
99103
>

frontend/app/workspace/workspace.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,11 @@ const Widget = memo(({ widget }: { widget: WidgetConfigType }) => {
151151
const WorkspaceElem = memo(() => {
152152
const tabId = useAtomValue(atoms.staticTabId);
153153
const ws = useAtomValue(atoms.workspace);
154+
const settings = useAtomValue(atoms.settingsAtom);
155+
const tabBarPosition = settings?.["window:tabbarposition"];
156+
154157
return (
155-
<div className="flex flex-col w-full flex-grow overflow-hidden">
158+
<div className={clsx("flex flex-col w-full flex-grow overflow-hidden", tabBarPosition === "bottom" && "flex-col-reverse")}>
156159
<TabBar key={ws.oid} workspace={ws} />
157160
<div className="flex flex-row flex-grow overflow-hidden">
158161
<ErrorBoundary key={tabId}>

frontend/types/gotypes.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,7 @@ declare global {
736736
"window:tilegapsize"?: number;
737737
"window:showmenubar"?: boolean;
738738
"window:nativetitlebar"?: boolean;
739+
"window:tabbarposition"?: string;
739740
"window:disablehardwareacceleration"?: boolean;
740741
"window:maxtabcachesize"?: number;
741742
"window:magnifiedblockopacity"?: number;

pkg/wconfig/defaultconfig/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"window:tilegapsize": 3,
1616
"window:maxtabcachesize": 10,
1717
"window:nativetitlebar": true,
18+
"window:tabbarposition": "top",
1819
"window:magnifiedblockopacity": 0.6,
1920
"window:magnifiedblocksize": 0.9,
2021
"window:magnifiedblockblurprimarypx": 10,

pkg/wconfig/metaconsts.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ const (
7575
ConfigKey_WindowTileGapSize = "window:tilegapsize"
7676
ConfigKey_WindowShowMenuBar = "window:showmenubar"
7777
ConfigKey_WindowNativeTitleBar = "window:nativetitlebar"
78+
ConfigKey_WindowTabBarPosition = "window:tabbarposition"
7879
ConfigKey_WindowDisableHardwareAcceleration = "window:disablehardwareacceleration"
7980
ConfigKey_WindowMaxTabCacheSize = "window:maxtabcachesize"
8081
ConfigKey_WindowMagnifiedBlockOpacity = "window:magnifiedblockopacity"

pkg/wconfig/settingsconfig.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ type SettingsType struct {
120120
WindowTileGapSize *int64 `json:"window:tilegapsize,omitempty"`
121121
WindowShowMenuBar bool `json:"window:showmenubar,omitempty"`
122122
WindowNativeTitleBar bool `json:"window:nativetitlebar,omitempty"`
123+
WindowTabBarPosition *string `json:"window:tabbarposition,omitempty"`
123124
WindowDisableHardwareAcceleration bool `json:"window:disablehardwareacceleration,omitempty"`
124125
WindowMaxTabCacheSize int `json:"window:maxtabcachesize,omitempty"`
125126
WindowMagnifiedBlockOpacity *float64 `json:"window:magnifiedblockopacity,omitempty"`

schema/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@
182182
"window:nativetitlebar": {
183183
"type": "boolean"
184184
},
185+
"window:tabbarposition": {
186+
"type": "string"
187+
},
185188
"window:disablehardwareacceleration": {
186189
"type": "boolean"
187190
},
@@ -232,4 +235,4 @@
232235
"type": "object"
233236
}
234237
}
235-
}
238+
}

0 commit comments

Comments
 (0)