diff --git a/SlimHUD.xcodeproj/project.pbxproj b/SlimHUD.xcodeproj/project.pbxproj index 896545ee..9a827719 100644 --- a/SlimHUD.xcodeproj/project.pbxproj +++ b/SlimHUD.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 54CD36742E307B03003B7522 /* BackdropLayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54CD36732E307B03003B7522 /* BackdropLayerView.swift */; }; FA095EAD2D8896DB006F6531 /* SystemObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA095EAC2D8896DA006F6531 /* SystemObserver.swift */; }; FA0E038629663300004066FF /* Release_Notes.md in Resources */ = {isa = PBXBuildFile; fileRef = FA0E038529663300004066FF /* Release_Notes.md */; }; FA0E03882966331A004066FF /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = FA0E038729663319004066FF /* README.md */; }; @@ -108,6 +109,11 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 54CD366F2E307A22003B7522 /* CABackdropLayer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CABackdropLayer.h; sourceTree = ""; }; + 54CD36702E307A22003B7522 /* CAFilter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CAFilter.h; sourceTree = ""; }; + 54CD36712E307A22003B7522 /* CAPropertyInfo-Protocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CAPropertyInfo-Protocol.h"; sourceTree = ""; }; + 54CD36722E307A22003B7522 /* SlimHUD-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SlimHUD-Bridging-Header.h"; sourceTree = ""; }; + 54CD36732E307B03003B7522 /* BackdropLayerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackdropLayerView.swift; sourceTree = ""; }; FA095EAC2D8896DA006F6531 /* SystemObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SystemObserver.swift; sourceTree = ""; }; FA0E038529663300004066FF /* Release_Notes.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = Release_Notes.md; sourceTree = ""; }; FA0E038729663319004066FF /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; @@ -221,6 +227,17 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 54CD366E2E307943003B7522 /* PrivateHeaders */ = { + isa = PBXGroup; + children = ( + 54CD366F2E307A22003B7522 /* CABackdropLayer.h */, + 54CD36702E307A22003B7522 /* CAFilter.h */, + 54CD36712E307A22003B7522 /* CAPropertyInfo-Protocol.h */, + 54CD36722E307A22003B7522 /* SlimHUD-Bridging-Header.h */, + ); + path = PrivateHeaders; + sourceTree = ""; + }; FA1A024E29CE80E100365137 /* Frameworks */ = { isa = PBXGroup; children = ( @@ -266,6 +283,7 @@ FA95EDF32956FCBF005B39CD /* SlimHUD */ = { isa = PBXGroup; children = ( + 54CD366E2E307943003B7522 /* PrivateHeaders */, FA95EDF42956FCBF005B39CD /* AppDelegate.swift */, FA95EE1F2956FCDA005B39CD /* Controllers */, FA95EE4B2956FE50005B39CD /* Extensions */, @@ -392,6 +410,7 @@ FA95EE622956FEE4005B39CD /* Views */ = { isa = PBXGroup; children = ( + 54CD36732E307B03003B7522 /* BackdropLayerView.swift */, FA95EE7B295741DE005B39CD /* MainMenu.storyboard */, FA95EE6C29573F36005B39CD /* Hud.swift */, FA95EE632956FEEA005B39CD /* Settings */, @@ -665,6 +684,7 @@ FA95EDF52956FCBF005B39CD /* AppDelegate.swift in Sources */, FA98AB4429CD194500D3F92A /* ShadowPopupViewController.swift in Sources */, FA95EE512956FE73005B39CD /* NSButtonExtension.swift in Sources */, + 54CD36742E307B03003B7522 /* BackdropLayerView.swift in Sources */, FA2D3DE22971EC2B00ABADDE /* MainMenuController.swift in Sources */, FACDE693297F1BD300EDF165 /* TabsView.swift in Sources */, FA232B4E2981E6A900F96E51 /* AboutViewController.swift in Sources */, @@ -860,6 +880,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.alexpera.SlimHUD; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_OBJC_BRIDGING_HEADER = "$SRCROOT/SlimHUD/PrivateHeaders/SlimHUD-Bridging-Header.h"; SWIFT_VERSION = 5.0; }; name = Debug; @@ -892,6 +913,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.alexpera.SlimHUD; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_OBJC_BRIDGING_HEADER = "$SRCROOT/SlimHUD/PrivateHeaders/SlimHUD-Bridging-Header.h"; SWIFT_VERSION = 5.0; }; name = Release; diff --git a/SlimHUD/PrivateHeaders/CABackdropLayer.h b/SlimHUD/PrivateHeaders/CABackdropLayer.h new file mode 100644 index 00000000..df7c409d --- /dev/null +++ b/SlimHUD/PrivateHeaders/CABackdropLayer.h @@ -0,0 +1,59 @@ +// +// Generated by https://github.com/blacktop/ipsw (Version: 3.1.549, BuildCommit: 3da8ece356e0f31d6b3a8e7f419e446ace69898f) +// +// - LC_BUILD_VERSION: Platform: macOS, MinOS: 15, SDK: 15, Tool: ld (1115.7.3) +// - LC_BUILD_VERSION: Platform: macCatalyst, MinOS: 18, SDK: 18, Tool: ld (1115.7.3) +// - LC_SOURCE_VERSION: 1149.6.2.0.0 +// +#ifndef CABackdropLayer_h +#define CABackdropLayer_h + +#include + +@import Foundation; + +@protocol CABackdropLayerDelegate, CALayerDelegate; + +@interface CABackdropLayer : CALayer + +@property BOOL enabled; +@property (copy) NSString *groupName; +@property BOOL usesGlobalGroupNamespace; +@property (copy) NSString *groupNamespace; +@property double scale; +@property CGRect backdropRect; +@property double marginWidth; +@property BOOL disablesOccludedBackdropBlurs; +@property BOOL captureOnly; +@property BOOL allowsInPlaceFiltering; +@property BOOL reducesCaptureBitDepth; +@property BOOL ignoresScreenClip; +@property double bleedAmount; +@property BOOL windowServerAware; +@property BOOL inverseMeshed; +@property BOOL allowsSubstituteColor; +@property struct CGColor * substituteColor; +@property BOOL ignoresOffscreenGroups; +@property double zoom; +@property (weak) id delegate; + +/* class methods */ ++ (void)initialize; ++ (id)defaultValueForKey:(id)key; ++ (id)CA_attributes; ++ (BOOL)CA_automaticallyNotifiesObservers:(Class)observers; ++ (BOOL)_hasRenderLayerSubclass; + +/* instance methods */ +- (void)didChangeValueForKey:(id)key; +- (BOOL)isEnabled; +- (void)layerDidBecomeVisible:(BOOL)visible; +- (BOOL)isInverseMeshed; +- (void *)_copyRenderLayer:(void *)layer layerFlags:(unsigned int)flags commitFlags:(unsigned int *)flags; +- (void)_renderBackgroundInContext:(struct CGContext *)context; +- (_Bool)_renderLayerDefinesProperty:(unsigned int)property; +- (unsigned int)_renderLayerPropertyAnimationFlags:(unsigned int)flags; + +@end + +#endif /* CABackdropLayer_h */ diff --git a/SlimHUD/PrivateHeaders/CAFilter.h b/SlimHUD/PrivateHeaders/CAFilter.h new file mode 100755 index 00000000..5ca2f598 --- /dev/null +++ b/SlimHUD/PrivateHeaders/CAFilter.h @@ -0,0 +1,97 @@ +/* CoreAnimation - CAFilter.h + + Copyright (c) 2006-2007 Apple Inc. + All rights reserved. */ + +#ifndef CAFILTER_H +#define CAFILTER_H + +#include +#include "CAPropertyInfo-Protocol.h" + +CA_EXTERN_C_BEGIN + +@interface CAFilter : NSObject + +@property (class, readonly) NSArray *_Nonnull filterTypes; + +@property (assign) BOOL cachesInputImage; +@property (assign, getter=isEnabled) BOOL enabled; +@property (copy) NSString *name; +@property (readonly, assign) NSString *type; + +@property (readonly, strong) NSArray *inputKeys; +@property (readonly, strong) NSArray *outputKeys; + ++ (nullable CAFilter *)filterWithType:(nonnull NSString *)type; ++ (nullable CAFilter *)filterWithName:(nonnull NSString *)name; +- (nullable instancetype)initWithType:(nonnull NSString *)type; +- (nullable instancetype)initWithName:(nonnull NSString *)name; + +- (void)setDefaults; + +@end + +/** Filter types. **/ + +CA_EXTERN NSString * const kCAFilterMultiplyColor; +CA_EXTERN NSString * const kCAFilterColorAdd; +CA_EXTERN NSString * const kCAFilterColorSubtract; +CA_EXTERN NSString * const kCAFilterColorMonochrome; +CA_EXTERN NSString * const kCAFilterColorMatrix; +CA_EXTERN NSString * const kCAFilterColorHueRotate; +CA_EXTERN NSString * const kCAFilterColorSaturate; +CA_EXTERN NSString * const kCAFilterColorBrightness; +CA_EXTERN NSString * const kCAFilterColorContrast; +CA_EXTERN NSString * const kCAFilterColorInvert; +CA_EXTERN NSString * const kCAFilterLuminanceToAlpha; +CA_EXTERN NSString * const kCAFilterBias; +CA_EXTERN NSString * const kCAFilterDistanceField; +CA_EXTERN NSString * const kCAFilterGaussianBlur; +CA_EXTERN NSString * const kCAFilterLanczosResize; +CA_EXTERN NSString * const kCAFilterClear; +CA_EXTERN NSString * const kCAFilterCopy; +CA_EXTERN NSString * const kCAFilterSourceOver; +CA_EXTERN NSString * const kCAFilterSourceIn; +CA_EXTERN NSString * const kCAFilterSourceOut; +CA_EXTERN NSString * const kCAFilterSourceAtop; +CA_EXTERN NSString * const kCAFilterDest; +CA_EXTERN NSString * const kCAFilterDestOver; +CA_EXTERN NSString * const kCAFilterDestIn; +CA_EXTERN NSString * const kCAFilterDestOut; +CA_EXTERN NSString * const kCAFilterDestAtop; +CA_EXTERN NSString * const kCAFilterXor; +CA_EXTERN NSString * const kCAFilterPlusL; +CA_EXTERN NSString * const kCAFilterSubtractS; +CA_EXTERN NSString * const kCAFilterSubtractD; +CA_EXTERN NSString * const kCAFilterMultiply; +CA_EXTERN NSString * const kCAFilterMinimum; +CA_EXTERN NSString * const kCAFilterMaximum; +CA_EXTERN NSString * const kCAFilterPlusD; +CA_EXTERN NSString * const kCAFilterNormalBlendMode; +CA_EXTERN NSString * const kCAFilterMultiplyBlendMode; +CA_EXTERN NSString * const kCAFilterScreenBlendMode; +CA_EXTERN NSString * const kCAFilterOverlayBlendMode; +CA_EXTERN NSString * const kCAFilterDarkenBlendMode; +CA_EXTERN NSString * const kCAFilterLightenBlendMode; +CA_EXTERN NSString * const kCAFilterColorDodgeBlendMode; +CA_EXTERN NSString * const kCAFilterColorBurnBlendMode; +CA_EXTERN NSString * const kCAFilterSoftLightBlendMode; +CA_EXTERN NSString * const kCAFilterHardLightBlendMode; +CA_EXTERN NSString * const kCAFilterDifferenceBlendMode; +CA_EXTERN NSString * const kCAFilterExclusionBlendMode; +CA_EXTERN NSString * const kCAFilterSubtractBlendMode; +CA_EXTERN NSString * const kCAFilterDivideBlendMode; +CA_EXTERN NSString * const kCAFilterLinearBurnBlendMode; +CA_EXTERN NSString * const kCAFilterLinearDodgeBlendMode; +CA_EXTERN NSString * const kCAFilterLinearLightBlendMode; +CA_EXTERN NSString * const kCAFilterPinLightBlendMode; +CA_EXTERN NSString * const kCAFilterPageCurl; +CA_EXTERN NSString * const kCAFilterVibrantDark; +CA_EXTERN NSString * const kCAFilterVibrantLight; +CA_EXTERN NSString * const kCAFilterDarkenSourceOver; +CA_EXTERN NSString * const kCAFilterLightenSourceOver; + +CA_EXTERN_C_END + +#endif // CAFILTER_H diff --git a/SlimHUD/PrivateHeaders/CAPropertyInfo-Protocol.h b/SlimHUD/PrivateHeaders/CAPropertyInfo-Protocol.h new file mode 100644 index 00000000..a9ef7a20 --- /dev/null +++ b/SlimHUD/PrivateHeaders/CAPropertyInfo-Protocol.h @@ -0,0 +1,27 @@ +// +// Generated by https://github.com/blacktop/ipsw (Version: 3.1.549, BuildCommit: 3da8ece356e0f31d6b3a8e7f419e446ace69898f) +// +// - LC_BUILD_VERSION: Platform: macOS, MinOS: 15, SDK: 15, Tool: ld (1115.7.3) +// - LC_BUILD_VERSION: Platform: macCatalyst, MinOS: 18, SDK: 18, Tool: ld (1115.7.3) +// - LC_SOURCE_VERSION: 1149.6.2.0.0 +// +#ifndef CAPropertyInfo_Protocol_h +#define CAPropertyInfo_Protocol_h +@import Foundation; + +@protocol CAPropertyInfo + +@required + +/* class methods */ ++ (id)properties; ++ (id)attributesForKey:(id)key; + +/* required instance methods */ +- (id)attributesForKeyPath:(id)path; + +@optional + +@end + +#endif /* CAPropertyInfo_Protocol_h */ diff --git a/SlimHUD/PrivateHeaders/SlimHUD-Bridging-Header.h b/SlimHUD/PrivateHeaders/SlimHUD-Bridging-Header.h new file mode 100644 index 00000000..c881ad00 --- /dev/null +++ b/SlimHUD/PrivateHeaders/SlimHUD-Bridging-Header.h @@ -0,0 +1,8 @@ +// +// SlimHUD-Bridging-Header.h +// SlimHUD +// +// Created by zorth64 on 17/04/25. +// +#include "CABackdropLayer.h" +#include "CAFilter.h" diff --git a/SlimHUD/Services/DisplayManager.swift b/SlimHUD/Services/DisplayManager.swift index d72641f7..29f27445 100644 --- a/SlimHUD/Services/DisplayManager.swift +++ b/SlimHUD/Services/DisplayManager.swift @@ -198,21 +198,25 @@ class DisplayManager { // }) // return windows.contains("Window Server") || windows.contains("Dock") + var foundFullScreenWindow = false + for window in windows { - if let windowName = window[kCGWindowOwnerName] as? String { - // if Window Server or Dock are visible the user is certainly not using fullscreen - if windowName == "Window Server" || windowName == "Dock" { - return false - } - if window[kCGWindowBounds]?["Height"] as? CGFloat ?? 0 == screenSize.height && - window[kCGWindowBounds]?["Width"] as? CGFloat ?? 0 == screenSize.width && - windowName != "SlimHUD" { - return true + guard let windowName = window[kCGWindowOwnerName] as? String else { continue } + // if Window Server or Dock are visible the user is certainly not using fullscreen + if windowName == "Window Server" || windowName == "Dock" { + return false + } + if let bounds = window[kCGWindowBounds] as? [String: Any], + let height = bounds["Height"] as? CGFloat, + let width = bounds["Width"] as? CGFloat { + + if height == screenSize.height && width == screenSize.width && windowName != "SlimHUD" { + foundFullScreenWindow = true } } } - return true + return foundFullScreenWindow } } diff --git a/SlimHUD/Views/BackdropLayerView.swift b/SlimHUD/Views/BackdropLayerView.swift new file mode 100644 index 00000000..8109d0b6 --- /dev/null +++ b/SlimHUD/Views/BackdropLayerView.swift @@ -0,0 +1,217 @@ +// +// BackdropLayerView.swift +// SlimHUD +// +// Created by zorth64 on 14/10/24. +// + +import SwiftUI +import QuartzCore + +public class BackdropLayerView: NSVisualEffectView { + private var backdrop: CABackdropLayer? = nil + private var tint: CALayer? = nil + private var container: CALayer? = nil + + public struct Effect { + + /// The `backgroundColor` is and autoclosure used to dynamically blend with + /// the layers and contents behind the `BackdropView`. + public let backgroundColor: () -> (NSColor) + + /// The `tintColor` is an autoclosure used to dynamically set the tint color. + /// This is also the color used when the `BackdropView` is visually inactive. + public let tintColor: () -> (NSColor) + + /// The `tintFilter` can be any object accepted by `CALayer.compositingFilter`. + public let tintFilter: Any? + + /// Create a new `BackdropView.Effect` with the provided parameters. + public init(_ backgroundColor: @autoclosure @escaping () -> (NSColor), + _ tintColor: @autoclosure @escaping () -> (NSColor), + _ tintFilter: Any?) + { + self.backgroundColor = backgroundColor + self.tintColor = tintColor + self.tintFilter = tintFilter + } + + /// A clear effect (only applies blur and saturation); when inactive, + /// appears transparent. Not suggested for typical use. + public static var clear = Effect(NSColor.clear, + NSColor.clear, + nil) + } + + public final class BlendGroup { + + /// The notification posted upon deinit of a `BlendGroup`. + fileprivate static let removedNotification = Notification.Name("BackdropView.BlendGroup.deinit") + + /// The internal value used for `CABackdropLayer.groupName`. + fileprivate let value = UUID().uuidString + + /// Create a new `BlendGroup`. + public init() {} + + deinit { + + // Alert all `BackdropView`s that we're about to be removed. + // The `BackdropView` will figure out if it needs to update itself. + NotificationCenter.default.post(name: BlendGroup.removedNotification, + object: nil, userInfo: ["value": self.value]) + } + + /// The `global` BlendGroup, if it is desired that all backdrops share + /// the same blending group through the layer tree (window). + public static let global = BlendGroup() + + /// The default internal value used for `CABackdropLayer.groupName`. + /// This is to be used if no `BlendGroup` is set on the `BackdropView`. + fileprivate static func `default`() -> String { + return UUID().uuidString + } + } + + public var effect: BackdropLayerView.Effect = .clear { + didSet { + self.backdrop?.backgroundColor = self.effect.backgroundColor().cgColor + self.tint?.backgroundColor = self.effect.tintColor().cgColor + self.tint?.compositingFilter = self.effect.tintFilter + } + } + + /// The gaussian blur radius of the visual effect. Animatable. + public var blurRadius: CGFloat { + get { return self.backdrop?.value(forKeyPath: "filters.gaussianBlur.inputRadius") as? CGFloat ?? 0 } + set { + self.backdrop?.setValue(newValue, forKeyPath: "filters.gaussianBlur.inputRadius") + } + } + + /// The background color saturation factor of the visual effect. Animatable. + public var saturationFactor: CGFloat { + get { return self.backdrop?.value(forKeyPath: "filters.colorSaturate.inputAmount") as? CGFloat ?? 0 } + set { + self.backdrop?.setValue(newValue, forKeyPath: "filters.colorSaturate.inputAmount") + } + } + + /// The corner radius of the view. + public var cornerRadius: CGFloat = 0.0 { + didSet { + self.container?.needsLayout() + self.container?.cornerRadius = self.cornerRadius + } + } + + public weak var blendingGroup: BlendGroup? = nil { + didSet { + self.backdrop?.groupName = self.blendingGroup?.value ?? BlendGroup.default() + } + } + + public override var blendingMode: NSVisualEffectView.BlendingMode { + get { return self.window?.contentView == self ? .behindWindow : .withinWindow } + set { } + } + + /// Always `.appearanceBased`; use `effect` instead. + public override var material: NSVisualEffectView.Material { + get { return .appearanceBased } + set { } + } + + public override var state: NSVisualEffectView.State { + get { return self._state } + set { self._state = newValue } + } + + private var _state: NSVisualEffectView.State = .active { + didSet { + // Don't be called when `commonInit` hasn't finished. + guard let _ = self.backdrop else { return } + + } + } + + public override init(frame frameRect: NSRect) { + super.init(frame: frameRect) + self.commonInit() + } + public required init?(coder decoder: NSCoder) { + super.init(coder: decoder) + self.commonInit() + } + + private func commonInit() { + self.wantsLayer = true + self.layerContentsRedrawPolicy = .onSetNeedsDisplay + self.layer?.masksToBounds = true + self.layer?.name = "view" + + // Essentially, tell the `NSVisualEffectView` to not do its job: + super.state = .active + super.blendingMode = .behindWindow + super.material = .appearanceBased + self.setValue(true, forKey: "clear") // internal material + + // Set up our backdrop view: + self.backdrop = CABackdropLayer() + self.backdrop!.masksToBounds = true + self.backdrop!.name = "backdrop" +// self.backdrop!.allowsGroupBlending = true + self.backdrop!.allowsGroupOpacity = true + self.backdrop!.allowsEdgeAntialiasing = false + self.backdrop!.disablesOccludedBackdropBlurs = true + self.backdrop!.ignoresOffscreenGroups = false + self.backdrop!.allowsInPlaceFiltering = false + self.backdrop!.setValue(1, forKey: "scale") + self.backdrop!.setValue(0.1, forKey: "bleedAmount") + self.backdrop!.windowServerAware = true + + // Set up the backdrop filters: + let blurFilter = CAFilter.init(type: kCAFilterGaussianBlur)! + let saturateFilter = CAFilter.init(type: kCAFilterColorSaturate)! + blurFilter.setValue(true, forKey: "inputNormalizeEdges") + self.backdrop!.filters = [blurFilter, saturateFilter] + + + self.tint = CALayer() + self.tint?.name = "tint" + self.container = CALayer() + self.container?.name = "container" + self.container?.masksToBounds = true + self.container?.allowsEdgeAntialiasing = true + self.container?.sublayers = [self.backdrop!, self.tint!] + + self.layer?.insertSublayer(self.container!, at: 0) + + self._state = .active + self.blendingMode = .behindWindow + self.setValue(true, forKey: "clear") + + self.blurRadius = 10 + self.saturationFactor = 2.5 + self.effect = .clear + self.cornerRadius = 6 + } + + /// Update sublayer `frame`. + public override func layout() { + super.layout() + self.container!.frame = self.layer?.bounds ?? .zero + self.backdrop!.frame = self.layer?.bounds ?? .zero + self.tint!.frame = self.layer?.bounds ?? .zero + } + + public override func viewDidChangeBackingProperties() { + super.viewDidChangeBackingProperties() + let scale = self.window?.backingScaleFactor ?? 1.0 + self.layer?.contentsScale = scale + self.container!.contentsScale = scale + self.backdrop!.contentsScale = scale + self.tint!.contentsScale = scale + } + +} diff --git a/SlimHUD/Views/BarView/BarView.swift b/SlimHUD/Views/BarView/BarView.swift index 0debbe4f..63d6f580 100644 --- a/SlimHUD/Views/BarView/BarView.swift +++ b/SlimHUD/Views/BarView/BarView.swift @@ -13,7 +13,8 @@ class BarView: NSView { @IBOutlet weak var bar: ProgressBar! @IBOutlet private var icon: NSImageView! - + @IBOutlet weak var backdropLayer: BackdropLayerView! + private var shadowView: NSView! override func awakeFromNib() { diff --git a/SlimHUD/Views/BarView/BarView.xib b/SlimHUD/Views/BarView/BarView.xib index d7ad9299..c91d6a02 100644 --- a/SlimHUD/Views/BarView/BarView.xib +++ b/SlimHUD/Views/BarView/BarView.xib @@ -1,8 +1,8 @@ - + - + @@ -13,6 +13,9 @@ + + + @@ -26,14 +29,19 @@ + + + + + diff --git a/SlimHUD/Views/Hud.swift b/SlimHUD/Views/Hud.swift index fbae74f0..118a3a05 100644 --- a/SlimHUD/Views/Hud.swift +++ b/SlimHUD/Views/Hud.swift @@ -47,6 +47,7 @@ class Hud: NSView { styleMask: .borderless, backing: .buffered, defer: true, screen: DisplayManager.getZeroScreen()) window.level = .floating + window.collectionBehavior.insert([.stationary]) window.backgroundColor = .clear window.animationBehavior = .none windowController = NSWindowController(window: window) @@ -177,10 +178,13 @@ class Hud: NSView { barView.bar.progressLayer.frame.size.width = thickness // setting up inner layer if flatBar { barView.bar.progressLayer.cornerRadius = 0 + barView.backdropLayer.cornerRadius = 0 } else { barView.bar.progressLayer.cornerRadius = thickness/2 + barView.backdropLayer.cornerRadius = thickness/2 } barView.bar.layer?.cornerRadius = thickness/2 // setting up outer layer + barView.backdropLayer.cornerRadius = thickness/2 barView.bar.frame.size.width = thickness updateShadow() }