Skip to content

Instantly share code, notes, and snippets.

@MyrikLD
Last active March 6, 2024 08:18
Show Gist options
  • Save MyrikLD/4467d4dae3f0911cd5094b8440cbf418 to your computer and use it in GitHub Desktop.
Save MyrikLD/4467d4dae3f0911cd5094b8440cbf418 to your computer and use it in GitHub Desktop.
Waybar module for controlling brightness of an external display
//ddcutil version
"custom/brightness": {
"format": "{icon} {percentage}%",
"format-icons": ["\uDB80\uDCDE", "\uDB80\uDCDF", "\uDB80\uDCE0"],
"return-type": "json",
"exec": "ddcutil --bus 7 getvcp 10 | grep -oP 'current.*?=\\s*\\K[0-9]+' | { read x; echo '{\"percentage\":'${x}'}'; }",
"on-scroll-up": "ddcutil --noverify --bus 7 setvcp 10 + 10",
"on-scroll-down": "ddcutil --noverify --bus 7 setvcp 10 - 10",
"on-click": "ddcutil --noverify --bus 7 setvcp 10 0",
"on-click-right": "ddcutil --noverify --bus 7 setvcp 10 100",
"interval": 1,
"tooltip": false,
},
//ddccontrol version
"custom/brightness": {
"format": "{icon} {percentage}%",
"format-icons": ["\uDB80\uDCDE", "\uDB80\uDCDF", "\uDB80\uDCE0"],
"return-type": "json",
"exec-on-event": false,
"exec": "ddccontrol -r 0x10 dev:/dev/i2c-8 | grep Control | sed -En 's/.*\\/([0-9]+)\\/.*/\\1/p' | { read x; echo '{\"percentage\":'${x}'}'; }",
"on-scroll-up": "ddccontrol -r 0x10 -W +10 dev:/dev/i2c-8",
"on-scroll-down": "ddccontrol -r 0x10 -W -10 dev:/dev/i2c-8",
"on-click": "ddccontrol -r 0x10 -w 0 dev:/dev/i2c-8",
"on-click-right": "ddccontrol -r 0x10 -w 100 dev:/dev/i2c-8",
"interval": 1
},
@Doomer-Cat
Copy link

Closes my Monitors OSD each interval for me (AOC 27G2G8)

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