mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-01 19:18:28 -04:00
@@ -205,6 +205,21 @@ Item {
|
||||
return focusedWs ? focusedWs.num : 1;
|
||||
}
|
||||
|
||||
// Numbered workspaces first in id order, named (negative id) after, by name
|
||||
function hyprlandWorkspaceOrder(a, b) {
|
||||
const keyA = a.id < 0 ? Number.MAX_SAFE_INTEGER : a.id;
|
||||
const keyB = b.id < 0 ? Number.MAX_SAFE_INTEGER : b.id;
|
||||
if (keyA !== keyB)
|
||||
return keyA - keyB;
|
||||
return (a.name ?? "").localeCompare(b.name ?? "");
|
||||
}
|
||||
|
||||
function hyprlandWorkspaceSelector(ws) {
|
||||
if (!ws)
|
||||
return 1;
|
||||
return ws.id > 0 ? ws.id : "name:" + (ws.name ?? "");
|
||||
}
|
||||
|
||||
function getHyprlandWorkspaces() {
|
||||
const workspaces = Hyprland.workspaces?.values || [];
|
||||
if (workspaces.length === 0) {
|
||||
@@ -216,7 +231,14 @@ Item {
|
||||
];
|
||||
}
|
||||
|
||||
let filtered = workspaces.filter(ws => ws.id > -1);
|
||||
// Hyprland gives named workspaces negative ids (from -1337 down); special
|
||||
// workspaces always store a "special:" name prefix ("special" pre-colon era)
|
||||
let filtered = workspaces.filter(ws => {
|
||||
if (ws.id > 0)
|
||||
return true;
|
||||
const name = ws.name ?? "";
|
||||
return name !== "special" && !name.startsWith("special:");
|
||||
});
|
||||
if (filtered.length === 0) {
|
||||
return [
|
||||
{
|
||||
@@ -227,10 +249,10 @@ Item {
|
||||
}
|
||||
|
||||
if (!root.screenName || SettingsData.workspaceFollowFocus) {
|
||||
filtered = filtered.slice().sort((a, b) => a.id - b.id);
|
||||
filtered = filtered.slice().sort(hyprlandWorkspaceOrder);
|
||||
} else {
|
||||
const monitorWorkspaces = filtered.filter(ws => ws.monitor?.name === root.screenName);
|
||||
filtered = monitorWorkspaces.length > 0 ? monitorWorkspaces.sort((a, b) => a.id - b.id) : [
|
||||
filtered = monitorWorkspaces.length > 0 ? monitorWorkspaces.sort(hyprlandWorkspaceOrder) : [
|
||||
{
|
||||
id: 1,
|
||||
name: "1"
|
||||
@@ -586,7 +608,7 @@ Item {
|
||||
break;
|
||||
case "hyprland":
|
||||
if (data.id) {
|
||||
HyprlandService.focusWorkspace(data.id);
|
||||
HyprlandService.focusWorkspace(hyprlandWorkspaceSelector(data));
|
||||
}
|
||||
break;
|
||||
case "mango":
|
||||
@@ -676,7 +698,7 @@ Item {
|
||||
return;
|
||||
}
|
||||
|
||||
HyprlandService.focusWorkspace(realWorkspaces[nextIndex].id);
|
||||
HyprlandService.focusWorkspace(hyprlandWorkspaceSelector(realWorkspaces[nextIndex]));
|
||||
} else if (root.isMango) {
|
||||
const realWorkspaces = getRealWorkspaces();
|
||||
if (realWorkspaces.length < 2) {
|
||||
@@ -718,7 +740,7 @@ Item {
|
||||
if (CompositorService.isNiri)
|
||||
return (modelData?.idx !== undefined && modelData?.idx !== -1) ? modelData.idx : "";
|
||||
if (CompositorService.isHyprland)
|
||||
return modelData?.id || "";
|
||||
return modelData?.id > 0 ? modelData.id : (modelData?.name ?? "");
|
||||
if (root.isMango)
|
||||
return (modelData?.tag !== undefined) ? (modelData.tag + 1) : "";
|
||||
if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle)
|
||||
@@ -1362,7 +1384,7 @@ Item {
|
||||
NiriService.switchToWorkspace(modelData.id);
|
||||
}
|
||||
} else if (CompositorService.isHyprland && modelData?.id) {
|
||||
HyprlandService.focusWorkspace(modelData.id);
|
||||
HyprlandService.focusWorkspace(root.hyprlandWorkspaceSelector(modelData));
|
||||
} else if (root.isMango && modelData?.tag !== undefined) {
|
||||
MangoService.switchToTag(root.screenName, modelData.tag);
|
||||
} else if ((CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) && modelData?.num) {
|
||||
|
||||
@@ -275,19 +275,30 @@ awk '$1 == "xray" { print FILENAME ":" FNR; exit }' $files 2>/dev/null`;
|
||||
iconName: "layers"
|
||||
visible: CompositorService.isNiri
|
||||
|
||||
SettingsToggleRow {
|
||||
tags: ["niri", "gaps", "override"]
|
||||
settingKey: "niriLayoutGapsOverrideEnabled"
|
||||
text: I18n.tr("Override Gaps")
|
||||
description: I18n.tr("Use custom gaps instead of bar spacing")
|
||||
checked: SettingsData.niriLayoutGapsOverride >= 0
|
||||
onToggled: checked => {
|
||||
if (checked) {
|
||||
const currentGaps = Math.max(4, (SettingsData.barConfigs[0]?.spacing ?? 4));
|
||||
SettingsData.set("niriLayoutGapsOverride", currentGaps);
|
||||
SettingsButtonGroupRow {
|
||||
tags: ["niri", "gaps", "override", "unmanaged"]
|
||||
settingKey: "niriLayoutGapsMode"
|
||||
text: I18n.tr("Gaps")
|
||||
description: I18n.tr("Auto matches bar spacing; Off leaves gaps to your niri config")
|
||||
model: [I18n.tr("Auto"), I18n.tr("Custom"), I18n.tr("Off")]
|
||||
currentIndex: {
|
||||
if (SettingsData.niriLayoutGapsOverride === -2)
|
||||
return 2;
|
||||
return SettingsData.niriLayoutGapsOverride >= 0 ? 1 : 0;
|
||||
}
|
||||
onSelectionChanged: (index, selected) => {
|
||||
if (!selected)
|
||||
return;
|
||||
switch (index) {
|
||||
case 1:
|
||||
SettingsData.set("niriLayoutGapsOverride", Math.max(4, (SettingsData.barConfigs[0]?.spacing ?? 4)));
|
||||
return;
|
||||
case 2:
|
||||
SettingsData.set("niriLayoutGapsOverride", -2);
|
||||
return;
|
||||
default:
|
||||
SettingsData.set("niriLayoutGapsOverride", -1);
|
||||
}
|
||||
SettingsData.set("niriLayoutGapsOverride", -1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,27 +404,38 @@ awk '$1 == "xray" { print FILENAME ":" FNR; exit }' $files 2>/dev/null`;
|
||||
iconName: "crop_square"
|
||||
visible: CompositorService.isHyprland
|
||||
|
||||
SettingsToggleRow {
|
||||
tags: ["hyprland", "gaps", "override"]
|
||||
settingKey: "hyprlandLayoutGapsOverrideEnabled"
|
||||
text: I18n.tr("Override Gaps")
|
||||
description: I18n.tr("Use custom gaps instead of bar spacing")
|
||||
checked: SettingsData.hyprlandLayoutGapsOverride >= 0
|
||||
onToggled: checked => {
|
||||
if (checked) {
|
||||
const currentGaps = Math.max(4, (SettingsData.barConfigs[0]?.spacing ?? 4));
|
||||
SettingsData.set("hyprlandLayoutGapsOverride", currentGaps);
|
||||
SettingsButtonGroupRow {
|
||||
tags: ["hyprland", "gaps", "override", "inner", "outer", "unmanaged"]
|
||||
settingKey: "hyprlandLayoutGapsMode"
|
||||
text: I18n.tr("Gaps")
|
||||
description: I18n.tr("Auto matches bar spacing; Off leaves gaps to your Hyprland config")
|
||||
model: [I18n.tr("Auto"), I18n.tr("Custom"), I18n.tr("Off")]
|
||||
currentIndex: {
|
||||
if (SettingsData.hyprlandLayoutGapsOverride === -2)
|
||||
return 2;
|
||||
return SettingsData.hyprlandLayoutGapsOverride >= 0 ? 1 : 0;
|
||||
}
|
||||
onSelectionChanged: (index, selected) => {
|
||||
if (!selected)
|
||||
return;
|
||||
switch (index) {
|
||||
case 1:
|
||||
SettingsData.set("hyprlandLayoutGapsOverride", Math.max(4, (SettingsData.barConfigs[0]?.spacing ?? 4)));
|
||||
return;
|
||||
case 2:
|
||||
SettingsData.set("hyprlandLayoutGapsOverride", -2);
|
||||
return;
|
||||
default:
|
||||
SettingsData.set("hyprlandLayoutGapsOverride", -1);
|
||||
}
|
||||
SettingsData.set("hyprlandLayoutGapsOverride", -1);
|
||||
}
|
||||
}
|
||||
|
||||
SettingsSliderRow {
|
||||
tags: ["hyprland", "gaps", "override"]
|
||||
tags: ["hyprland", "gaps", "override", "inner"]
|
||||
settingKey: "hyprlandLayoutGapsOverride"
|
||||
text: I18n.tr("Window Gaps")
|
||||
description: I18n.tr("Space between windows") + " (gaps_in/gaps_out)"
|
||||
text: I18n.tr("Inner Gaps")
|
||||
description: I18n.tr("Space between windows") + " (gaps_in)"
|
||||
visible: SettingsData.hyprlandLayoutGapsOverride >= 0
|
||||
value: Math.max(0, SettingsData.hyprlandLayoutGapsOverride)
|
||||
minimum: 0
|
||||
@@ -423,6 +445,20 @@ awk '$1 == "xray" { print FILENAME ":" FNR; exit }' $files 2>/dev/null`;
|
||||
onSliderValueChanged: newValue => SettingsData.set("hyprlandLayoutGapsOverride", newValue)
|
||||
}
|
||||
|
||||
SettingsSliderRow {
|
||||
tags: ["hyprland", "gaps", "override", "outer", "edge"]
|
||||
settingKey: "hyprlandLayoutGapsOutOverride"
|
||||
text: I18n.tr("Outer Gaps")
|
||||
description: I18n.tr("Space between windows and screen edges") + " (gaps_out)"
|
||||
visible: SettingsData.hyprlandLayoutGapsOverride >= 0
|
||||
value: SettingsData.hyprlandLayoutGapsOutOverride >= 0 ? SettingsData.hyprlandLayoutGapsOutOverride : Math.max(0, SettingsData.hyprlandLayoutGapsOverride)
|
||||
minimum: 0
|
||||
maximum: 50
|
||||
unit: "px"
|
||||
defaultValue: Math.max(0, SettingsData.hyprlandLayoutGapsOverride)
|
||||
onSliderValueChanged: newValue => SettingsData.set("hyprlandLayoutGapsOutOverride", newValue)
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
tags: ["hyprland", "radius", "override", "rounding"]
|
||||
settingKey: "hyprlandLayoutRadiusOverrideEnabled"
|
||||
@@ -520,27 +556,38 @@ awk '$1 == "xray" { print FILENAME ":" FNR; exit }' $files 2>/dev/null`;
|
||||
iconName: "crop_square"
|
||||
visible: CompositorService.isMango
|
||||
|
||||
SettingsToggleRow {
|
||||
tags: ["mangowc", "mango", "gaps", "override"]
|
||||
settingKey: "mangoLayoutGapsOverrideEnabled"
|
||||
text: I18n.tr("Override Gaps")
|
||||
description: I18n.tr("Use custom gaps instead of bar spacing")
|
||||
checked: SettingsData.mangoLayoutGapsOverride >= 0
|
||||
onToggled: checked => {
|
||||
if (checked) {
|
||||
const currentGaps = Math.max(4, (SettingsData.barConfigs[0]?.spacing ?? 4));
|
||||
SettingsData.set("mangoLayoutGapsOverride", currentGaps);
|
||||
SettingsButtonGroupRow {
|
||||
tags: ["mangowc", "mango", "gaps", "override", "inner", "outer", "unmanaged"]
|
||||
settingKey: "mangoLayoutGapsMode"
|
||||
text: I18n.tr("Gaps")
|
||||
description: I18n.tr("Auto matches bar spacing; Off leaves gaps to your MangoWC config")
|
||||
model: [I18n.tr("Auto"), I18n.tr("Custom"), I18n.tr("Off")]
|
||||
currentIndex: {
|
||||
if (SettingsData.mangoLayoutGapsOverride === -2)
|
||||
return 2;
|
||||
return SettingsData.mangoLayoutGapsOverride >= 0 ? 1 : 0;
|
||||
}
|
||||
onSelectionChanged: (index, selected) => {
|
||||
if (!selected)
|
||||
return;
|
||||
switch (index) {
|
||||
case 1:
|
||||
SettingsData.set("mangoLayoutGapsOverride", Math.max(4, (SettingsData.barConfigs[0]?.spacing ?? 4)));
|
||||
return;
|
||||
case 2:
|
||||
SettingsData.set("mangoLayoutGapsOverride", -2);
|
||||
return;
|
||||
default:
|
||||
SettingsData.set("mangoLayoutGapsOverride", -1);
|
||||
}
|
||||
SettingsData.set("mangoLayoutGapsOverride", -1);
|
||||
}
|
||||
}
|
||||
|
||||
SettingsSliderRow {
|
||||
tags: ["mangowc", "mango", "gaps", "override"]
|
||||
tags: ["mangowc", "mango", "gaps", "override", "inner"]
|
||||
settingKey: "mangoLayoutGapsOverride"
|
||||
text: I18n.tr("Window Gaps")
|
||||
description: I18n.tr("Space between windows") + " (gappih/gappiv/gappoh/gappov)"
|
||||
text: I18n.tr("Inner Gaps")
|
||||
description: I18n.tr("Space between windows") + " (gappih/gappiv)"
|
||||
visible: SettingsData.mangoLayoutGapsOverride >= 0
|
||||
value: Math.max(0, SettingsData.mangoLayoutGapsOverride)
|
||||
minimum: 0
|
||||
@@ -550,6 +597,20 @@ awk '$1 == "xray" { print FILENAME ":" FNR; exit }' $files 2>/dev/null`;
|
||||
onSliderValueChanged: newValue => SettingsData.set("mangoLayoutGapsOverride", newValue)
|
||||
}
|
||||
|
||||
SettingsSliderRow {
|
||||
tags: ["mangowc", "mango", "gaps", "override", "outer", "edge"]
|
||||
settingKey: "mangoLayoutGapsOutOverride"
|
||||
text: I18n.tr("Outer Gaps")
|
||||
description: I18n.tr("Space between windows and screen edges") + " (gappoh/gappov)"
|
||||
visible: SettingsData.mangoLayoutGapsOverride >= 0
|
||||
value: SettingsData.mangoLayoutGapsOutOverride >= 0 ? SettingsData.mangoLayoutGapsOutOverride : Math.max(0, SettingsData.mangoLayoutGapsOverride)
|
||||
minimum: 0
|
||||
maximum: 50
|
||||
unit: "px"
|
||||
defaultValue: Math.max(0, SettingsData.mangoLayoutGapsOverride)
|
||||
onSliderValueChanged: newValue => SettingsData.set("mangoLayoutGapsOutOverride", newValue)
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
tags: ["mangowc", "mango", "radius", "override"]
|
||||
settingKey: "mangoLayoutRadiusOverrideEnabled"
|
||||
|
||||
Reference in New Issue
Block a user