forked from BeyondDimension/SteamTools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add macOS igonre, fix macOS notifyIcon
- Loading branch information
Showing
20 changed files
with
223 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -338,4 +338,6 @@ ASALocalRun/ | |
.localhistory/ | ||
|
||
# BeatPulse healthcheck temp database | ||
healthchecksdb | ||
healthchecksdb | ||
|
||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ools.Client.Desktop.Avalonia/System.Application.SteamTools.Client.Desktop.Avalonia.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...SteamTools.Client.Desktop.Linux/System.Application.SteamTools.Client.Desktop.Linux.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
System.Application.SteamTools.Client.Desktop.Mac/Application/UI/AppDelegateBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using MonoMac.AppKit; | ||
using MonoMac.Foundation; | ||
|
||
namespace System.Application.UI | ||
{ | ||
/// <summary> | ||
/// This class is an AppDelegate helper specifically for Mac OSX | ||
/// Int it's infinite wisdom and unlike Linux and or Windows Mac does not pass in the URL from a sqrl:// invokation | ||
/// directly as a startup app paramter, instead it uses a System Event to do this which has to be registered | ||
/// and listed to. | ||
/// This requires us to use MonoMac to make it work with .net core | ||
/// </summary> | ||
[Register("AppDelegate")] | ||
public sealed class AppDelegate : NSApplicationDelegate | ||
{ | ||
public AppDelegate() | ||
{ | ||
Init(); | ||
} | ||
|
||
/// <summary> | ||
/// Registers an event for handling URL Invokation | ||
/// </summary> | ||
void Init() | ||
{ | ||
//Register this Apple Delegate globablly with Avalonia for Later Use | ||
NSAppleEventManager.SharedAppleEventManager.SetEventHandler(this, new MonoMac.ObjCRuntime.Selector("handleGetURLEvent:withReplyEvent:"), AEEventClass.Internet, AEEventID.GetUrl); | ||
} | ||
|
||
/// <summary> | ||
/// Because we are creating our own mac application delegate we are removing / overriding | ||
/// the one that Avalonia creates. This causes the application to not be handled as it should. | ||
/// This is the Avalonia Implementation: https://github.com/AvaloniaUI/Avalonia/blob/5a2ef35dacbce0438b66d9f012e5f629045beb3d/native/Avalonia.Native/src/OSX/app.mm | ||
/// So what we are doing here is re-creating this implementation to mimick their behavior. | ||
/// </summary> | ||
/// <param name="notification"></param> | ||
public override void WillFinishLaunching(NSNotification notification) | ||
{ | ||
if (NSApplication.SharedApplication.ActivationPolicy != NSApplicationActivationPolicy.Regular) | ||
{ | ||
foreach (var x in NSRunningApplication.GetRunningApplications(@"com.apple.dock")) | ||
{ | ||
x.Activate(NSApplicationActivationOptions.ActivateIgnoringOtherWindows); | ||
break; | ||
} | ||
NSApplication.SharedApplication.ActivationPolicy = NSApplicationActivationPolicy.Regular; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Because we are creating our own mac application delegate we are removing / overriding | ||
/// the one that Avalonia creates. This causes the application to not be handled as it should. | ||
/// This is the Avalonia Implementation: https://github.com/AvaloniaUI/Avalonia/blob/5a2ef35dacbce0438b66d9f012e5f629045beb3d/native/Avalonia.Native/src/OSX/app.mm | ||
/// So what we are doing here is re-creating this implementation to mimick their behavior. | ||
/// </summary> | ||
/// <param name="notification"></param> | ||
public override void DidFinishLaunching(NSNotification notification) | ||
{ | ||
NSRunningApplication.CurrentApplication.Activate(NSApplicationActivationOptions.ActivateIgnoringOtherWindows); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.