mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-05 21:18:30 -04:00
compositor/xray: re-add manual bar xray toggle
This commit is contained in:
@@ -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
|
||||
`;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ Singleton {
|
||||
|
||||
// dms/layout.kdl is the source of truth for xray; parsed once before the first regeneration
|
||||
property bool layoutXrayEnabled: true
|
||||
property bool layoutBarXrayEnabled: true
|
||||
property bool _layoutXrayLoaded: false
|
||||
property bool _layoutXrayLoading: false
|
||||
|
||||
@@ -1105,6 +1106,12 @@ Singleton {
|
||||
generateNiriLayoutConfig();
|
||||
}
|
||||
|
||||
function setLayoutBarXray(enabled) {
|
||||
layoutBarXrayEnabled = enabled;
|
||||
_layoutXrayLoaded = true;
|
||||
generateNiriLayoutConfig();
|
||||
}
|
||||
|
||||
function loadLayoutXrayState() {
|
||||
if (_layoutXrayLoading)
|
||||
return;
|
||||
@@ -1113,7 +1120,9 @@ Singleton {
|
||||
Proc.runCommand("niri-read-layout-xray", ["cat", configDir + "/niri/dms/layout.kdl"], (output, exitCode) => {
|
||||
_layoutXrayLoading = false;
|
||||
if (!_layoutXrayLoaded) {
|
||||
layoutXrayEnabled = exitCode !== 0 || !output.includes("xray false");
|
||||
const content = exitCode === 0 ? output : "";
|
||||
layoutXrayEnabled = !content.includes("xray false");
|
||||
layoutBarXrayEnabled = !content.includes("// bar-xray off");
|
||||
_layoutXrayLoaded = true;
|
||||
}
|
||||
if (configGenerationPending)
|
||||
@@ -1151,8 +1160,8 @@ Singleton {
|
||||
const borderSize = (typeof SettingsData !== "undefined" && SettingsData.niriLayoutBorderSize >= 0) ? SettingsData.niriLayoutBorderSize : defaultBorderSize;
|
||||
const frameEnabled = typeof SettingsData !== "undefined" && SettingsData.frameEnabled;
|
||||
const frameConnectedMode = frameEnabled && SettingsData.frameMode === "connected";
|
||||
// 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");
|
||||
|
||||
// Xray is niri's default blur, so only the off state needs a rule
|
||||
let xrayRules = "";
|
||||
@@ -1166,7 +1175,7 @@ layer-rule {
|
||||
}`;
|
||||
}
|
||||
|
||||
if (barFrameTargetNamespace) {
|
||||
if (layoutBarXrayEnabled && barFrameTargetNamespace) {
|
||||
xrayRules += `
|
||||
|
||||
layer-rule {
|
||||
@@ -1176,6 +1185,11 @@ layer-rule {
|
||||
}
|
||||
}`;
|
||||
}
|
||||
// Marker persists the preference even while the rule has no target
|
||||
if (!layoutBarXrayEnabled)
|
||||
xrayRules += `
|
||||
|
||||
// bar-xray off`;
|
||||
|
||||
const dmsWarning = `// ! DO NOT EDIT !
|
||||
// ! AUTO-GENERATED BY DMS !
|
||||
|
||||
Reference in New Issue
Block a user