Skip to content

Commit b1f8427

Browse files
committed
Disable shield debugging by default
1 parent e4c3bbf commit b1f8427

4 files changed

Lines changed: 10 additions & 3 deletions

File tree

Hydra/Config/HydraConfig.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public class HydraConfig
5050

5151
public bool AutoUpdate { get; init; } = true;
5252
public bool SyncScreensaver { get; init; } = true;
53+
public bool DebugShield { get; init; } = false;
5354
public int? DeadCorners { get; init; } // pixel dead zone at screen corners; scaled by screen scale; per-host setting overrides this
5455

5556
// optional — defaults to machine hostname without domain

Hydra/Platform/MacOs/MacInputHandler.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ public void HideCursor()
5555
_ = NativeMethods.CGSSetConnectionProperty(cid, cid, key, _cfBooleanTrue);
5656
NativeMethods.CFRelease(key);
5757

58-
_ = NativeMethods.CGDisplayHideCursor(_display);
58+
if (!_shield.DebugShield)
59+
_ = NativeMethods.CGDisplayHideCursor(_display);
5960
_ = NativeMethods.CGAssociateMouseAndMouseCursorPosition(true);
6061
// near-zero suppression interval prevents CGWarpMouseCursorPosition from resetting acceleration
6162
NativeMethods.CGSetLocalEventsSuppressionInterval(0.0001);
@@ -66,7 +67,8 @@ public void ShowCursor()
6667
{
6768
if (!_cursorHidden) return;
6869
_shield.Hide();
69-
_ = NativeMethods.CGDisplayShowCursor(_display);
70+
if (!_shield.DebugShield)
71+
_ = NativeMethods.CGDisplayShowCursor(_display);
7072
_ = NativeMethods.CGAssociateMouseAndMouseCursorPosition(true);
7173
NativeMethods.CGSetLocalEventsSuppressionInterval(0.0);
7274
_cursorHidden = false;

Hydra/Platform/MacOs/MacShieldProcess.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ internal sealed class MacShieldProcess(MacNetworkState networkState) : IHostedSe
2020
// assigned after DI builds so post-startup state changes are logged through the normal pipeline
2121
internal ILogger? Log { get; set; }
2222

23+
// set after config is resolved — controls visible debug shield + cursor visibility
24+
internal bool DebugShield { get; set; }
25+
2326
// fired when network state changes after initial startup — allows NetworkWatcher to react immediately
2427
internal Action? OnNetworkStateChanged;
2528

@@ -46,7 +49,7 @@ public Task StopAsync(CancellationToken cancellationToken)
4649
return Task.CompletedTask;
4750
}
4851

49-
internal void Show() => Send(Debugger.IsAttached ? "2" : "1");
52+
internal void Show() => Send(DebugShield ? "2" : "1");
5053
internal void Hide() => Send("0");
5154

5255
public void Dispose()

Hydra/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
// shield always runs on macOS — handles cursor shielding + network state detection
7171
if (OperatingSystem.IsMacOS() && macShield != null && macNetworkState != null)
7272
{
73+
if (config != null) macShield.DebugShield = config.DebugShield;
7374
services.AddSingleton(macNetworkState);
7475
services.AddSingleton(macShield);
7576
services.AddHostedService(_ => macShield);

0 commit comments

Comments
 (0)