Browse Source

Add "Hide from Dock" option.

pull/92/head
Abhishek 4 years ago
parent
commit
a7dcd2bdc0
  1. 10
      Clocker/AppDelegate.swift

10
Clocker/AppDelegate.swift

@ -79,12 +79,11 @@ open class AppDelegate: NSObject, NSApplicationDelegate {
public func applicationDockMenu(_: NSApplication) -> NSMenu? {
let menu = NSMenu(title: "Quick Access")
Logger.log(object: ["Dock Menu Triggered": "YES"], for: "Dock Menu Triggered")
let toggleMenuItem = NSMenuItem(title: "Toggle Panel", action: #selector(AppDelegate.togglePanel(_:)), keyEquivalent: "")
let openPreferences = NSMenuItem(title: "Preferences", action: #selector(AppDelegate.openPreferencesWindow), keyEquivalent: ",")
let hideFromDockMenuItem = NSMenuItem(title: "Hide from Dock", action: #selector(AppDelegate.hideFromDock), keyEquivalent: "")
[toggleMenuItem, openPreferences].forEach {
[toggleMenuItem, openPreferences, hideFromDockMenuItem].forEach {
$0.isEnabled = true
menu.addItem($0)
}
@ -104,6 +103,11 @@ open class AppDelegate: NSObject, NSApplicationDelegate {
}
}
@objc func hideFromDock() {
UserDefaults.standard.set(0, forKey: CLAppDislayOptions)
NSApp.setActivationPolicy(.accessory)
}
private lazy var controller: OnboardingController? = {
let onboardingStoryboard = NSStoryboard(name: NSStoryboard.Name("Onboarding"), bundle: nil)
return onboardingStoryboard.instantiateController(withIdentifier: NSStoryboard.SceneIdentifier("onboardingFlow")) as? OnboardingController

Loading…
Cancel
Save