Skip to content

Commit 47f5b04

Browse files
committed
メニューに「設定を開く」と「再起動」を追加
1 parent 74a4fb5 commit 47f5b04

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

AppDelegate.swift

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@ class AppDelegate: NSObject, NSApplicationDelegate {
2020
}
2121

2222
let menu = NSMenu()
23+
menu.addItem(
24+
NSMenuItem(
25+
title: "設定を開く",
26+
action: #selector(openSettings),
27+
keyEquivalent: ","
28+
))
29+
menu.addItem(NSMenuItem.separator())
30+
menu.addItem(
31+
NSMenuItem(
32+
title: "再起動",
33+
action: #selector(restartBridge),
34+
keyEquivalent: "r"
35+
))
36+
menu.addItem(NSMenuItem.separator())
2337
menu.addItem(
2438
NSMenuItem(
2539
title: "HAMLAB Bridge 終了",
@@ -44,6 +58,18 @@ class AppDelegate: NSObject, NSApplicationDelegate {
4458
}
4559
}
4660

61+
@objc func openSettings() {
62+
if let url = URL(string: "http://127.0.0.1:17801/settings") {
63+
NSWorkspace.shared.open(url)
64+
}
65+
}
66+
67+
@objc func restartBridge() {
68+
bridgeProcess?.terminate()
69+
bridgeProcess?.waitUntilExit()
70+
startBridge()
71+
}
72+
4773
@objc func quit() {
4874
bridgeProcess?.terminate()
4975
NSApp.terminate(nil)

0 commit comments

Comments
 (0)