Skip to content

feat: add system tray resident mode support#120

Merged
amemya merged 5 commits into
mainfrom
feat/system-tray
Jun 26, 2026
Merged

feat: add system tray resident mode support#120
amemya merged 5 commits into
mainfrom
feat/system-tray

Conversation

@amemya

@amemya amemya commented Jun 26, 2026

Copy link
Copy Markdown
Owner
  • Implemented system tray integration for background execution
  • Added 'ResidentMode' setting to toggle background behavior
  • Main window now hides on close when resident mode is enabled
  • Added 'Keep running in system tray' toggle in Preferences UI
  • Added basic tray icon for macOS

resolved #67

amemya added 4 commits June 26, 2026 20:19
- Implemented system tray integration for background execution
- Added 'ResidentMode' setting to toggle background behavior
- Main window now hides on close when resident mode is enabled
- Added 'Keep running in system tray' toggle in Preferences UI
- Added basic tray icon for macOS
Ensures the app will properly exit when the last window is closed if resident mode is disabled.
Added an atomic isQuitting flag that bypasses the WindowClosing cancel hook,
allowing the application to gracefully close windows and terminate when
Quit is triggered from the menu or system tray.
Ensures that the quitting flag is set on all application quit routes
(including Cmd+Q, Dock quit, and OS shutdown) so that the WindowClosing
hook can properly allow windows to close and the app to terminate.
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 0d54498a-880b-4a39-969a-0586d372fb74

📥 Commits

Reviewing files that changed from the base of the PR and between 4a6ba7f and 7c65cf3.

⛔ Files ignored due to path filters (1)
  • frontend/dist/.gitkeep is excluded by !**/dist/**
📒 Files selected for processing (1)
  • .gitignore

📝 Walkthrough

Summary by CodeRabbit

  • 新機能

    • 全般設定に「システムトレイで常駐」の切り替え項目を追加しました。
    • 常駐モード時は、ウィンドウを閉じても終了せず、システムトレイから再表示・設定表示・終了ができるようになりました。
    • トレイアイコンをクリックすると、ウィンドウの表示/非表示を切り替えられます。
  • 改善

    • 常駐モードの設定は初期値として有効になっています。
    • 設定の保存・読み込みに常駐モードが反映されるようになりました。

Walkthrough

residentMode 設定を追加して保存・読み込みできるようにし、起動時にその値を反映します。常駐時は最後のウィンドウを閉じても終了せず、トレイ操作で表示切替と終了ができます。frontend/dist/.gitkeep の追跡も維持します。

Changes

常駐モードの設定とアプリ動作

Layer / File(s) Summary
設定の追加と画面反映
settings.go, frontend/src/SettingsWindow.tsx
SettingsresidentMode が追加され、設定画面がその値を読み込み、保存し、チェックボックスで編集する。
起動時の終了制御
main.go
起動時に ResidentMode を読み込み、最後のウィンドウ終了時の終了判定、ShouldQuitisQuitting 更新、閉じる操作の非終了化を切り替える。
トレイ操作の追加
main.go
常駐モード時にトレイメニュー、アイコン、ツールチップ、左クリックによるウィンドウ表示切替を追加する。

frontend/dist の保持設定

Layer / File(s) Summary
.gitignore の調整
.gitignore
frontend/dist/* を無視しつつ、frontend/dist/.gitkeep は無視しない指定に変更する。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • amemya/ExifFrame#42: main.go 側で設定画面を開く経路を扱っており、今回のトレイメニューからの設定表示と同じ操作導線に関係します。
  • amemya/ExifFrame#53: frontend/src/SettingsWindow.tsx と設定保存の流れを追加しており、今回の residentMode 設定追加と同じ設定経路を拡張しています。
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 主要変更であるシステムトレイ常駐化を簡潔に表しています。
Description check ✅ Passed 内容は常駐化、ResidentMode、トレイUI追加と一致しています。
Linked Issues check ✅ Passed 常駐化、閉じると非終了、トレイ表示の要件を満たしています。
Out of Scope Changes check ✅ Passed 変更は常駐モード実装とそれを支える.gitignore調整に収まっています。
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/system-tray

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@main.go`:
- Line 16: The go:embed directive in main.go is failing type checks when
frontend/dist is missing, so ensure the embedded path always exists before build
or lint. Update the build flow around the main package so frontend/dist is
generated or restored prior to compiling, and confirm the embed target used by
go:embed all:frontend/dist is present in CI and local checks.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c37cbd3c-39a8-432e-a79f-332f7fe0499c

📥 Commits

Reviewing files that changed from the base of the PR and between 80545f8 and 4a6ba7f.

⛔ Files ignored due to path filters (1)
  • build/trayicon.png is excluded by !**/*.png
📒 Files selected for processing (3)
  • frontend/src/SettingsWindow.tsx
  • main.go
  • settings.go

Comment thread main.go
//go:embed build/trayicon.png
var trayIcon []byte

//go:embed all:frontend/dist

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

frontend/dist がない状態で Go の型チェックが失敗しています。

Line 16 の //go:embed all:frontend/dist は対象ファイルが存在しないとコンパイル不能です。lint/CI の前に frontend build を実行するか、embed 対象が常に存在するようにしてください。

🧰 Tools
🪛 golangci-lint (2.12.2)

[error] 16-16: pattern all:frontend/dist: no matching files found

(typecheck)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@main.go` at line 16, The go:embed directive in main.go is failing type checks
when frontend/dist is missing, so ensure the embedded path always exists before
build or lint. Update the build flow around the main package so frontend/dist is
generated or restored prior to compiling, and confirm the embed target used by
go:embed all:frontend/dist is present in CI and local checks.

Source: Linters/SAST tools

@amemya

amemya commented Jun 26, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@amemya amemya merged commit efc9725 into main Jun 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

アプリの常駐化

1 participant