Skip to content

Commit 96d73a8

Browse files
committed
Remove the application title from the header bar
1 parent 0d76ffd commit 96d73a8

6 files changed

Lines changed: 33 additions & 132 deletions

File tree

frontend/src/components/window/title-bar/TitleBar.svelte

Lines changed: 22 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,18 @@
33
44
import type { Editor } from "@graphite/editor";
55
import { type KeyRaw, type LayoutKeysGroup, type MenuBarEntry, type MenuListEntry, type AppWindowPlatform, UpdateMenuBarLayout } from "@graphite/messages";
6-
import type { PortfolioState } from "@graphite/state-providers/portfolio";
76
import { platformIsMac } from "@graphite/utility-functions/platform";
87
98
import LayoutRow from "@graphite/components/layout/LayoutRow.svelte";
109
import TextButton from "@graphite/components/widgets/buttons/TextButton.svelte";
1110
import WindowButtonsLinux from "@graphite/components/window/title-bar/WindowButtonsLinux.svelte";
12-
import WindowButtonsMac from "@graphite/components/window/title-bar/WindowButtonsMac.svelte";
1311
import WindowButtonsWeb from "@graphite/components/window/title-bar/WindowButtonsWeb.svelte";
1412
import WindowButtonsWindows from "@graphite/components/window/title-bar/WindowButtonsWindows.svelte";
15-
import WindowTitle from "@graphite/components/window/title-bar/WindowTitle.svelte";
1613
1714
export let platform: AppWindowPlatform;
1815
export let maximized: boolean;
1916
2017
const editor = getContext<Editor>("editor");
21-
const portfolio = getContext<PortfolioState>("portfolio");
2218
2319
// TODO: Apparently, Safari does not support the Keyboard.lock() API but does relax its authority over certain keyboard shortcuts in fullscreen mode, which we should take advantage of
2420
const ACCEL_KEY = platformIsMac() ? "Command" : "Control";
@@ -32,10 +28,6 @@
3228
3329
let entries: MenuListEntry[] = [];
3430
35-
$: docIndex = $portfolio.activeDocumentIndex;
36-
$: displayName = $portfolio.documents[docIndex]?.displayName || "";
37-
$: windowTitle = `${displayName}${displayName && " - "}Graphite`;
38-
3931
onMount(() => {
4032
const arraysEqual = (a: KeyRaw[], b: KeyRaw[]): boolean => a.length === b.length && a.every((aValue, i) => aValue === b[i]);
4133
const shortcutRequiresLock = (shortcut: LayoutKeysGroup): boolean => {
@@ -67,32 +59,26 @@
6759
</script>
6860

6961
<LayoutRow class="title-bar">
70-
<!-- Menu bar (or on Mac: window buttons) -->
71-
<LayoutRow class="left">
72-
{#if platform === "Mac"}
73-
<WindowButtonsMac />
74-
{:else}
62+
{#if platform !== "Mac"}
63+
<!-- Menu bar -->
64+
<LayoutRow>
7565
{#each entries as entry}
7666
<TextButton label={entry.label} icon={entry.icon} menuListChildren={entry.children} action={entry.action} flush={true} />
7767
{/each}
78-
{/if}
79-
<LayoutRow on:mousedown={() => editor.handle.appWindowDrag()} on:dblclick={() => editor.handle.appWindowMaximize()} />
80-
</LayoutRow>
81-
<!-- Document title -->
82-
<LayoutRow class="center" on:mousedown={() => editor.handle.appWindowDrag()} on:dblclick={() => editor.handle.appWindowMaximize()}>
83-
<WindowTitle text={windowTitle} />
84-
</LayoutRow>
85-
<!-- Window buttons (except on Mac) -->
86-
<LayoutRow class="right">
87-
<LayoutRow on:mousedown={() => editor.handle.appWindowDrag()} on:dblclick={() => editor.handle.appWindowMaximize()} />
88-
{#if platform === "Windows"}
89-
<WindowButtonsWindows {maximized} />
90-
{:else if platform === "Linux"}
91-
<WindowButtonsLinux {maximized} />
92-
{:else if platform === "Web"}
93-
<WindowButtonsWeb />
94-
{/if}
95-
</LayoutRow>
68+
</LayoutRow>
69+
<!-- Spacer -->
70+
<LayoutRow class="spacer" on:mousedown={() => editor.handle.appWindowDrag()} on:dblclick={() => editor.handle.appWindowMaximize()} />
71+
<!-- Window buttons -->
72+
<LayoutRow>
73+
{#if platform === "Web"}
74+
<WindowButtonsWeb />
75+
{:else if platform === "Windows"}
76+
<WindowButtonsWindows {maximized} />
77+
{:else if platform === "Linux"}
78+
<WindowButtonsLinux {maximized} />
79+
{/if}
80+
</LayoutRow>
81+
{/if}
9682
</LayoutRow>
9783

9884
<style lang="scss" global>
@@ -101,23 +87,15 @@
10187
flex: 0 0 auto;
10288
10389
> .layout-row {
104-
flex: 1 1 100%;
105-
106-
&.left {
107-
justify-content: flex-start;
108-
}
90+
flex: 0 0 auto;
10991
110-
&.center {
111-
justify-content: center;
92+
&.spacer {
93+
flex: 1 1 100%;
11294
}
11395
114-
&.right {
115-
justify-content: flex-end;
96+
.text-button {
97+
height: 100%;
11698
}
11799
}
118-
119-
.text-button {
120-
height: 28px;
121-
}
122100
}
123101
</style>

frontend/src/components/window/title-bar/WindowButtonsMac.svelte

Lines changed: 0 additions & 47 deletions
This file was deleted.

frontend/src/components/window/title-bar/WindowButtonsWeb.svelte

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
66
import LayoutRow from "@graphite/components/layout/LayoutRow.svelte";
77
import IconLabel from "@graphite/components/widgets/labels/IconLabel.svelte";
8-
import TextLabel from "@graphite/components/widgets/labels/TextLabel.svelte";
98
109
const fullscreen = getContext<FullscreenState>("fullscreen");
1110
@@ -17,10 +16,12 @@
1716
}
1817
</script>
1918

20-
<LayoutRow class="window-buttons-web" on:click={handleClick} tooltip={$fullscreen.windowFullscreen ? "Exit Fullscreen (F11)" : "Enter Fullscreen (F11)"}>
21-
{#if requestFullscreenHotkeys}
22-
<TextLabel italic={true}>Go fullscreen to access all hotkeys</TextLabel>
23-
{/if}
19+
<LayoutRow
20+
class="window-buttons-web"
21+
on:click={handleClick}
22+
tooltip={($fullscreen.windowFullscreen ? "Exit Fullscreen (F11)" : "Enter Fullscreen (F11)") +
23+
(requestFullscreenHotkeys ? "\n\nThis provides access to hotkeys normally reserved by the browser" : "")}
24+
>
2425
<IconLabel icon={$fullscreen.windowFullscreen ? "FullscreenExit" : "FullscreenEnter"} />
2526
</LayoutRow>
2627

@@ -34,13 +35,8 @@
3435
fill: var(--color-e-nearwhite);
3536
}
3637
37-
.text-label {
38-
margin-right: 8px;
39-
}
40-
4138
&:hover {
4239
background: var(--color-6-lowergray);
43-
color: var(--color-f-white);
4440
4541
svg {
4642
fill: var(--color-f-white);

frontend/src/components/window/title-bar/WindowTitle.svelte

Lines changed: 0 additions & 19 deletions
This file was deleted.

frontend/src/messages.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,9 @@ export class UpdateWirePathInProgress extends JsMessage {
139139

140140
export class OpenDocument {
141141
readonly id!: bigint;
142+
142143
@Type(() => DocumentDetails)
143144
readonly details!: DocumentDetails;
144-
145-
get displayName(): string {
146-
return this.details.displayName;
147-
}
148145
}
149146

150147
export class DocumentDetails {
@@ -153,10 +150,6 @@ export class DocumentDetails {
153150
readonly isAutoSaved!: boolean;
154151

155152
readonly isSaved!: boolean;
156-
157-
get displayName(): string {
158-
return `${this.name}${this.isSaved ? "" : "*"}`;
159-
}
160153
}
161154

162155
export class Box {

node-graph/gmath-nodes/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -579,10 +579,10 @@ fn binary_gcd<T: num_traits::int::PrimInt + std::ops::ShrAssign<i32> + std::ops:
579579
fn equals<T: std::cmp::PartialEq<T>>(
580580
_: impl Ctx,
581581
/// One of the two numbers to compare for equality.
582-
#[implementations(f64, f32, u32, DVec2, &str, String)]
582+
#[implementations(f64, f32, u32, DVec2, bool, &str, String)]
583583
value: T,
584584
/// The other of the two numbers to compare for equality.
585-
#[implementations(f64, f32, u32, DVec2, &str, String)]
585+
#[implementations(f64, f32, u32, DVec2, bool, &str, String)]
586586
other_value: T,
587587
) -> bool {
588588
other_value == value
@@ -593,10 +593,10 @@ fn equals<T: std::cmp::PartialEq<T>>(
593593
fn not_equals<T: std::cmp::PartialEq<T>>(
594594
_: impl Ctx,
595595
/// One of the two numbers to compare for inequality.
596-
#[implementations(f64, f32, u32, DVec2, &str)]
596+
#[implementations(f64, f32, u32, DVec2, bool, &str)]
597597
value: T,
598598
/// The other of the two numbers to compare for inequality.
599-
#[implementations(f64, f32, u32, DVec2, &str)]
599+
#[implementations(f64, f32, u32, DVec2, bool, &str)]
600600
other_value: T,
601601
) -> bool {
602602
other_value != value

0 commit comments

Comments
 (0)