mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-08 12:13:31 -04:00
feat(mango): first-class MangoWM support across DMS, dankinstaller & UI tools
- Bring up Mango to parity with niri/hyprland via a native JSON-IPC w/Native MangoServic., replaces the legacy dwl/`mmsg` path and recent breaking changes - Dankinstall: mango supported installer, config/binds templates, and packaging (Arch AUR, Fedora Terra auto-enable, Gentoo GURU) - Window rules: Go provider + CLI + Settings GUI editor - Keybinds + config reload on edit (mmsg dispatch reload_config) - Misc new supported options in DMS settings
This commit is contained in:
@@ -12,9 +12,13 @@ BasePill {
|
||||
|
||||
signal toggleLayoutPopup
|
||||
|
||||
visible: CompositorService.isDwl && DwlService.dwlAvailable
|
||||
// mango shares dwl's tag/layout model; route to the right service.
|
||||
readonly property bool isDwlLike: CompositorService.isDwl || CompositorService.isMango
|
||||
readonly property var dwlSvc: CompositorService.isMango ? MangoService : DwlService
|
||||
|
||||
property var outputState: parentScreen ? DwlService.getOutputState(parentScreen.name) : null
|
||||
visible: layout.isDwlLike && layout.dwlSvc.available
|
||||
|
||||
property var outputState: parentScreen ? layout.dwlSvc.getOutputState(parentScreen.name) : null
|
||||
property string currentLayoutSymbol: outputState?.layoutSymbol || ""
|
||||
property int currentLayoutIndex: outputState?.layout || 0
|
||||
|
||||
@@ -37,9 +41,9 @@ BasePill {
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: DwlService
|
||||
target: layout.dwlSvc
|
||||
function onStateChanged() {
|
||||
outputState = parentScreen ? DwlService.getOutputState(parentScreen.name) : null;
|
||||
outputState = parentScreen ? layout.dwlSvc.getOutputState(parentScreen.name) : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,13 +101,13 @@ BasePill {
|
||||
}
|
||||
|
||||
onRightClicked: {
|
||||
if (!parentScreen || !DwlService.dwlAvailable || DwlService.layouts.length === 0) {
|
||||
if (!parentScreen || !layout.dwlSvc.available || layout.dwlSvc.layouts.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const currentIndex = layout.currentLayoutIndex;
|
||||
const nextIndex = (currentIndex + 1) % DwlService.layouts.length;
|
||||
const nextIndex = (currentIndex + 1) % layout.dwlSvc.layouts.length;
|
||||
|
||||
DwlService.setLayout(parentScreen.name, nextIndex);
|
||||
layout.dwlSvc.setLayout(parentScreen.name, nextIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,6 +114,8 @@ BasePill {
|
||||
return NiriService.getCurrentKeyboardLayoutName();
|
||||
} else if (CompositorService.isDwl) {
|
||||
return DwlService.currentKeyboardLayout;
|
||||
} else if (CompositorService.isMango) {
|
||||
return MangoService.currentKeyboardLayout;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
@@ -208,7 +210,9 @@ BasePill {
|
||||
} else if (CompositorService.isHyprland) {
|
||||
Quickshell.execDetached(["hyprctl", "switchxkblayout", root.hyprlandKeyboard, "next"]);
|
||||
} else if (CompositorService.isDwl) {
|
||||
Quickshell.execDetached(["mmsg", "-d", "switch_keyboard_layout"]);
|
||||
Quickshell.execDetached(["mmsg", "dispatch", "switch_keyboard_layout"]);
|
||||
} else if (CompositorService.isMango) {
|
||||
MangoService.cycleKeyboardLayout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ BasePill {
|
||||
}
|
||||
|
||||
IconImage {
|
||||
visible: SettingsData.launcherLogoMode === "compositor" && (CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl || CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle || CompositorService.isLabwc)
|
||||
visible: SettingsData.launcherLogoMode === "compositor" && (CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl || CompositorService.isMango || CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle || CompositorService.isLabwc)
|
||||
anchors.centerIn: parent
|
||||
width: Theme.barIconSize(root.barThickness, SettingsData.launcherLogoSizeOffset, root.barConfig?.maximizeWidgetIcons, root.barConfig?.iconScale)
|
||||
height: Theme.barIconSize(root.barThickness, SettingsData.launcherLogoSizeOffset, root.barConfig?.maximizeWidgetIcons, root.barConfig?.iconScale)
|
||||
@@ -68,6 +68,8 @@ BasePill {
|
||||
return "file://" + Theme.shellDir + "/assets/hyprland.svg";
|
||||
} else if (CompositorService.isDwl) {
|
||||
return "file://" + Theme.shellDir + "/assets/mango.png";
|
||||
} else if (CompositorService.isMango) {
|
||||
return "file://" + Theme.shellDir + "/assets/mango.png";
|
||||
} else if (CompositorService.isSway) {
|
||||
return "file://" + Theme.shellDir + "/assets/sway.svg";
|
||||
} else if (CompositorService.isScroll) {
|
||||
|
||||
@@ -22,6 +22,11 @@ Item {
|
||||
property var hyprlandOverviewLoader: null
|
||||
property var parentScreen: null
|
||||
|
||||
// mango shares dwl's tag model; route to the right service so one set of
|
||||
// branches serves both.
|
||||
readonly property bool isDwlLike: CompositorService.isDwl || CompositorService.isMango
|
||||
readonly property var dwlSvc: CompositorService.isMango ? MangoService : DwlService
|
||||
|
||||
readonly property real _leftMargin: {
|
||||
if (isVertical)
|
||||
return 0;
|
||||
@@ -76,7 +81,8 @@ Item {
|
||||
case "hyprland":
|
||||
return Hyprland.focusedWorkspace?.monitor?.name || root.screenName;
|
||||
case "dwl":
|
||||
return DwlService.activeOutput || root.screenName;
|
||||
case "mango":
|
||||
return root.dwlSvc.activeOutput || root.screenName;
|
||||
case "sway":
|
||||
case "scroll":
|
||||
case "miracle":
|
||||
@@ -95,6 +101,7 @@ Item {
|
||||
case "niri":
|
||||
case "hyprland":
|
||||
case "dwl":
|
||||
case "mango":
|
||||
case "sway":
|
||||
case "scroll":
|
||||
case "miracle":
|
||||
@@ -121,6 +128,7 @@ Item {
|
||||
case "hyprland":
|
||||
return getHyprlandActiveWorkspace();
|
||||
case "dwl":
|
||||
case "mango":
|
||||
const activeTags = getDwlActiveTags();
|
||||
return activeTags.length > 0 ? activeTags[0] : -1;
|
||||
case "sway":
|
||||
@@ -132,7 +140,7 @@ Item {
|
||||
}
|
||||
}
|
||||
property var dwlActiveTags: {
|
||||
if (CompositorService.isDwl) {
|
||||
if (root.isDwlLike) {
|
||||
return getDwlActiveTags();
|
||||
}
|
||||
return [];
|
||||
@@ -152,6 +160,7 @@ Item {
|
||||
baseList = getHyprlandWorkspaces();
|
||||
break;
|
||||
case "dwl":
|
||||
case "mango":
|
||||
baseList = getDwlTags();
|
||||
break;
|
||||
case "sway":
|
||||
@@ -288,7 +297,7 @@ Item {
|
||||
}
|
||||
} else if (CompositorService.isHyprland) {
|
||||
targetWorkspaceId = ws.id !== undefined ? ws.id : ws;
|
||||
} else if (CompositorService.isDwl) {
|
||||
} else if (root.isDwlLike) {
|
||||
if (typeof ws !== "object" || ws.tag === undefined) {
|
||||
return [];
|
||||
}
|
||||
@@ -308,8 +317,8 @@ Item {
|
||||
} else if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) {
|
||||
const focusedWs = I3.workspaces?.values?.find(ws => ws.focused === true);
|
||||
isActiveWs = focusedWs ? (focusedWs.num === targetWorkspaceId) : false;
|
||||
} else if (CompositorService.isDwl) {
|
||||
const output = DwlService.getOutputState(root.effectiveScreenName);
|
||||
} else if (root.isDwlLike) {
|
||||
const output = root.dwlSvc.getOutputState(root.effectiveScreenName);
|
||||
if (output && output.tags) {
|
||||
const tag = output.tags.find(t => t.tag === targetWorkspaceId);
|
||||
isActiveWs = tag ? (tag.state === 1) : false;
|
||||
@@ -323,19 +332,25 @@ Item {
|
||||
return;
|
||||
}
|
||||
|
||||
let winWs = null;
|
||||
if (CompositorService.isNiri) {
|
||||
winWs = w.workspace_id;
|
||||
} else if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) {
|
||||
winWs = w.workspace?.num;
|
||||
if (CompositorService.isMango) {
|
||||
// mangoTags are 1-based; targetWorkspaceId is 0-based.
|
||||
if (!(w.mangoTags || []).includes(targetWorkspaceId + 1))
|
||||
return;
|
||||
} else {
|
||||
const hyprlandToplevels = Array.from(Hyprland.toplevels?.values || []);
|
||||
const hyprToplevel = hyprlandToplevels.find(ht => ht.wayland === w);
|
||||
winWs = hyprToplevel?.workspace?.id;
|
||||
}
|
||||
let winWs = null;
|
||||
if (CompositorService.isNiri) {
|
||||
winWs = w.workspace_id;
|
||||
} else if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) {
|
||||
winWs = w.workspace?.num;
|
||||
} else {
|
||||
const hyprlandToplevels = Array.from(Hyprland.toplevels?.values || []);
|
||||
const hyprToplevel = hyprlandToplevels.find(ht => ht.wayland === w);
|
||||
winWs = hyprToplevel?.workspace?.id;
|
||||
}
|
||||
|
||||
if (winWs === undefined || winWs === null || winWs !== targetWorkspaceId) {
|
||||
return;
|
||||
if (winWs === undefined || winWs === null || winWs !== targetWorkspaceId) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const keyBase = (w.app_id || w.appId || w.class || w.windowClass || "unknown");
|
||||
@@ -391,7 +406,7 @@ Item {
|
||||
"id": -1,
|
||||
"name": ""
|
||||
};
|
||||
} else if (CompositorService.isDwl) {
|
||||
} else if (root.isDwlLike) {
|
||||
placeholder = {
|
||||
"tag": -1
|
||||
};
|
||||
@@ -473,11 +488,11 @@ Item {
|
||||
}
|
||||
|
||||
function getDwlTags() {
|
||||
if (!DwlService.dwlAvailable)
|
||||
if (!root.dwlSvc.available)
|
||||
return [];
|
||||
|
||||
const targetScreen = root.effectiveScreenName;
|
||||
const output = DwlService.getOutputState(targetScreen);
|
||||
const output = root.dwlSvc.getOutputState(targetScreen);
|
||||
if (!output || !output.tags || output.tags.length === 0)
|
||||
return [];
|
||||
|
||||
@@ -490,7 +505,7 @@ Item {
|
||||
}));
|
||||
}
|
||||
|
||||
const visibleTagIndices = DwlService.getVisibleTags(targetScreen);
|
||||
const visibleTagIndices = root.dwlSvc.getVisibleTags(targetScreen);
|
||||
return visibleTagIndices.map(tagIndex => {
|
||||
const tagData = output.tags.find(t => t.tag === tagIndex);
|
||||
return {
|
||||
@@ -503,10 +518,10 @@ Item {
|
||||
}
|
||||
|
||||
function getDwlActiveTags() {
|
||||
if (!DwlService.dwlAvailable)
|
||||
if (!root.dwlSvc.available)
|
||||
return [];
|
||||
|
||||
return DwlService.getActiveTags(root.effectiveScreenName);
|
||||
return root.dwlSvc.getActiveTags(root.effectiveScreenName);
|
||||
}
|
||||
|
||||
function getExtWorkspaceWorkspaces() {
|
||||
@@ -557,7 +572,7 @@ Item {
|
||||
return ws && ws.idx !== -1;
|
||||
if (CompositorService.isHyprland)
|
||||
return ws && ws.id !== -1;
|
||||
if (CompositorService.isDwl)
|
||||
if (root.isDwlLike)
|
||||
return ws && ws.tag !== -1;
|
||||
if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle)
|
||||
return ws && ws.num !== -1;
|
||||
@@ -586,8 +601,9 @@ Item {
|
||||
}
|
||||
break;
|
||||
case "dwl":
|
||||
case "mango":
|
||||
if (data.tag !== undefined)
|
||||
DwlService.switchToTag(root.screenName, data.tag);
|
||||
root.dwlSvc.switchToTag(root.screenName, data.tag);
|
||||
break;
|
||||
case "sway":
|
||||
case "scroll":
|
||||
@@ -673,7 +689,7 @@ Item {
|
||||
}
|
||||
|
||||
HyprlandService.focusWorkspace(realWorkspaces[nextIndex].id);
|
||||
} else if (CompositorService.isDwl) {
|
||||
} else if (root.isDwlLike) {
|
||||
const realWorkspaces = getRealWorkspaces();
|
||||
if (realWorkspaces.length < 2) {
|
||||
return;
|
||||
@@ -687,7 +703,7 @@ Item {
|
||||
return;
|
||||
}
|
||||
|
||||
DwlService.switchToTag(root.screenName, realWorkspaces[nextIndex].tag);
|
||||
root.dwlSvc.switchToTag(root.screenName, realWorkspaces[nextIndex].tag);
|
||||
} else if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) {
|
||||
const realWorkspaces = getRealWorkspaces();
|
||||
if (realWorkspaces.length < 2) {
|
||||
@@ -715,7 +731,7 @@ Item {
|
||||
return (modelData?.idx !== undefined && modelData?.idx !== -1) ? modelData.idx : "";
|
||||
if (CompositorService.isHyprland)
|
||||
return modelData?.id || "";
|
||||
if (CompositorService.isDwl)
|
||||
if (root.isDwlLike)
|
||||
return (modelData?.tag !== undefined) ? (modelData.tag + 1) : "";
|
||||
if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle)
|
||||
return modelData?.num || "";
|
||||
@@ -730,7 +746,7 @@ Item {
|
||||
isPlaceholder = modelData?.idx === -1;
|
||||
} else if (CompositorService.isHyprland) {
|
||||
isPlaceholder = modelData?.id === -1;
|
||||
} else if (CompositorService.isDwl) {
|
||||
} else if (root.isDwlLike) {
|
||||
isPlaceholder = modelData?.tag === -1;
|
||||
} else if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) {
|
||||
isPlaceholder = modelData?.num === -1;
|
||||
@@ -765,7 +781,7 @@ Item {
|
||||
return getWorkspaceIndexFallback(modelData, index);
|
||||
}
|
||||
|
||||
readonly property bool hasNativeWorkspaceSupport: CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl || CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle
|
||||
readonly property bool hasNativeWorkspaceSupport: CompositorService.isNiri || CompositorService.isHyprland || root.isDwlLike || CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle
|
||||
readonly property bool hasWorkspaces: getRealWorkspaces().length > 0
|
||||
readonly property bool shouldShow: hasNativeWorkspaceSupport || (useExtWorkspace && hasWorkspaces)
|
||||
|
||||
@@ -983,7 +999,7 @@ Item {
|
||||
return !!(modelData && modelData.idx === root.currentWorkspace);
|
||||
if (CompositorService.isHyprland)
|
||||
return !!(modelData && modelData.id === root.currentWorkspace);
|
||||
if (CompositorService.isDwl)
|
||||
if (root.isDwlLike)
|
||||
return !!(modelData && root.dwlActiveTags.includes(modelData.tag));
|
||||
if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle)
|
||||
return !!(modelData && modelData.num === root.currentWorkspace);
|
||||
@@ -992,7 +1008,7 @@ Item {
|
||||
property bool isOccupied: {
|
||||
if (CompositorService.isHyprland)
|
||||
return Array.from(Hyprland.toplevels?.values || []).some(tl => tl.workspace?.id === modelData?.id);
|
||||
if (CompositorService.isDwl)
|
||||
if (root.isDwlLike)
|
||||
return modelData.clients > 0;
|
||||
if (CompositorService.isNiri) {
|
||||
const workspace = NiriService.allWorkspaces.find(ws => ws.idx + 1 === modelData && ws.output === root.effectiveScreenName);
|
||||
@@ -1007,7 +1023,7 @@ Item {
|
||||
return !!(modelData && modelData.idx === -1);
|
||||
if (CompositorService.isHyprland)
|
||||
return !!(modelData && modelData.id === -1);
|
||||
if (CompositorService.isDwl)
|
||||
if (root.isDwlLike)
|
||||
return !!(modelData && modelData.tag === -1);
|
||||
if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle)
|
||||
return !!(modelData && modelData.num === -1);
|
||||
@@ -1024,7 +1040,7 @@ Item {
|
||||
return modelData?.urgent ?? false;
|
||||
if (CompositorService.isNiri)
|
||||
return loadedIsUrgent;
|
||||
if (CompositorService.isDwl)
|
||||
if (root.isDwlLike)
|
||||
return modelData?.state === 2;
|
||||
if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle)
|
||||
return loadedIsUrgent;
|
||||
@@ -1081,8 +1097,12 @@ Item {
|
||||
winWs = hyprToplevel?.workspace?.id;
|
||||
}
|
||||
|
||||
if (winWs !== targetWorkspaceId)
|
||||
if (CompositorService.isMango) {
|
||||
if (!(w.mangoTags || []).includes(targetWorkspaceId + 1))
|
||||
continue;
|
||||
} else if (winWs !== targetWorkspaceId) {
|
||||
continue;
|
||||
}
|
||||
totalCount++;
|
||||
|
||||
const appKey = w.app_id || w.appId || w.class || w.windowClass || "unknown";
|
||||
@@ -1311,8 +1331,8 @@ Item {
|
||||
}
|
||||
} else if (CompositorService.isHyprland && modelData?.id) {
|
||||
HyprlandService.focusWorkspace(modelData.id);
|
||||
} else if (CompositorService.isDwl && modelData?.tag !== undefined) {
|
||||
DwlService.switchToTag(root.screenName, modelData.tag);
|
||||
} else if (root.isDwlLike && modelData?.tag !== undefined) {
|
||||
root.dwlSvc.switchToTag(root.screenName, modelData.tag);
|
||||
} else if ((CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) && modelData?.num) {
|
||||
try {
|
||||
I3.dispatch(`workspace number ${modelData.num}`);
|
||||
@@ -1323,8 +1343,8 @@ Item {
|
||||
NiriService.toggleOverview();
|
||||
} else if (CompositorService.isHyprland && root.hyprlandOverviewLoader?.item) {
|
||||
root.hyprlandOverviewLoader.item.overviewOpen = !root.hyprlandOverviewLoader.item.overviewOpen;
|
||||
} else if (CompositorService.isDwl && modelData?.tag !== undefined) {
|
||||
DwlService.toggleTag(root.screenName, modelData.tag);
|
||||
} else if (root.isDwlLike && modelData?.tag !== undefined) {
|
||||
root.dwlSvc.toggleTag(root.screenName, modelData.tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1348,7 +1368,7 @@ Item {
|
||||
wsData = modelData || null;
|
||||
} else if (CompositorService.isHyprland) {
|
||||
wsData = modelData;
|
||||
} else if (CompositorService.isDwl) {
|
||||
} else if (root.isDwlLike) {
|
||||
wsData = modelData;
|
||||
} else if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) {
|
||||
wsData = modelData;
|
||||
@@ -1362,7 +1382,7 @@ Item {
|
||||
}
|
||||
|
||||
if (SettingsData.showWorkspaceApps) {
|
||||
if (CompositorService.isDwl || CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) {
|
||||
if (root.isDwlLike || CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) {
|
||||
delegateRoot.loadedIcons = root.getWorkspaceIcons(modelData);
|
||||
} else if (CompositorService.isNiri) {
|
||||
delegateRoot.loadedIcons = root.getWorkspaceIcons(isPlaceholder ? null : modelData);
|
||||
@@ -1922,8 +1942,8 @@ Item {
|
||||
}
|
||||
}
|
||||
Connections {
|
||||
target: DwlService
|
||||
enabled: CompositorService.isDwl
|
||||
target: root.dwlSvc
|
||||
enabled: root.isDwlLike
|
||||
function onStateChanged() {
|
||||
delegateRoot.updateAllData();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user