Skip to content

Build your personal knowledge base with Trilium Notes

refactor(client): drop the now-unused custom title bar buttons

Elian Dorana6b3f53310fd
diff --git a/apps/client/src/layouts/desktop_layout.tsx b/apps/client/src/layouts/desktop_layout.tsx
index 1a35894cd2..2dac62926b 100644
--- a/apps/client/src/layouts/desktop_layout.tsx
+++ b/apps/client/src/layouts/desktop_layout.tsx
@@ -48,7 +48,6 @@ import SharedInfo from "../widgets/shared_info.jsx";
import RightPanelContainer from "../widgets/sidebar/RightPanelContainer.jsx";
import TabRowWidget from "../widgets/tab_row.js";
import TabHistoryNavigationButtons from "../widgets/TabHistoryNavigationButtons.jsx";
-import TitleBarButtons from "../widgets/title_bar_buttons.jsx";
import TocWidget from "../widgets/toc.js";
import WatchedFileUpdateStatusWidget from "../widgets/watched_file_update_status.js";
import { applyModals } from "./layout_commons.js";
@@ -75,9 +74,6 @@ export default class DesktopLayout {
* On macOS we need to force the full-width tab bar on Electron in order to allow the semaphore (window controls) enough space.
*/
const fullWidthTabBar = launcherPaneIsHorizontal || (isElectron && !hasNativeTitleBar && isMac);
- // No platform draws its own title bar buttons any more: macOS has the traffic lights and
- // Windows/Linux get the Chromium-drawn Window Controls Overlay.
- const customTitleBarButtons = false;
const isNewLayout = isExperimentalFeatureEnabled("new-layout");
const rootContainer = new RootContainer(true)
@@ -92,7 +88,6 @@ export default class DesktopLayout {
.child(<TabHistoryNavigationButtons />)
.child(new TabRowWidget().class("full-width"))
.optChild(isNewLayout, <RightPaneToggle />)
- .optChild(customTitleBarButtons, <TitleBarButtons />)
.css("height", "40px")
.css("background-color", "var(--launcher-pane-background-color)")
.setParent(appContext)
@@ -119,7 +114,6 @@ export default class DesktopLayout {
.child(<TabHistoryNavigationButtons />)
.child(new TabRowWidget())
.optChild(isNewLayout, <RightPaneToggle />)
- .optChild(customTitleBarButtons, <TitleBarButtons />)
.css("height", "40px")
.css("align-items", "center")
)
diff --git a/apps/client/src/stylesheets/theme-next/shell.css b/apps/client/src/stylesheets/theme-next/shell.css
index b4d02402e8..87bdf933bb 100644
--- a/apps/client/src/stylesheets/theme-next/shell.css
+++ b/apps/client/src/stylesheets/theme-next/shell.css
@@ -1166,10 +1166,6 @@ body.desktop:not(.background-effects) #root-widget.horizontal-layout {
transition: none;
}
-.tab-row-container .title-bar-buttons {
- margin-top: calc((var(--tab-bar-height) - var(--tab-height)) * -1);
-}
-
body.layout-horizontal div.tab-row-widget div.note-tab div.note-tab-wrapper {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
diff --git a/apps/client/src/widgets/title_bar_buttons.css b/apps/client/src/widgets/title_bar_buttons.css
deleted file mode 100644
index aff57d4219..0000000000
--- a/apps/client/src/widgets/title_bar_buttons.css
+++ /dev/null
@@ -1,30 +0,0 @@
-.component.title-bar-buttons {
- flex-shrink: 0;
- contain: none;
-}
-
-.title-bar-buttons div button {
- border: none !important;
- border-radius: 0;
- background: none !important;
- font-size: 150%;
- height: 40px;
- width: 40px;
- display: flex;
- align-items: center;
- justify-content: center;
-}
-
-.title-bar-buttons div:hover button {
- background-color: var(--accented-background-color) !important;
-}
-
-.title-bar-buttons div {
- display: inline-block;
- height: 40px;
- width: 40px;
-}
-
-.title-bar-buttons .btn.focus, .title-bar-buttons .btn:focus {
- box-shadow: none;
-}
\ No newline at end of file
diff --git a/apps/client/src/widgets/title_bar_buttons.tsx b/apps/client/src/widgets/title_bar_buttons.tsx
deleted file mode 100644
index ae4ce4cba7..0000000000
--- a/apps/client/src/widgets/title_bar_buttons.tsx
+++ /dev/null
@@ -1,57 +0,0 @@
-import { isElectron } from "../services/utils";
-import { useTriliumOption } from "./react/hooks";
-import "./title_bar_buttons.css";
-
-interface TitleBarButtonProps {
- className: string;
- icon: string;
- onClick: () => void;
-}
-
-export default function TitleBarButtons() {
- const [ nativeTitleBarVisible ] = useTriliumOption("nativeTitleBarVisible");
- const isEnabled = (isElectron() && nativeTitleBarVisible);
-
- return (
- <div className="title-bar-buttons">
- {isEnabled && (
- <>
- <TitleBarButton
- className="minimize-btn"
- icon="bx bx-minus"
- onClick={() => window.electronApi?.window.minimizeWindow()}
- />
-
- <TitleBarButton
- className="maximize-btn"
- icon="bx bx-checkbox"
- onClick={() => {
- const api = window.electronApi?.window;
- if (!api) return;
- if (api.isMaximized()) {
- api.unmaximizeWindow();
- } else {
- api.maximizeWindow();
- }
- }}
- />
-
- <TitleBarButton
- className="close-btn"
- icon="bx bx-x"
- onClick={() => window.electronApi?.window.closeWindow()}
- />
- </>
- )}
- </div>
- )
-}
-
-function TitleBarButton({ className, icon, onClick }: TitleBarButtonProps) {
- // divs act as a hitbox for the buttons, making them clickable on corners
- return (
- <div className={className}>
- <button className={`btn ${icon}`} onClick={onClick} />
- </div>
- );
-}