1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-07 14:08:29 -04:00

compositor/xray: re-add manual bar xray toggle

This commit is contained in:
bbedward
2026-07-02 10:59:34 -04:00
parent 9ff085c46a
commit 2128e6f14e
5 changed files with 120 additions and 25 deletions
+19 -4
View File
@@ -34,6 +34,7 @@ Singleton {
// dms/layout.lua is the source of truth for xray; parsed once before the first regeneration
property bool layoutXrayEnabled: false
property bool layoutBarXrayEnabled: true
property bool _layoutXrayLoaded: false
property bool _layoutXrayLoading: false
@@ -273,6 +274,12 @@ Singleton {
generateLayoutConfig();
}
function setLayoutBarXray(enabled) {
layoutBarXrayEnabled = enabled;
_layoutXrayLoaded = true;
generateLayoutConfig();
}
function loadLayoutXrayState() {
if (_layoutXrayLoading)
return;
@@ -281,7 +288,9 @@ Singleton {
Proc.runCommand("hypr-read-layout-xray", ["cat", configDir + "/hypr/dms/layout.lua"], (output, exitCode) => {
_layoutXrayLoading = false;
if (!_layoutXrayLoaded) {
layoutXrayEnabled = exitCode === 0 && output.includes('"^dms:.*$"');
const content = exitCode === 0 ? output : "";
layoutXrayEnabled = content.includes('"^dms:.*$"');
layoutBarXrayEnabled = !content.includes("-- bar-xray off");
_layoutXrayLoaded = true;
}
if (layoutGenerationPending)
@@ -329,8 +338,8 @@ Singleton {
const frameEnabled = typeof SettingsData !== "undefined" && SettingsData.frameEnabled;
const frameConnectedMode = frameEnabled && SettingsData.frameMode === "connected";
// Hyprland `xray = false` is still early-development; unset already samples real content, so only force xray=true
// Bar/Frame sit flush on the wallpaper, so force the cheap xray blur whenever safe
const barFrameTargetNamespace = !frameEnabled ? (SettingsData.standaloneBarXrayAvailable ? "dms:bar" : null) : (frameConnectedMode ? null : "dms:frame");
// Connected frame mode has no separate bar/frame surface to target
const barFrameTargetNamespace = !frameEnabled ? "dms:bar" : (frameConnectedMode ? null : "dms:frame");
let content = `-- Auto-generated by DMS do not edit manually
@@ -355,12 +364,18 @@ hl.layer_rule({
})
`;
}
if (barFrameTargetNamespace) {
if (layoutBarXrayEnabled && barFrameTargetNamespace) {
content += `
hl.layer_rule({
match = { namespace = "^${barFrameTargetNamespace}$" },
xray = true,
})
`;
}
// Marker persists the preference even while the rule has no target
if (!layoutBarXrayEnabled) {
content += `
-- bar-xray off
`;
}