mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-22 13:51:15 +08:00
feature: supports to use ⌘+H to hide this app on macOS (#1716)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
|
||||
namespace SourceGit
|
||||
{
|
||||
@@ -53,5 +55,17 @@ namespace SourceGit
|
||||
else if (!string.IsNullOrEmpty(textBlock.Text))
|
||||
await CopyTextAsync(textBlock.Text);
|
||||
});
|
||||
|
||||
public static readonly Command HideAppCommand = new Command(_ =>
|
||||
{
|
||||
if (Current is App app && app.TryGetFeature(typeof(IActivatableLifetime)) is IActivatableLifetime lifetime)
|
||||
lifetime.TryEnterBackground();
|
||||
});
|
||||
|
||||
public static readonly Command ShowAppCommand = new Command(_ =>
|
||||
{
|
||||
if (Current is App app && app.TryGetFeature(typeof(IActivatableLifetime)) is IActivatableLifetime lifetime)
|
||||
lifetime.TryLeaveBackground();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,9 @@
|
||||
<NativeMenuItem Header="{DynamicResource Text.Preferences}" Command="{x:Static s:App.OpenPreferencesCommand}" Gesture="⌘+,"/>
|
||||
<NativeMenuItem Header="{DynamicResource Text.OpenAppDataDir}" Command="{x:Static s:App.OpenAppDataDirCommand}"/>
|
||||
<NativeMenuItemSeparator/>
|
||||
<NativeMenuItem Header="{DynamicResource Text.App.Hide}" Command="{x:Static s:App.HideAppCommand}" Gesture="⌘+H"/>
|
||||
<NativeMenuItem Header="{DynamicResource Text.App.ShowAll}" Command="{x:Static s:App.ShowAppCommand}"/>
|
||||
<NativeMenuItemSeparator/>
|
||||
<NativeMenuItem Header="{DynamicResource Text.Quit}" Command="{x:Static s:App.QuitCommand}" Gesture="⌘+Q"/>
|
||||
</NativeMenu>
|
||||
</NativeMenu.Menu>
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
<x:String x:Key="Text.AIAssistant.Regen" xml:space="preserve">RE-GENERATE</x:String>
|
||||
<x:String x:Key="Text.AIAssistant.Tip" xml:space="preserve">Use AI to generate commit message</x:String>
|
||||
<x:String x:Key="Text.AIAssistant.Use" xml:space="preserve">APPLY AS COMMIT MESSAGE</x:String>
|
||||
<x:String x:Key="Text.App.Hide" xml:space="preserve">Hide SourceGit</x:String>
|
||||
<x:String x:Key="Text.App.ShowAll" xml:space="preserve">Show All</x:String>
|
||||
<x:String x:Key="Text.Apply" xml:space="preserve">Patch</x:String>
|
||||
<x:String x:Key="Text.Apply.File" xml:space="preserve">Patch File:</x:String>
|
||||
<x:String x:Key="Text.Apply.File.Placeholder" xml:space="preserve">Select .patch file to apply</x:String>
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
<x:String x:Key="Text.AIAssistant.Regen" xml:space="preserve">重新生成</x:String>
|
||||
<x:String x:Key="Text.AIAssistant.Tip" xml:space="preserve">使用AI助手生成提交信息</x:String>
|
||||
<x:String x:Key="Text.AIAssistant.Use" xml:space="preserve">应用本次生成</x:String>
|
||||
<x:String x:Key="Text.App.Hide" xml:space="preserve">隐藏 SourceGit</x:String>
|
||||
<x:String x:Key="Text.App.ShowAll" xml:space="preserve">显示所有窗口</x:String>
|
||||
<x:String x:Key="Text.Apply" xml:space="preserve">应用补丁(apply)</x:String>
|
||||
<x:String x:Key="Text.Apply.File" xml:space="preserve">补丁文件 :</x:String>
|
||||
<x:String x:Key="Text.Apply.File.Placeholder" xml:space="preserve">选择补丁文件</x:String>
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
<x:String x:Key="Text.AIAssistant.Regen" xml:space="preserve">重新產生</x:String>
|
||||
<x:String x:Key="Text.AIAssistant.Tip" xml:space="preserve">使用 AI 產生提交訊息</x:String>
|
||||
<x:String x:Key="Text.AIAssistant.Use" xml:space="preserve">套用為提交訊息</x:String>
|
||||
<x:String x:Key="Text.App.Hide" xml:space="preserve">隱藏 SourceGit</x:String>
|
||||
<x:String x:Key="Text.App.ShowAll" xml:space="preserve">顯示所有</x:String>
|
||||
<x:String x:Key="Text.Apply" xml:space="preserve">套用修補檔 (apply patch)</x:String>
|
||||
<x:String x:Key="Text.Apply.File" xml:space="preserve">修補檔:</x:String>
|
||||
<x:String x:Key="Text.Apply.File.Placeholder" xml:space="preserve">選擇修補檔</x:String>
|
||||
|
||||
Reference in New Issue
Block a user