backlight: rewrite as unified brightness widget with auto-detection

parent 441e4f55
...@@ -697,29 +697,13 @@ ...@@ -697,29 +697,13 @@
}, },
"backlight": { "backlight": {
"type": "object", "type": "object",
"description": "Slider to control monitor brightness", "description": "Unified brightness control widget. Auto-detects display backlights (/sys/class/backlight), DDC/CI monitors, and keyboard backlights (/sys/class/leds/*kbd*).",
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
"device": {
"type": "string",
"description": "Name of monitor (find possible devices using `ls /sys/class/backlight` or `ls /sys/class/leds`)",
"default": "intel_backlight"
},
"subsystem": {
"type": "string",
"description": "Kernel subsystem for brightness control. Use 'ddc' for external monitors via DDC/CI (requires build with -Dddc=true).",
"default": "backlight",
"enum": ["backlight", "leds", "ddc"]
},
"min": { "min": {
"type": "integer", "type": "integer",
"default": 0, "default": 0,
"description": "Lowest possible value for brightness" "description": "Lowest possible value for brightness"
},
"display-number": {
"type": "integer",
"default": 0,
"description": "DDC display number (from ddcutil detect). 0 means first available. Only used with subsystem 'ddc'."
} }
} }
}, },
......
...@@ -2,7 +2,7 @@ namespace XimperShellNotificationCenter.Widgets { ...@@ -2,7 +2,7 @@ namespace XimperShellNotificationCenter.Widgets {
public struct DdcDisplayInfo { public struct DdcDisplayInfo {
int dispno; int dispno;
string model_name; string display_name;
} }
class DdcUtil { class DdcUtil {
...@@ -51,9 +51,13 @@ namespace XimperShellNotificationCenter.Widgets { ...@@ -51,9 +51,13 @@ namespace XimperShellNotificationCenter.Widgets {
DdcDisplayInfo[] result = {}; DdcDisplayInfo[] result = {};
for (int i = 0; i < dlist.ct; i++) { for (int i = 0; i < dlist.ct; i++) {
string mfg = ((string) dlist.info[i].mfg_id).dup ().strip ();
string model = ((string) dlist.info[i].model_name).dup ().strip ();
string name = mfg.length > 0
? "%s %s".printf (mfg, model) : model;
result += DdcDisplayInfo () { result += DdcDisplayInfo () {
dispno = dlist.info[i].dispno, dispno = dlist.info[i].dispno,
model_name = ((string) dlist.info[i].model_name).dup (), display_name = name,
}; };
} }
return result; return result;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment