1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-05 21:15:38 -05:00

color picker: switch to dms picker

This commit is contained in:
bbedward
2025-12-03 23:18:46 -05:00
parent b6847289ff
commit 5a53447272

View File

@@ -90,43 +90,26 @@ DankModal {
root.show(); root.show();
} }
function runNiriPicker() {
Proc.runCommand("niri-pick-color", ["niri", "msg", "pick-color"], (output, exitCode) => {
if (exitCode !== 0) {
console.warn("niri msg pick-color exited with code:", exitCode);
root.show();
return;
}
const hexMatch = output.match(/Hex:\s*(#[0-9A-Fa-f]{6})/);
if (hexMatch) {
applyPickedColor(hexMatch[1]);
} else {
console.warn("Failed to parse niri pick-color output:", output);
root.show();
}
});
}
function pickColorFromScreen() { function pickColorFromScreen() {
hideInstant(); hideInstant();
Proc.runCommand("check-hyprpicker", ["which", "hyprpicker"], (output, exitCode) => { Proc.runCommand("dms-color-pick", ["dms", "color", "pick", "--json"], (output, exitCode) => {
if (exitCode === 0) { if (exitCode !== 0) {
Proc.runCommand("hyprpicker", ["hyprpicker", "--format=hex"], (hpOutput, hpCode) => { console.warn("dms color pick exited with code:", exitCode);
if (hpCode !== 0) { root.show();
console.warn("hyprpicker exited with code:", hpCode);
root.show();
return;
}
applyPickedColor(hpOutput.trim());
});
return; return;
} }
if (CompositorService.isNiri) { try {
runNiriPicker(); const result = JSON.parse(output);
return; if (result.hex) {
applyPickedColor(result.hex);
} else {
console.warn("Failed to parse dms color pick output: missing hex");
root.show();
}
} catch (e) {
console.warn("Failed to parse dms color pick JSON:", e);
root.show();
} }
console.warn("No color picker available");
root.show();
}); });
} }