feat: cleanup + move to debug logs again after reading docs
This commit is contained in:
@@ -14,7 +14,7 @@ This project aims to be a simple and easy to use DDC brightness control plugin f
|
||||
|
||||
## Planned Features?
|
||||
|
||||
- Would be nice to get this added to the system status menu at some point isntead of its own dot
|
||||
- Would be nice to get this added to the system status menu at some point instead of its own dot
|
||||
- Support for direct i2c or better ddc controllers (not ddcutil)
|
||||
- You tell me
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ export interface ParsedDisplay {
|
||||
// Run a command asynchronously, capturing stdout. The callback always fires:
|
||||
// with stdout on success, or an empty string on failure.
|
||||
export function runCommandAsync(args: string[], callback: (stdout: string) => void): void {
|
||||
console.debug(`${LOG_PREFIX} Running: ${args.join(' ')}`);
|
||||
try {
|
||||
const subprocess = new Gio.Subprocess({
|
||||
argv: args,
|
||||
@@ -21,6 +22,7 @@ export function runCommandAsync(args: string[], callback: (stdout: string) => vo
|
||||
subprocess.communicate_utf8_async(null, null, (proc: Gio.Subprocess | null, result: Gio.AsyncResult) => {
|
||||
try {
|
||||
const [, stdout] = (proc ?? subprocess).communicate_utf8_finish(result);
|
||||
console.debug(`${LOG_PREFIX} Done: ${stdout.trim().substring(0, 80)}`);
|
||||
callback(stdout);
|
||||
} catch (e) {
|
||||
console.error(`${LOG_PREFIX} Command failed: ${e}`);
|
||||
@@ -29,6 +31,7 @@ export function runCommandAsync(args: string[], callback: (stdout: string) => vo
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(`${LOG_PREFIX} Failed to spawn: ${e}`);
|
||||
callback('');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -53,6 +53,7 @@ export class DisplayController {
|
||||
|
||||
detect(): void {
|
||||
Ddcutil.detectDisplays((parsed) => {
|
||||
if (this._disposed) return;
|
||||
this._displays = parsed.map((p) => ({
|
||||
bus: p.bus,
|
||||
name: p.name,
|
||||
@@ -67,7 +68,7 @@ export class DisplayController {
|
||||
updatingFromCode: false,
|
||||
}));
|
||||
this._detectComplete = true;
|
||||
console.log(`${LOG_PREFIX} Found ${this._displays.length} displays`);
|
||||
console.debug(`${LOG_PREFIX} Found ${this._displays.length} displays`);
|
||||
|
||||
this._mapMonitorsToDisplays();
|
||||
this.onDetectComplete?.();
|
||||
@@ -87,7 +88,7 @@ export class DisplayController {
|
||||
const idx = monitorManager.get_monitor_for_connector(display.connector);
|
||||
if (idx >= 0) {
|
||||
display.monitorIndex = idx;
|
||||
console.log(`${LOG_PREFIX} Mapped ${display.name} connector=${display.connector} -> monitor ${idx}`);
|
||||
console.debug(`${LOG_PREFIX} Mapped ${display.name} connector=${display.connector} -> monitor ${idx}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -196,6 +197,7 @@ export class DisplayController {
|
||||
|
||||
Ddcutil.readBrightness(display.bus, this._vcpCode, (value) => {
|
||||
display.reading = false;
|
||||
if (this._disposed) return;
|
||||
if (value !== null) {
|
||||
display.sentValue = value;
|
||||
this._setTarget(display, value);
|
||||
|
||||
@@ -100,6 +100,7 @@ export class BrightnessIndicator {
|
||||
menu.addMenuItem(labelRow);
|
||||
|
||||
const sliderRow = new PopupMenu.PopupBaseMenuItem({activate: false});
|
||||
sliderRow.add_style_class_name('ddc-brightness-slider');
|
||||
|
||||
const slider = new Slider.Slider(display.currentValue / 100);
|
||||
|
||||
|
||||
+1
-20
@@ -1,23 +1,4 @@
|
||||
.ddc-brightness-slider-box {
|
||||
padding: 8px 12px;
|
||||
}
|
||||
|
||||
.ddc-brightness-value-label {
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
color: #ffffff;
|
||||
min-width: 40px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.slider {
|
||||
.ddc-brightness-slider .slider {
|
||||
height: 24px;
|
||||
border-radius: 12px;
|
||||
background-color: rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
|
||||
.slider .fill-level {
|
||||
height: 24px;
|
||||
border-radius: 12px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user