Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LG Rooter

macOS menu bar app that remaps your keyboard volume and brightness keys to an external display over DDC/CI — so Media Keys control your LG (or any DDC-capable) monitor instead of the Mac speakers / built-in panel.

用 Mac 键盘音量键 / 亮度键直接控制外接显示器的硬件音量与亮度,并在菜单栏用鼠标精细调节。

CI Release License: MIT macOS 14+ Apple Silicon

Download · 下载

Releases 下载最新的 LG-Rooter-*-macos-arm64.zip,解压后打开 LG Rooter.app

首次打开: CI 产物是 ad-hoc 签名。若 macOS 提示无法打开,请右键 → 打开,或执行 xattr -cr "LG Rooter.app"。然后在「系统设置 → 隐私与安全性 → 辅助功能」中勾选 LG Rooter。

Features · 功能

  • Media keys → monitor — Volume Up / Down / Mute and Brightness Up / Down drive the external display via DDC/CI (VCP 0x62 / 0x10)
  • Screen-aware — the display under the mouse pointer wins; keys fall through to macOS on the built-in panel
  • Native-feel ramp — hold a key for smooth acceleration, roughly matching macOS’s 16-step volume feel
  • Menu bar panel — click the status item, or press ⌥⌘L, to open the same popover anchored under the menu bar
  • Right-click menu — panel, re-scan, settings, and quit straight from the status item
  • Brightness + volume sliders — mouse drag with throttled DDC writes so the panel stays responsive
  • Wake & hotplug recovery — display map is re-read 2.5s after a wake or display reconfiguration
  • Diagnostic CLIlgrooter-diag for discovery, set, and ramp stress tests

这不是内核驱动,而是用户态菜单栏应用:通过 IOKit 已暴露的 I2C 通道发送标准 DDC/CI 指令。

Requirements · 系统要求

Requirement Detail
Mac Apple Silicon (M-series)
OS macOS 14+
Display DDC/CI enabled (LG OSD: DDC/CI / HDMI-DDC)
Cable Direct USB-C / DisplayPort / HDMI — DisplayLink docks usually do not forward DDC
Permission Accessibility (for media-key interception)

Build · 构建

git clone https://github.com/Linus-Shyu/LG-Rooter.git
cd LG-Rooter
make bundle          # swift build + package dist/LG Rooter.app
open "dist/LG Rooter.app"

Or step by step:

swift build -c release
./scripts/build-app.sh

First launch:

  1. A status-item icon appears in the menu bar
  2. Open Settings from the panel → grant Accessibility for LG Rooter
  3. Volume / brightness keys now control the external display

If no compatible display is found, the app does not intercept system media keys.

Signing tip: Accessibility grants follow the code-signing identity. Prefer a real Developer ID / Apple Development certificate so you don’t re-grant after every rebuild. The build script picks one up automatically when available.

Usage · 使用

Input Action
Volume Up / Down / Mute Adjust monitor speaker volume
Brightness Up / Down Adjust monitor backlight
Hold a media key Smooth accelerating ramp
⌥⌘L or click status item Toggle the control popover
Right-click the status item Menu: panel · re-scan · settings · quit
Sliders in the popover Mouse fine-tune

Diagnostic tool

swift run lgrooter-diag
swift run lgrooter-diag --set-volume 30
swift run lgrooter-diag --set-brightness 70
swift run lgrooter-diag --ramp          # stress-test write coalescing

Project layout · 结构

Sources/
  LGRooter/                 # AppKit / SwiftUI menu bar app
    KeyboardInterceptor.swift   # 非阻塞 CGEventTap + 超时自愈
    AppState.swift
  LGRooterCore/             # DDC/CI + 显示器状态
    DDCService.swift            # I2C 传输层(串行队列)
    DDCCommandQueue.swift       # 90ms 节流 / latest-wins
    DisplayManager.swift        # 热插拔 / 唤醒 / 鼠标焦点屏
    DDCTypes.swift
  CIOAVService/             # C bridge for private IOAVService APIs
  lgrooter-diag/            # CLI diagnostics
Bundle/Info.plist
scripts/build-app.sh

Why Swift (not C++) · 为什么是 Swift

Monitor control does not need a kernel driver. macOS already exposes an I2C path in user space; the hard parts are the menu bar UI, media-key interception, and Accessibility permissions — AppKit / SwiftUI territory. Tools like MonitorControl and BetterDisplay take the same route. Only a DriverKit system extension would force C++.

License

MIT © 2026 Linus Shyu

About

macOS menu bar app: remap volume & brightness keys to external displays over DDC/CI (Apple Silicon)

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages