From 9e46bd8e2c2c68ad87caa1dd2b786c0b658d377b Mon Sep 17 00:00:00 2001 From: Louis Pontoise Date: Fri, 8 Apr 2022 17:54:27 +0900 Subject: [PATCH] feat: allow quitting finder for power users (closes #1328) --- src/logic/Preferences.swift | 3 +++ src/logic/Window.swift | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/logic/Preferences.swift b/src/logic/Preferences.swift index d12b90e1..c71bde7b 100644 --- a/src/logic/Preferences.swift +++ b/src/logic/Preferences.swift @@ -64,6 +64,9 @@ class Preferences { "hideThumbnails": "false", ] + // system preferences + static var finderShowsQuitMenuItem: Bool { UserDefaults(suiteName: "com.apple.Finder")?.bool(forKey: "QuitMenuItem") ?? false } + // constant values // not exposed as preferences now but may be in the future, probably through macro preferences static var windowMaterial: NSVisualEffectView.Material { .dark } diff --git a/src/logic/Window.swift b/src/logic/Window.swift index 39e9e92e..2b173515 100644 --- a/src/logic/Window.swift +++ b/src/logic/Window.swift @@ -128,7 +128,7 @@ class Window { func quitApp() { // prevent users from quitting Finder - if application.runningApplication.bundleIdentifier == "com.apple.finder" { return } + if application.runningApplication.bundleIdentifier == "com.apple.finder" && !Preferences.finderShowsQuitMenuItem { return } BackgroundWork.accessibilityCommandsQueue.asyncWithCap { [weak self] in self?.application.runningApplication.terminate() }