Skip to content

Smart installer watchdog#3

Open
fdotcico wants to merge 10 commits into
oabdrabo:mainfrom
fdotcico:smart-installer-watchdog
Open

Smart installer watchdog#3
fdotcico wants to merge 10 commits into
oabdrabo:mainfrom
fdotcico:smart-installer-watchdog

Conversation

@fdotcico

@fdotcico fdotcico commented Jun 7, 2026

Copy link
Copy Markdown

Summary

Hi, loved you program!
This PR adds an optional smart installer and safety watchdog on top of the existing display_disable binary.

The goal is to improve the setup experience and reduce the risk of being left without an active built-in display when using a MacBook with an external monitor.

What changed

  • Added scripts/install_smart.sh

    • installs display_disable if missing
    • detects the built-in display ID automatically
    • creates configurable shell aliases, defaulting to s-off and s-on
    • installs an optional LaunchAgent watchdog
    • creates a user-level watchdog configuration file
  • Added scripts/auto_enable_builtin_on_external_disconnect.sh

    • checks display state periodically
    • re-enables the built-in display if it is disabled and no trusted external display is detected
    • handles generic or fallback display names such as Display and Unknown Display
    • supports lightweight logging, optional debug logging, and log rotation
  • Added scripts/trust_current_external_displays.sh

    • lets users add currently connected external monitors to the trusted display list
    • useful for users who move between home, office, docks, or multiple monitor setups
  • Added scripts/uninstall_smart.sh

    • removes the LaunchAgent, helper scripts, config, aliases, logs, and display_disable
    • also cleans up older LaunchAgent/script names from previous versions of this setup
  • Updated README

    • preserves the original documentation
    • adds a section for the smart installer, watchdog, trusted displays, logs/retention, and uninstall behavior

Behavior

The smart setup is optional. The existing display_disable binary behavior is not changed.

The watchdog is conservative by default:

  • check interval: 10 seconds
  • unsafe confirmations: 2
  • logging disabled by default
  • debug logging disabled by default
  • log rotation enabled when logging is used

If the built-in display is already active, the watchdog does nothing.

If the built-in display is disabled and a trusted external display is present, the watchdog does nothing.

If the built-in display is disabled and no trusted external display is detected, the watchdog waits for the configured number of confirmations before re-enabling the built-in display.

Why

When the built-in display is disabled and the external display is disconnected, macOS may still report a stale or generic external display entry. In that case, the user may be left without the built-in display enabled.

The watchdog provides a safety mechanism for this scenario.

Testing

Tested on macOS with Apple Silicon and an external monitor.

Verified:

  • display_disable list detects the built-in display ID
  • s-off disables the built-in display
  • s-on re-enables the built-in display
  • watchdog stays idle when a trusted external display is connected
  • watchdog re-enables the built-in display when the external monitor is disconnected and macOS reports a generic fallback display
  • trust-displays updates ~/.displaydisabler-watchdog.conf
  • uninstall removes smart setup files, aliases, LaunchAgent, config, and binary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant