Clean up sloppiness in notification area icon

This commit is contained in:
pizzaboxer 2024-08-13 21:44:43 +01:00
parent ab2f5f589a
commit de82349e5e
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8
5 changed files with 51 additions and 16 deletions

View File

@ -337,6 +337,16 @@ namespace Bloxstrap
App.NotifyIcon?.SetActivityWatcher(activityWatcher); App.NotifyIcon?.SetActivityWatcher(activityWatcher);
if (App.Settings.Prop.UseDisableAppPatch)
{
activityWatcher.OnAppClose += (_, _) =>
{
App.Logger.WriteLine(LOG_IDENT, "Received desktop app exit, closing Roblox");
using var process = Process.GetProcessById(gameClientPid);
process.CloseMainWindow();
};
}
if (App.Settings.Prop.UseDiscordRichPresence) if (App.Settings.Prop.UseDiscordRichPresence)
{ {
App.Logger.WriteLine(LOG_IDENT, "Using Discord Rich Presence"); App.Logger.WriteLine(LOG_IDENT, "Using Discord Rich Presence");

View File

@ -27,6 +27,7 @@
public event EventHandler<string>? OnLogEntry; public event EventHandler<string>? OnLogEntry;
public event EventHandler? OnGameJoin; public event EventHandler? OnGameJoin;
public event EventHandler? OnGameLeave; public event EventHandler? OnGameLeave;
public event EventHandler? OnAppClose;
public event EventHandler<Message>? OnRPCMessage; public event EventHandler<Message>? OnRPCMessage;
private readonly Dictionary<string, string> GeolocationCache = new(); private readonly Dictionary<string, string> GeolocationCache = new();
@ -135,13 +136,8 @@
else if (_logEntriesRead % 100 == 0) else if (_logEntriesRead % 100 == 0)
App.Logger.WriteLine(LOG_IDENT, $"Read {_logEntriesRead} log entries"); App.Logger.WriteLine(LOG_IDENT, $"Read {_logEntriesRead} log entries");
if (entry.Contains(GameLeavingEntry))
if (App.Settings.Prop.UseDisableAppPatch && entry.Contains(GameLeavingEntry)) OnAppClose?.Invoke(this, new EventArgs());
{
App.Logger.WriteLine(LOG_IDENT, "Received desktop app exit, closing Roblox");
using var process = Process.GetProcessById(_gameClientPid);
process.CloseMainWindow();
}
if (!ActivityInGame && ActivityPlaceId == 0) if (!ActivityInGame && ActivityPlaceId == 0)
{ {

View File

@ -666,7 +666,7 @@ namespace Bloxstrap.Resources {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Located at {0} /// Looks up a localized string similar to Location: {0}
///Click for more information. ///Click for more information.
/// </summary> /// </summary>
public static string ContextMenu_ServerInformation_Notification_Text { public static string ContextMenu_ServerInformation_Notification_Text {
@ -676,11 +676,29 @@ namespace Bloxstrap.Resources {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Connected to {0} server. /// Looks up a localized string similar to Connected to private server.
/// </summary> /// </summary>
public static string ContextMenu_ServerInformation_Notification_Title { public static string ContextMenu_ServerInformation_Notification_Title_Private {
get { get {
return ResourceManager.GetString("ContextMenu.ServerInformation.Notification.Title", resourceCulture); return ResourceManager.GetString("ContextMenu.ServerInformation.Notification.Title.Private", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Connected to public server.
/// </summary>
public static string ContextMenu_ServerInformation_Notification_Title_Public {
get {
return ResourceManager.GetString("ContextMenu.ServerInformation.Notification.Title.Public", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Connected to reserved server.
/// </summary>
public static string ContextMenu_ServerInformation_Notification_Title_Reserved {
get {
return ResourceManager.GetString("ContextMenu.ServerInformation.Notification.Title.Reserved", resourceCulture);
} }
} }

View File

@ -287,12 +287,11 @@ Your ReShade configuration files will still be saved, and you can locate them by
<value>Location</value> <value>Location</value>
</data> </data>
<data name="ContextMenu.ServerInformation.Notification.Text" xml:space="preserve"> <data name="ContextMenu.ServerInformation.Notification.Text" xml:space="preserve">
<value>Located at {0} <value>Location: {0}
Click for more information</value> Click for more information</value>
</data> </data>
<data name="ContextMenu.ServerInformation.Notification.Title" xml:space="preserve"> <data name="ContextMenu.ServerInformation.Notification.Title.Public" xml:space="preserve">
<value>Connected to {0} server</value> <value>Connected to public server</value>
<comment>Enums.ServerType fills in {0} and is dynamically converted to lowercase when inserted here</comment>
</data> </data>
<data name="ContextMenu.ServerInformation.Title" xml:space="preserve"> <data name="ContextMenu.ServerInformation.Title" xml:space="preserve">
<value>Server information</value> <value>Server information</value>
@ -1114,4 +1113,10 @@ If not, then please report this exception to the maintainers of this fork. Do NO
<data name="Menu.Shortcuts.Function.Description" xml:space="preserve"> <data name="Menu.Shortcuts.Function.Description" xml:space="preserve">
<value>Create shortcuts for quick access to specific functions. These will all be placed on the Desktop.</value> <value>Create shortcuts for quick access to specific functions. These will all be placed on the Desktop.</value>
</data> </data>
<data name="ContextMenu.ServerInformation.Notification.Title.Private" xml:space="preserve">
<value>Connected to private server</value>
</data>
<data name="ContextMenu.ServerInformation.Notification.Title.Reserved" xml:space="preserve">
<value>Connected to reserved server</value>
</data>
</root> </root>

View File

@ -87,9 +87,15 @@ namespace Bloxstrap.UI
public async void OnGameJoin() public async void OnGameJoin()
{ {
string serverLocation = await _activityWatcher!.GetServerLocation(); string serverLocation = await _activityWatcher!.GetServerLocation();
string title = _activityWatcher.ActivityServerType switch
{
ServerType.Public => Resources.Strings.ContextMenu_ServerInformation_Notification_Title_Public,
ServerType.Private => Resources.Strings.ContextMenu_ServerInformation_Notification_Title_Private,
ServerType.Reserved => Resources.Strings.ContextMenu_ServerInformation_Notification_Title_Reserved
};
ShowAlert( ShowAlert(
String.Format(Resources.Strings.ContextMenu_ServerInformation_Notification_Title, _activityWatcher.ActivityServerType.ToTranslatedString().ToLower()), title,
String.Format(Resources.Strings.ContextMenu_ServerInformation_Notification_Text, serverLocation), String.Format(Resources.Strings.ContextMenu_ServerInformation_Notification_Text, serverLocation),
10, 10,
(_, _) => _menuContainer?.ShowServerInformationWindow() (_, _) => _menuContainer?.ShowServerInformationWindow()