Skip to content

Commit 649236c

Browse files
Fix HUDs in full screen #136
1 parent c8e0a8c commit 649236c

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

Release_Notes.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Rehide System HUD after sleep / monitor changes / lid changes
33
* Fixed side grow in/out animation that would sometimes get stuck at half
44
* Fixed an issue that prevented internal monitor brightness retrieval after an external monitor was connected
5+
* Fixed an issue that was preventing the huds from being shown when changing to a full screen application
56

67
# 1.5.1 - Background bar
78
* Better visibility of the bar by adding custom shadows

SlimHUD/Services/DisplayManager.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ class DisplayManager {
1717
private static var method = SensorMethod.standard
1818

1919
// When the monitor settings change we should invoke this to try all methods again
20-
// example: connects an external monitor with which brightness doesn't work, then disconnects it. Now the internal monitor should be recognised, but the old allFailed status would still be there
20+
// example: connects an external monitor with which brightness doesn't work, then disconnects it. Now the internal
21+
// monitor should be recognised, but the old allFailed status would still be there
2122
static func resetMethod() {
2223
method = .standard
2324
}

SlimHUD/Services/Displayer.swift

+16
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class Displayer: HudsControllerInterface {
1616
private var keyboardHud: Hud
1717

1818
public var temporarelyEnableAllBars = false
19+
var spaceObserver: NSObjectProtocol?
1920

2021
init(positionManager: PositionManager, volumeHud: Hud, brightnessHud: Hud, keyboardHud: Hud) {
2122
self.positionManager = positionManager
@@ -26,6 +27,21 @@ class Displayer: HudsControllerInterface {
2627
volumeHud.setIconImage(icon: IconManager.getStandardVolumeIcon(isMuted: VolumeManager.isMuted()))
2728
brightnessHud.setIconImage(icon: IconManager.getStandardBrightnessIcon())
2829
keyboardHud.setIconImage(icon: IconManager.getStandardKeyboardIcon())
30+
31+
self.spaceObserver = NSWorkspace.shared.notificationCenter.addObserver(
32+
forName: NSWorkspace.activeSpaceDidChangeNotification,
33+
object: nil,
34+
queue: .main) { [weak self] _ in
35+
if let self = self {
36+
self.hideAll()
37+
}
38+
}
39+
}
40+
41+
func hideAll() {
42+
volumeHud.hide(animated: false)
43+
brightnessHud.hide(animated: false)
44+
keyboardHud.hide(animated: false)
2945
}
3046

3147
func showVolumeHUD() {

0 commit comments

Comments
 (0)