1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-06-08 04:09:15 -04:00

refactor(Hyprland): Update Lua migration and keybind writes

- emit native hl.dsp.* dispatchers for generated Lua keybinds
- keep legacy hyprland.conf installs read-only but preserved until dms setup migration
This commit is contained in:
purian23
2026-05-30 23:07:06 -04:00
parent 389fffaf64
commit a265625851
20 changed files with 1056 additions and 109 deletions
@@ -21,8 +21,11 @@ Singleton {
property var includeStatus: ({
"exists": false,
"included": false
"included": false,
"configFormat": "",
"readOnly": false
})
readonly property bool readOnly: CompositorService.isHyprland && includeStatus.readOnly === true
property bool checkingInclude: false
property bool fixingInclude: false
@@ -481,6 +484,15 @@ Singleton {
// Write compositor config from a neutral config entry and optionally reload
function applyConfigEntry(configEntry, configId, profileName, isManual) {
if (CompositorService.isHyprland && readOnly) {
if (isManual) {
profilesLoading = false;
manualActivation = false;
profileError(I18n.tr("Hyprland conf mode is read-only in Settings"));
}
showHyprlandReadOnlyWarning();
return;
}
ensureEnabledOutput(configEntry);
// Capture the entry being applied so disabled-output settings fields can read
// scale/position/transform back even when wlr reports no logical viewport.
@@ -1372,7 +1384,9 @@ Singleton {
if (compositor !== "niri" && compositor !== "hyprland" && compositor !== "dwl") {
includeStatus = {
"exists": false,
"included": false
"included": false,
"configFormat": "",
"readOnly": false
};
return;
}
@@ -1386,7 +1400,9 @@ Singleton {
if (exitCode !== 0) {
includeStatus = {
"exists": false,
"included": false
"included": false,
"configFormat": "",
"readOnly": false
};
return;
}
@@ -1395,13 +1411,19 @@ Singleton {
} catch (e) {
includeStatus = {
"exists": false,
"included": false
"included": false,
"configFormat": "",
"readOnly": false
};
}
});
}
function fixOutputsInclude() {
if (readOnly) {
showHyprlandReadOnlyWarning();
return;
}
const paths = getConfigPaths();
if (!paths)
return;
@@ -1426,6 +1448,10 @@ Singleton {
});
}
function showHyprlandReadOnlyWarning() {
ToastService.showWarning(I18n.tr("Hyprland conf mode"), I18n.tr("This install is still using hyprland.conf. Run dms setup to migrate before editing display settings."), "dms setup", "display-config");
}
function buildOutputsMap() {
const map = {};
for (const output of wlrOutputs) {
@@ -1514,6 +1540,10 @@ Singleton {
NiriService.generateOutputsConfig(outputsData);
break;
case "hyprland":
if (readOnly) {
showHyprlandReadOnlyWarning();
return false;
}
HyprlandService.generateOutputsConfig(outputsData, buildMergedHyprlandSettings());
break;
case "dwl":
@@ -1523,6 +1553,7 @@ Singleton {
WlrOutputService.applyOutputsConfig(outputsData, outputs);
break;
}
return true;
}
function normalizeOutputPositions(outputsData) {
@@ -1830,6 +1861,10 @@ Singleton {
function applyChanges() {
if (!hasPendingChanges)
return;
if (CompositorService.isHyprland && readOnly) {
showHyprlandReadOnlyWarning();
return;
}
const changeDescriptions = [];
if (formatChanged) {
@@ -12,13 +12,14 @@ StyledRect {
height: warningContent.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius
readonly property bool showError: DisplayConfigState.includeStatus.exists && !DisplayConfigState.includeStatus.included
readonly property bool showSetup: !DisplayConfigState.includeStatus.exists && !DisplayConfigState.includeStatus.included
readonly property bool showLegacy: DisplayConfigState.readOnly
readonly property bool showError: !showLegacy && DisplayConfigState.includeStatus.exists && !DisplayConfigState.includeStatus.included
readonly property bool showSetup: !showLegacy && !DisplayConfigState.includeStatus.exists && !DisplayConfigState.includeStatus.included
color: (showError || showSetup) ? Theme.withAlpha(Theme.primary, 0.15) : "transparent"
border.color: (showError || showSetup) ? Theme.withAlpha(Theme.primary, 0.3) : "transparent"
color: (showLegacy || showError || showSetup) ? Theme.withAlpha(Theme.primary, 0.15) : "transparent"
border.color: (showLegacy || showError || showSetup) ? Theme.withAlpha(Theme.primary, 0.3) : "transparent"
border.width: 1
visible: (showError || showSetup) && DisplayConfigState.hasOutputBackend && !DisplayConfigState.checkingInclude
visible: (showLegacy || showError || showSetup) && DisplayConfigState.hasOutputBackend && !DisplayConfigState.checkingInclude
Column {
id: warningContent
@@ -44,6 +45,8 @@ StyledRect {
StyledText {
text: {
if (root.showLegacy)
return I18n.tr("Hyprland conf mode");
if (root.showSetup)
return I18n.tr("First Time Setup");
if (root.showError)
@@ -59,6 +62,8 @@ StyledRect {
StyledText {
text: {
if (root.showLegacy)
return I18n.tr("This install is still using hyprland.conf. Run dms setup to migrate before editing display settings.");
if (root.showSetup)
return I18n.tr("Click 'Setup' to create the outputs config and add include to your compositor config.");
if (root.showError)
@@ -75,7 +80,7 @@ StyledRect {
DankButton {
id: fixButton
visible: root.showError || root.showSetup
visible: !root.showLegacy && (root.showError || root.showSetup)
text: {
if (DisplayConfigState.fixingInclude)
return I18n.tr("Fixing...");