From 5c5e59c0238d29f7e5d43ffae2844ad096c25c6a Mon Sep 17 00:00:00 2001 From: Allan Ritchie Date: Tue, 31 Mar 2026 10:09:05 -0400 Subject: [PATCH 1/3] Fix linux menu for settings & doctor --- src/MauiSherpa.LinuxGtk/LinuxToolbarManager.cs | 16 ++++++++++++++-- src/MauiSherpa/Components/MainLayout.razor | 11 +++++++---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/MauiSherpa.LinuxGtk/LinuxToolbarManager.cs b/src/MauiSherpa.LinuxGtk/LinuxToolbarManager.cs index 7865307c..6d686542 100644 --- a/src/MauiSherpa.LinuxGtk/LinuxToolbarManager.cs +++ b/src/MauiSherpa.LinuxGtk/LinuxToolbarManager.cs @@ -121,12 +121,24 @@ public void AttachToWindow(Gtk.Window window) _copilotButton.OnClicked += (s, _) => _copilotContext.ToggleOverlay(); _headerBar.PackStart(_copilotButton); - // Settings gear button on the right side + // Settings gear button beside copilot var settingsButton = Gtk.Button.New(); settingsButton.SetIconName("emblem-system-symbolic"); settingsButton.SetTooltipText("Settings"); settingsButton.OnClicked += (s, _) => OpenSettingsDialog(); - _headerBar.PackEnd(settingsButton); + _headerBar.PackStart(settingsButton); + + // Doctor button beside settings + var doctorButton = Gtk.Button.New(); + var doctorIconName = _themeService.IsDarkMode ? "fa-stethoscope-white-24.png" : "fa-stethoscope-24.png"; + var doctorIconPath = System.IO.Path.Combine(AppContext.BaseDirectory, "Resources", doctorIconName); + if (System.IO.File.Exists(doctorIconPath)) + doctorButton.SetChild(Gtk.Image.NewFromFile(doctorIconPath)); + else + doctorButton.SetIconName("dialog-information-symbolic"); + doctorButton.SetTooltipText("Doctor"); + doctorButton.OnClicked += (s, _) => _toolbarService.RequestNavigation("/doctor"); + _headerBar.PackStart(doctorButton); _window.SetTitlebar(_headerBar); } diff --git a/src/MauiSherpa/Components/MainLayout.razor b/src/MauiSherpa/Components/MainLayout.razor index a0dfafae..276ac692 100644 --- a/src/MauiSherpa/Components/MainLayout.razor +++ b/src/MauiSherpa/Components/MainLayout.razor @@ -158,8 +158,7 @@ protected override void OnInitialized() { ThemeService.ThemeChanged += OnThemeChanged; - if (PlatformInfo.IsWindows) - ToolbarService.NavigationRequested += OnNavigationRequested; + ToolbarService.NavigationRequested += OnNavigationRequested; } protected override void OnAfterRender(bool firstRender) @@ -265,8 +264,7 @@ { ThemeService.ThemeChanged -= OnThemeChanged; NavManager.LocationChanged -= OnLocationChanged; - if (PlatformInfo.IsWindows) - ToolbarService.NavigationRequested -= OnNavigationRequested; + ToolbarService.NavigationRequested -= OnNavigationRequested; } private void OnLocationChanged(object? sender, Microsoft.AspNetCore.Components.Routing.LocationChangedEventArgs e) @@ -283,6 +281,11 @@ } private void OpenCopilot() => CopilotContext.OpenOverlay(); + + private void OnNavigationRequested(string route) + { + _ = InvokeAsync(() => NavManager.NavigateTo(route)); + } }