Skip to content

Fix close to tray menu item not working#103

Merged
Aurumaker72 merged 1 commit intomainfrom
fix-close-to-tray-menu-item
Nov 4, 2025
Merged

Fix close to tray menu item not working#103
Aurumaker72 merged 1 commit intomainfrom
fix-close-to-tray-menu-item

Conversation

@Aurumaker72
Copy link
Collaborator

@Aurumaker72 Aurumaker72 commented Nov 3, 2025

The item has also been renamed for consistency.

@Aurumaker72
Copy link
Collaborator Author

Whatever, it's fine

@Aurumaker72 Aurumaker72 marked this pull request as ready for review November 4, 2025 18:53
@Aurumaker72 Aurumaker72 requested review from Copilot and luttje November 4, 2025 18:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request refactors the "Close" menu item functionality to only hide the window to the system tray instead of closing the application, and adds a new "Exit" menu item for actually closing the application. The menu item text was also shortened from "Close to notification tray" to "Close to Tray".

  • Changed the "Close" menu item to hide the window instead of closing it
  • Added a new "Exit" menu item with Alt+F4 shortcut to properly exit the application
  • Reorganized designer code declarations for better organization

Reviewed Changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.

File Description
Key2Joy.Gui/MainForm.cs Modified CloseToolStripMenuItem_Click to hide the window instead of closing it
Key2Joy.Gui/MainForm.Designer.cs Added new "Exit" menu item, reorganized field declarations, and updated menu item sizes
Files not reviewed (1)
  • Key2Joy.Gui/MainForm.Designer.cs: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

private void CloseToolStripMenuItem_Click(object sender, EventArgs e) => this.Close();
private void CloseToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Hide();
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CloseToolStripMenuItem_Click method now duplicates the logic in MainForm_FormClosing. When the user has configured ShouldCloseButtonMinimize to true, clicking the X button hides the form (lines 722-726), and now this menu item does the same unconditionally. Consider consolidating this behavior or referencing the configuration to maintain consistency.

Suggested change
this.Hide();
if (AppConfig.Instance.ShouldCloseButtonMinimize)
{
this.WindowState = FormWindowState.Minimized;
this.ShowInTaskbar = false;
this.Hide();
}
else
{
this.Close();
}

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

@luttje luttje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Aurumaker72 Aurumaker72 merged commit 6d4140e into main Nov 4, 2025
7 of 8 checks passed
@Aurumaker72 Aurumaker72 deleted the fix-close-to-tray-menu-item branch November 16, 2025 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants