feat: add preference: fade out animation for the main ui (closes #234)

This commit is contained in:
Louis Pontoise authored and lwouis committed 2020-05-10 10:06:10 +09:00
1 parent 257b8a369c
commit ee307259c4
4 files changed
+11 -1

No files matched your search

+3
View File
@@ -64,6 +64,9 @@
/* No comment provided by engineer. */
"Don’t check for updates periodically" = "Don’t check for updates periodically";
/* No comment provided by engineer. */
"Fade out animation:" = "Fade out animation:";
/* No comment provided by engineer. */
"General" = "General";
+2
View File
@@ -32,6 +32,7 @@ class Preferences {
"appsToShow": "0",
"spacesToShow": "0",
"screensToShow": "0",
"fadeOutAnimation": "false",
"hideSpaceNumberLabels": "false",
"startAtLogin": "true",
]
@@ -66,6 +67,7 @@ class Preferences {
static var showHiddenWindows: Bool { defaults.bool("showHiddenWindows") }
static var showTabsAsWindows: Bool { defaults.bool("showTabsAsWindows") }
static var windowDisplayDelay: DispatchTimeInterval { DispatchTimeInterval.milliseconds(defaults.int("windowDisplayDelay")) }
static var fadeOutAnimation: Bool { defaults.bool("fadeOutAnimation") }
static var hideSpaceNumberLabels: Bool { defaults.bool("hideSpaceNumberLabels") }
static var startAtLogin: Bool { defaults.bool("startAtLogin") }
+5 -1
View File
@@ -6,7 +6,7 @@ class ThumbnailsPanel: NSPanel {
convenience init() {
self.init(contentRect: .zero, styleMask: .utilityWindow, backing: .buffered, defer: true)
isFloatingPanel = true
animationBehavior = .none
updateFadeOutAnimation()
hidesOnDeactivate = false
hasShadow = false
titleVisibility = .hidden
@@ -20,6 +20,10 @@ class ThumbnailsPanel: NSPanel {
setAccessibilitySubrole(.unknown)
}
func updateFadeOutAnimation() {
animationBehavior = Preferences.fadeOutAnimation ? .utilityWindow : .none
}
func show() {
makeKeyAndOrderFront(nil)
thumbnailsView.scrollView.flashScrollers()
@@ -18,6 +18,7 @@ class AppearanceTab: NSViewController, PreferencePane {
LabelAndControl.makeLabelWithSlider(NSLocalizedString("Window title font size:", comment: ""), "fontHeight", 0, 64, 11, false, "px"),
LabelAndControl.makeLabelWithDropdown(NSLocalizedString("Show on:", comment: ""), "showOnScreen", ShowOnScreenPreference.allCases),
LabelAndControl.makeLabelWithSlider(NSLocalizedString("Apparition delay:", comment: ""), "windowDisplayDelay", 0, 2000, 11, false, "ms"),
LabelAndControl.makeLabelWithCheckbox(NSLocalizedString("Fade out animation:", comment: ""), "fadeOutAnimation", extraAction: { _ in App.app.thumbnailsPanel.updateFadeOutAnimation() }),
LabelAndControl.makeLabelWithCheckbox(NSLocalizedString("Hide space number labels:", comment: ""), "hideSpaceNumberLabels"),
LabelAndControl.makeLabelWithCheckbox(NSLocalizedString("Show standard tabs as windows:", comment: ""), "showTabsAsWindows"),
])