- add tooltip to settings menu

This commit is contained in:
Serhiy Mytrovtsiy
2020-07-11 20:25:03 +02:00
parent 4c9ad3aa03
commit 1621d8b3a0
2 changed files with 6 additions and 4 deletions

View File

@@ -28,7 +28,7 @@ public class Sensors: Module {
settings: self.settingsView
)
guard self.available else { return }
self.checkIfNoSensorsEnabled()
self.popupView.setup(self.sensorsReader.list)

View File

@@ -205,6 +205,7 @@ private class SettingsView: NSView {
button.verticalPadding = 20
button.horizontalPadding = 20
button.title = title
button.toolTip = title
button.bezelStyle = .regularSquare
button.translatesAutoresizingMaskIntoConstraints = false
button.imageScaling = .scaleNone
@@ -248,7 +249,7 @@ private class SettingsView: NSView {
}
}
@objc public func openActivityMonitor(_ sender: Any) {
@objc private func openActivityMonitor(_ sender: Any) {
NSWorkspace.shared.launchApplication(
withBundleIdentifier: "com.apple.ActivityMonitor",
options: [.default],
@@ -258,11 +259,11 @@ private class SettingsView: NSView {
self.window?.setIsVisible(false)
}
@objc public func reportBug(_ sender: Any) {
@objc private func reportBug(_ sender: Any) {
NSWorkspace.shared.open(URL(string: "https://github.com/exelban/stats/issues/new")!)
}
@objc public func closeApp(_ sender: Any) {
@objc private func closeApp(_ sender: Any) {
NSApp.terminate(sender)
}
}
@@ -282,6 +283,7 @@ private class MenuView: NSView {
super.init(frame: NSRect(x: 0, y: self.height*CGFloat(n), width: width, height: self.height))
self.wantsLayer = true
self.layer?.backgroundColor = .clear
self.toolTip = "Open \(title == "Stats" ? "application" : title) settings"
let rect = NSRect(x: 0, y: 0, width: self.frame.width, height: self.frame.height)
let trackingArea = NSTrackingArea(rect: rect, options: [NSTrackingArea.Options.activeAlways, NSTrackingArea.Options.mouseEnteredAndExited, NSTrackingArea.Options.activeInActiveApp], owner: self, userInfo: ["menu": title])