Fix close to tray menu item not working#103
Conversation
|
Whatever, it's fine |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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.
| this.Hide(); | |
| if (AppConfig.Instance.ShouldCloseButtonMinimize) | |
| { | |
| this.WindowState = FormWindowState.Minimized; | |
| this.ShowInTaskbar = false; | |
| this.Hide(); | |
| } | |
| else | |
| { | |
| this.Close(); | |
| } |
The item has also been renamed for consistency.