1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-06-08 12:13:31 -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
+26
View File
@@ -18,9 +18,17 @@ Singleton {
readonly property string layoutPath: hyprDmsDir + "/layout.lua"
readonly property string cursorPath: hyprDmsDir + "/cursor.lua"
readonly property string windowrulesPath: hyprDmsDir + "/windowrules.lua"
readonly property bool luaConfigActive: CompositorService.isHyprland && Hyprland.usingLua === true
property int _lastGapValue: -1
onLuaConfigActiveChanged: {
if (luaConfigActive) {
Qt.callLater(generateLayoutConfig);
Qt.callLater(ensureWindowrulesConfig);
}
}
Component.onCompleted: {
if (CompositorService.isHyprland) {
Qt.callLater(generateLayoutConfig);
@@ -29,6 +37,8 @@ Singleton {
}
function ensureWindowrulesConfig() {
if (!canWriteLuaConfig("windowrules"))
return;
Proc.runCommand("hypr-ensure-windowrules", ["sh", "-c", `mkdir -p "${hyprDmsDir}" && [ ! -f "${windowrulesPath}" ] && touch "${windowrulesPath}" || true`], (output, exitCode) => {
if (exitCode !== 0)
log.warn("Failed to ensure windowrules.lua:", output);
@@ -66,6 +76,13 @@ Singleton {
return JSON.stringify(String(str ?? ""));
}
function canWriteLuaConfig(name) {
if (luaConfigActive)
return true;
log.info("Skipping Hyprland", name || "config", "Lua write because the active Hyprland config is not Lua");
return false;
}
function forceFlagValue(value) {
if (value === true)
return 1;
@@ -75,6 +92,11 @@ Singleton {
}
function generateOutputsConfig(outputsData, hyprlandSettings, callback) {
if (!canWriteLuaConfig("outputs")) {
if (callback)
callback(false);
return;
}
if (!outputsData || Object.keys(outputsData).length === 0) {
if (callback)
callback(false);
@@ -172,6 +194,8 @@ Singleton {
function generateLayoutConfig() {
if (!CompositorService.isHyprland)
return;
if (!canWriteLuaConfig("layout"))
return;
const defaultRadius = typeof SettingsData !== "undefined" ? SettingsData.cornerRadius : 12;
const defaultGaps = typeof SettingsData !== "undefined" ? Math.max(4, (SettingsData.barConfigs[0]?.spacing ?? 4)) : 4;
@@ -254,6 +278,8 @@ hl.config({
function generateCursorConfig() {
if (!CompositorService.isHyprland)
return;
if (!canWriteLuaConfig("cursor"))
return;
const settings = typeof SettingsData !== "undefined" ? SettingsData.cursorSettings : null;
if (!settings) {