From d5e51d1f32a05896a3813b5db523b9371f5844af Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 22 Aug 2024 12:37:26 +0800 Subject: [PATCH] feature: supports using native window frame on Linux (#390) --- src/Resources/Locales/de_DE.axaml | 2 +- src/Resources/Locales/en_US.axaml | 3 +- src/Resources/Locales/pt_BR.axaml | 2 +- src/Resources/Locales/zh_CN.axaml | 3 +- src/Resources/Locales/zh_TW.axaml | 3 +- src/ViewModels/Preference.cs | 7 ++ src/Views/About.axaml | 2 +- src/Views/Askpass.axaml | 2 +- src/Views/AssumeUnchangedManager.axaml | 3 +- src/Views/Blame.axaml | 5 +- src/Views/BranchCompare.axaml | 5 +- src/Views/ChromelessWindow.cs | 12 +++- src/Views/ConfirmRestart.axaml | 65 +++++++++++++++++++ src/Views/ConfirmRestart.axaml.cs | 35 ++++++++++ src/Views/FileHistories.axaml | 6 +- src/Views/Hotkeys.axaml | 3 +- src/Views/InteractiveRebase.axaml | 3 +- src/Views/LFSLocks.axaml | 3 +- src/Views/Launcher.axaml | 7 +- src/Views/Launcher.axaml.cs | 34 ++++++++-- src/Views/Preference.axaml | 23 ++++--- src/Views/Preference.axaml.cs | 15 +++++ src/Views/RepositoryConfigure.axaml | 5 +- src/Views/SelfUpdate.axaml | 3 +- src/Views/StandaloneCommitMessageEditor.axaml | 3 +- src/Views/Statistics.axaml | 3 +- 26 files changed, 218 insertions(+), 39 deletions(-) create mode 100644 src/Views/ConfirmRestart.axaml create mode 100644 src/Views/ConfirmRestart.axaml.cs diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml index ca0bda14..775dff26 100644 --- a/src/Resources/Locales/de_DE.axaml +++ b/src/Resources/Locales/de_DE.axaml @@ -382,13 +382,13 @@ Verwende nur die Monospace-Schriftart im Texteditor Design Design-Anpassungen + Fixe Tab-Breite in Titelleiste ALLGEMEIN Beim Starten nach Updates suchen Sprache Commit-Historie Zuletzt geöffnete Tabs beim Starten wiederherstellen Längenvorgabe für Commit-Nachrichten - Fixe Tab-Breite in Titelleiste Sichtbare Vergleichskontextzeilen GIT Remotes automatisch fetchen diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 2fe1ef9d..29e5d802 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -379,13 +379,14 @@ Only use monospace font in text editor Theme Theme Overrides + Use fixed tab width in titlebar + Use native window frame GENERAL Check for updates on startup Language History Commits Restore last opened tab(s) on startup Subject Guide Length - Use fixed tab width in titlebar Visible Diff Context Lines GIT Fetch remotes automatically diff --git a/src/Resources/Locales/pt_BR.axaml b/src/Resources/Locales/pt_BR.axaml index f488b651..e725dc5a 100644 --- a/src/Resources/Locales/pt_BR.axaml +++ b/src/Resources/Locales/pt_BR.axaml @@ -382,13 +382,13 @@ Usar apenas fonte monoespaçada no editor de texto Tema Sobrescrever Tema + Usar largura fixa da aba na barra de título GERAL Verificar atualizações na inicialização Idioma Commits do Histórico Restaurar as últimas abas abertas na inicialização Comprimento do Guia de Assunto - Usar largura fixa da aba na barra de título Linhas de Contexto de Diferença Visíveis GIT Buscar remotos automaticamente diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 6c61b41f..4bb0eae1 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -382,13 +382,14 @@ 仅在文本编辑器中使用等宽字体 主题 主题自定义 + 主标签使用固定宽度 + 使用系统默认窗体样式 通用配置 启动时检测软件更新 显示语言 最大历史提交数 启动时恢复上次打开的仓库 SUBJECT字数检测 - 使用固定宽度的标题栏标签 DIFF上下文行数 GIT配置 启用定时自动拉取远程更新 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 84f7bd25..6a628fc7 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -382,13 +382,14 @@ 僅在文字編輯器中使用等寬字體 主題 主題自訂 + 使用固定寬度的標題欄標籤 + 使用系統預設窗口樣式 通用配置 啟動時檢測軟體更新 顯示語言 最大歷史提交數 啟動時恢復上次開啟的倉庫 SUBJECT字數檢測 - 使用固定寬度的標題欄標籤 DIFF上下文行數 GIT配置 啟用定時自動拉取遠端更新 diff --git a/src/ViewModels/Preference.cs b/src/ViewModels/Preference.cs index a3f18fd5..858cc2d8 100644 --- a/src/ViewModels/Preference.cs +++ b/src/ViewModels/Preference.cs @@ -105,6 +105,12 @@ namespace SourceGit.ViewModels } } + public bool UseSystemWindowFrame + { + get => _useSystemWindowFrame; + set => SetProperty(ref _useSystemWindowFrame, value); + } + public double DefaultFontSize { get => _defaultFontSize; @@ -492,6 +498,7 @@ namespace SourceGit.ViewModels private string _defaultFontFamily = string.Empty; private string _monospaceFontFamily = string.Empty; private bool _onlyUseMonoFontInEditor = false; + private bool _useSystemWindowFrame = false; private double _defaultFontSize = 13; private LayoutInfo _layout = new LayoutInfo(); diff --git a/src/Views/About.axaml b/src/Views/About.axaml index baf62e5a..4ff12c80 100644 --- a/src/Views/About.axaml +++ b/src/Views/About.axaml @@ -13,7 +13,7 @@ WindowStartupLocation="CenterScreen"> - + - + - + - + - + - + - + OperatingSystem.IsLinux() && ViewModels.Preference.Instance.UseSystemWindowFrame; + } + protected override Type StyleKeyOverride => typeof(Window); public ChromelessWindow() { if (OperatingSystem.IsLinux()) - Classes.Add("custom_window_frame"); + { + if (!UseSystemWindowFrame) + Classes.Add("custom_window_frame"); + } else if (OperatingSystem.IsWindows()) + { Classes.Add("fix_maximized_padding"); + } } protected override void OnApplyTemplate(TemplateAppliedEventArgs e) diff --git a/src/Views/ConfirmRestart.axaml b/src/Views/ConfirmRestart.axaml new file mode 100644 index 00000000..4e0ac386 --- /dev/null +++ b/src/Views/ConfirmRestart.axaml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + +