mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-13 14:36:32 -04:00
mango: remove legacy dwl service
This commit is contained in:
@@ -15,7 +15,6 @@ Singleton {
|
||||
|
||||
property bool isHyprland: false
|
||||
property bool isNiri: false
|
||||
property bool isDwl: false
|
||||
property bool isMango: false
|
||||
property bool isSway: false
|
||||
property bool isScroll: false
|
||||
@@ -97,12 +96,6 @@ Singleton {
|
||||
return hyprlandMonitor.scale;
|
||||
}
|
||||
|
||||
if (isDwl && screen) {
|
||||
const dwlScale = DwlService.getOutputScale(screen.name);
|
||||
if (dwlScale !== undefined && dwlScale > 0)
|
||||
return dwlScale;
|
||||
}
|
||||
|
||||
if (isMango && screen) {
|
||||
const mangoScale = MangoService.getOutputScale(screen.name);
|
||||
if (mangoScale !== undefined && mangoScale > 0)
|
||||
@@ -121,9 +114,7 @@ Singleton {
|
||||
else if (isSway || isScroll || isMiracle) {
|
||||
const focusedWs = I3.workspaces?.values?.find(ws => ws.focused === true);
|
||||
screenName = focusedWs?.monitor?.name || "";
|
||||
} else if (isDwl && DwlService.activeOutput)
|
||||
screenName = DwlService.activeOutput;
|
||||
else if (isMango && MangoService.activeOutput)
|
||||
} else if (isMango && MangoService.activeOutput)
|
||||
screenName = MangoService.activeOutput;
|
||||
|
||||
if (!screenName)
|
||||
@@ -192,19 +183,9 @@ Singleton {
|
||||
Qt.callLater(() => {
|
||||
NiriService.generateNiriLayoutConfig();
|
||||
HyprlandService.generateLayoutConfig();
|
||||
DwlService.generateLayoutConfig();
|
||||
});
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: DwlService
|
||||
function onStateChanged() {
|
||||
if (isDwl && !isHyprland && !isNiri) {
|
||||
scheduleSort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: MangoService
|
||||
function onStateChanged() {
|
||||
@@ -271,13 +252,7 @@ Singleton {
|
||||
function _specialWorkspaceNameFromMonitor(monitor) {
|
||||
if (!monitor)
|
||||
return "";
|
||||
const candidates = [
|
||||
monitor.activeSpecialWorkspace?.name,
|
||||
monitor.specialWorkspace?.name,
|
||||
monitor.lastIpcObject?.specialWorkspace?.name,
|
||||
monitor.lastIpcObject?.specialWorkspace,
|
||||
monitor.lastIpcObject?.activeSpecialWorkspace?.name
|
||||
];
|
||||
const candidates = [monitor.activeSpecialWorkspace?.name, monitor.specialWorkspace?.name, monitor.lastIpcObject?.specialWorkspace?.name, monitor.lastIpcObject?.specialWorkspace, monitor.lastIpcObject?.activeSpecialWorkspace?.name];
|
||||
for (let i = 0; i < candidates.length; i++) {
|
||||
const normalized = _normalizeSpecialWorkspaceName(candidates[i]);
|
||||
if (normalized)
|
||||
@@ -860,7 +835,6 @@ Singleton {
|
||||
Qt.callLater(() => {
|
||||
NiriService.generateNiriLayoutConfig();
|
||||
HyprlandService.generateLayoutConfig();
|
||||
DwlService.generateLayoutConfig();
|
||||
MangoService.generateLayoutConfig();
|
||||
});
|
||||
}
|
||||
@@ -870,7 +844,6 @@ Singleton {
|
||||
if (mangoSignature && mangoSignature.length > 0) {
|
||||
isHyprland = false;
|
||||
isNiri = false;
|
||||
isDwl = false;
|
||||
isMango = true;
|
||||
isSway = false;
|
||||
isScroll = false;
|
||||
@@ -884,7 +857,6 @@ Singleton {
|
||||
if (hyprlandSignature && hyprlandSignature.length > 0 && !niriSocket && !swaySocket && !scrollSocket && !miracleSocket && !labwcPid) {
|
||||
isHyprland = true;
|
||||
isNiri = false;
|
||||
isDwl = false;
|
||||
isMango = false;
|
||||
isSway = false;
|
||||
isScroll = false;
|
||||
@@ -900,7 +872,6 @@ Singleton {
|
||||
if (exitCode === 0) {
|
||||
isNiri = true;
|
||||
isHyprland = false;
|
||||
isDwl = false;
|
||||
isMango = false;
|
||||
isSway = false;
|
||||
isScroll = false;
|
||||
@@ -919,7 +890,6 @@ Singleton {
|
||||
if (exitCode === 0) {
|
||||
isNiri = false;
|
||||
isHyprland = false;
|
||||
isDwl = false;
|
||||
isSway = true;
|
||||
isScroll = false;
|
||||
isMiracle = false;
|
||||
@@ -936,7 +906,6 @@ Singleton {
|
||||
if (exitCode === 0) {
|
||||
isNiri = false;
|
||||
isHyprland = false;
|
||||
isDwl = false;
|
||||
isMango = false;
|
||||
isSway = false;
|
||||
isScroll = false;
|
||||
@@ -954,7 +923,6 @@ Singleton {
|
||||
if (exitCode === 0) {
|
||||
isNiri = false;
|
||||
isHyprland = false;
|
||||
isDwl = false;
|
||||
isMango = false;
|
||||
isSway = false;
|
||||
isScroll = true;
|
||||
@@ -970,7 +938,6 @@ Singleton {
|
||||
if (labwcPid && labwcPid.length > 0) {
|
||||
isHyprland = false;
|
||||
isNiri = false;
|
||||
isDwl = false;
|
||||
isMango = false;
|
||||
isSway = false;
|
||||
isScroll = false;
|
||||
@@ -981,45 +948,15 @@ Singleton {
|
||||
return;
|
||||
}
|
||||
|
||||
if (DMSService.dmsAvailable) {
|
||||
Qt.callLater(checkForDwl);
|
||||
} else {
|
||||
isHyprland = false;
|
||||
isNiri = false;
|
||||
isDwl = false;
|
||||
isMango = false;
|
||||
isSway = false;
|
||||
isScroll = false;
|
||||
isMiracle = false;
|
||||
isLabwc = false;
|
||||
compositor = "unknown";
|
||||
log.warn("No compositor detected");
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: DMSService
|
||||
function onCapabilitiesReceived() {
|
||||
if (!isHyprland && !isNiri && !isDwl && !isMango && !isLabwc) {
|
||||
checkForDwl();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkForDwl() {
|
||||
if (isMango)
|
||||
return;
|
||||
if (DMSService.apiVersion >= 12 && DMSService.capabilities.includes("dwl")) {
|
||||
isHyprland = false;
|
||||
isNiri = false;
|
||||
isDwl = true;
|
||||
isSway = false;
|
||||
isScroll = false;
|
||||
isMiracle = false;
|
||||
isLabwc = false;
|
||||
compositor = "dwl";
|
||||
log.info("Detected DWL via DMS capability");
|
||||
}
|
||||
isHyprland = false;
|
||||
isNiri = false;
|
||||
isMango = false;
|
||||
isSway = false;
|
||||
isScroll = false;
|
||||
isMiracle = false;
|
||||
isLabwc = false;
|
||||
compositor = "unknown";
|
||||
log.warn("No compositor detected");
|
||||
}
|
||||
|
||||
function powerOffMonitors() {
|
||||
@@ -1027,8 +964,6 @@ Singleton {
|
||||
return NiriService.powerOffMonitors();
|
||||
if (isHyprland)
|
||||
return HyprlandService.dpmsOff();
|
||||
if (isDwl)
|
||||
return _dwlPowerOffMonitors();
|
||||
if (isMango)
|
||||
return MangoService.powerOffMonitors();
|
||||
if (isSway || isScroll || isMiracle) {
|
||||
@@ -1048,8 +983,6 @@ Singleton {
|
||||
return NiriService.powerOnMonitors();
|
||||
if (isHyprland)
|
||||
return HyprlandService.dpmsOn();
|
||||
if (isDwl)
|
||||
return _dwlPowerOnMonitors();
|
||||
if (isMango)
|
||||
return MangoService.powerOnMonitors();
|
||||
if (isSway || isScroll || isMiracle) {
|
||||
@@ -1063,32 +996,4 @@ Singleton {
|
||||
}
|
||||
log.warn("Cannot power on monitors, unknown compositor");
|
||||
}
|
||||
|
||||
function _dwlPowerOffMonitors() {
|
||||
if (!Quickshell.screens || Quickshell.screens.length === 0) {
|
||||
log.warn("No screens available for DWL power off");
|
||||
return;
|
||||
}
|
||||
|
||||
for (let i = 0; i < Quickshell.screens.length; i++) {
|
||||
const screen = Quickshell.screens[i];
|
||||
if (screen && screen.name) {
|
||||
Quickshell.execDetached(["mmsg", "dispatch", "disable_monitor," + screen.name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function _dwlPowerOnMonitors() {
|
||||
if (!Quickshell.screens || Quickshell.screens.length === 0) {
|
||||
log.warn("No screens available for DWL power on");
|
||||
return;
|
||||
}
|
||||
|
||||
for (let i = 0; i < Quickshell.screens.length; i++) {
|
||||
const screen = Quickshell.screens[i];
|
||||
if (screen && screen.name) {
|
||||
Quickshell.execDetached(["mmsg", "dispatch", "enable_monitor," + screen.name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,6 @@ Singleton {
|
||||
signal capabilitiesReceived
|
||||
signal credentialsRequest(var data)
|
||||
signal bluetoothPairingRequest(var data)
|
||||
signal dwlStateUpdate(var data)
|
||||
signal brightnessStateUpdate(var data)
|
||||
signal brightnessDeviceUpdate(var device)
|
||||
signal wlrOutputStateUpdate(var data)
|
||||
@@ -68,7 +67,7 @@ Singleton {
|
||||
property bool screensaverInhibited: false
|
||||
property var screensaverInhibitors: []
|
||||
|
||||
property var activeSubscriptions: ["network", "network.credentials", "loginctl", "freedesktop", "freedesktop.screensaver", "gamma", "theme.auto", "bluetooth", "bluetooth.pairing", "dwl", "brightness", "wlroutput", "evdev", "browser", "dbus", "clipboard", "location", "sysupdate"]
|
||||
property var activeSubscriptions: ["network", "network.credentials", "loginctl", "freedesktop", "freedesktop.screensaver", "gamma", "theme.auto", "bluetooth", "bluetooth.pairing", "brightness", "wlroutput", "evdev", "browser", "dbus", "clipboard", "location", "sysupdate"]
|
||||
|
||||
Component.onCompleted: {
|
||||
if (socketPath && socketPath.length > 0) {
|
||||
@@ -286,7 +285,7 @@ Singleton {
|
||||
|
||||
function removeSubscription(service) {
|
||||
if (activeSubscriptions.includes("all")) {
|
||||
const allServices = ["network", "loginctl", "freedesktop", "gamma", "bluetooth", "dwl", "brightness", "browser", "location"];
|
||||
const allServices = ["network", "loginctl", "freedesktop", "gamma", "bluetooth", "brightness", "browser", "location"];
|
||||
const filtered = allServices.filter(s => s !== service);
|
||||
subscribe(filtered);
|
||||
} else {
|
||||
@@ -308,7 +307,7 @@ Singleton {
|
||||
excludeServices = [excludeServices];
|
||||
}
|
||||
|
||||
const allServices = ["network", "loginctl", "freedesktop", "gamma", "theme.auto", "bluetooth", "cups", "dwl", "brightness", "browser", "dbus", "location"];
|
||||
const allServices = ["network", "loginctl", "freedesktop", "gamma", "theme.auto", "bluetooth", "cups", "brightness", "browser", "dbus", "location"];
|
||||
const filtered = allServices.filter(s => !excludeServices.includes(s));
|
||||
subscribe(filtered);
|
||||
}
|
||||
@@ -354,8 +353,6 @@ Singleton {
|
||||
bluetoothPairingRequest(data);
|
||||
} else if (service === "cups") {
|
||||
cupsStateUpdate(data);
|
||||
} else if (service === "dwl") {
|
||||
dwlStateUpdate(data);
|
||||
} else if (service === "brightness") {
|
||||
brightnessStateUpdate(data);
|
||||
} else if (service === "brightness.update") {
|
||||
|
||||
@@ -1,461 +0,0 @@
|
||||
pragma Singleton
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtCore
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
readonly property var log: Log.scoped("DwlService")
|
||||
|
||||
readonly property string configDir: Paths.strip(StandardPaths.writableLocation(StandardPaths.ConfigLocation))
|
||||
readonly property string mangoDmsDir: configDir + "/mango/dms"
|
||||
readonly property string outputsPath: mangoDmsDir + "/outputs.conf"
|
||||
readonly property string layoutPath: mangoDmsDir + "/layout.conf"
|
||||
readonly property string cursorPath: mangoDmsDir + "/cursor.conf"
|
||||
|
||||
property int _lastGapValue: -1
|
||||
|
||||
property bool dwlAvailable: false
|
||||
// Alias so consumers can treat DwlService/MangoService uniformly via `.available`.
|
||||
readonly property bool available: dwlAvailable
|
||||
property var outputs: ({})
|
||||
property var tagCount: 9
|
||||
property var layouts: []
|
||||
property string activeOutput: ""
|
||||
property var outputScales: ({})
|
||||
property string currentKeyboardLayout: {
|
||||
if (!outputs || !activeOutput)
|
||||
return "";
|
||||
const output = outputs[activeOutput];
|
||||
return (output && output.kbLayout) || "";
|
||||
}
|
||||
|
||||
signal stateChanged
|
||||
|
||||
Connections {
|
||||
target: SettingsData
|
||||
function onBarConfigsChanged() {
|
||||
if (!CompositorService.isDwl)
|
||||
return;
|
||||
const newGaps = Math.max(4, (SettingsData.barConfigs[0]?.spacing ?? 4));
|
||||
if (newGaps === root._lastGapValue)
|
||||
return;
|
||||
root._lastGapValue = newGaps;
|
||||
generateLayoutConfig();
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: CompositorService
|
||||
function onIsDwlChanged() {
|
||||
if (CompositorService.isDwl)
|
||||
generateLayoutConfig();
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: DMSService
|
||||
function onCapabilitiesReceived() {
|
||||
checkCapabilities();
|
||||
}
|
||||
function onConnectionStateChanged() {
|
||||
if (DMSService.isConnected) {
|
||||
checkCapabilities();
|
||||
} else {
|
||||
dwlAvailable = false;
|
||||
}
|
||||
}
|
||||
function onDwlStateUpdate(data) {
|
||||
if (dwlAvailable) {
|
||||
handleStateUpdate(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (DMSService.dmsAvailable)
|
||||
checkCapabilities();
|
||||
if (dwlAvailable)
|
||||
refreshOutputScales();
|
||||
if (CompositorService.isDwl)
|
||||
Qt.callLater(generateLayoutConfig);
|
||||
}
|
||||
|
||||
function checkCapabilities() {
|
||||
if (!DMSService.capabilities || !Array.isArray(DMSService.capabilities)) {
|
||||
dwlAvailable = false;
|
||||
return;
|
||||
}
|
||||
|
||||
const hasDwl = DMSService.capabilities.includes("dwl");
|
||||
if (hasDwl && !dwlAvailable) {
|
||||
dwlAvailable = true;
|
||||
log.info("DWL capability detected");
|
||||
requestState();
|
||||
refreshOutputScales();
|
||||
} else if (!hasDwl) {
|
||||
dwlAvailable = false;
|
||||
}
|
||||
}
|
||||
|
||||
function requestState() {
|
||||
if (!DMSService.isConnected || !dwlAvailable) {
|
||||
return;
|
||||
}
|
||||
|
||||
DMSService.sendRequest("dwl.getState", null, response => {
|
||||
if (response.result) {
|
||||
handleStateUpdate(response.result);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function handleStateUpdate(state) {
|
||||
outputs = state.outputs || {};
|
||||
tagCount = state.tagCount || 9;
|
||||
layouts = state.layouts || [];
|
||||
activeOutput = state.activeOutput || "";
|
||||
stateChanged();
|
||||
}
|
||||
|
||||
function setTags(outputName, tagmask, toggleTagset) {
|
||||
if (!DMSService.isConnected || !dwlAvailable) {
|
||||
return;
|
||||
}
|
||||
|
||||
DMSService.sendRequest("dwl.setTags", {
|
||||
"output": outputName,
|
||||
"tagmask": tagmask,
|
||||
"toggleTagset": toggleTagset
|
||||
}, response => {
|
||||
if (response.error) {
|
||||
log.warn("setTags error:", response.error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function setClientTags(outputName, andTags, xorTags) {
|
||||
if (!DMSService.isConnected || !dwlAvailable) {
|
||||
return;
|
||||
}
|
||||
|
||||
DMSService.sendRequest("dwl.setClientTags", {
|
||||
"output": outputName,
|
||||
"andTags": andTags,
|
||||
"xorTags": xorTags
|
||||
}, response => {
|
||||
if (response.error) {
|
||||
log.warn("setClientTags error:", response.error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function setLayout(outputName, index) {
|
||||
if (!DMSService.isConnected || !dwlAvailable) {
|
||||
return;
|
||||
}
|
||||
|
||||
DMSService.sendRequest("dwl.setLayout", {
|
||||
"output": outputName,
|
||||
"index": index
|
||||
}, response => {
|
||||
if (response.error) {
|
||||
log.warn("setLayout error:", response.error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getOutputState(outputName) {
|
||||
if (!outputs || !outputs[outputName]) {
|
||||
return null;
|
||||
}
|
||||
return outputs[outputName];
|
||||
}
|
||||
|
||||
function getActiveTags(outputName) {
|
||||
const output = getOutputState(outputName);
|
||||
if (!output || !output.tags) {
|
||||
return [];
|
||||
}
|
||||
return output.tags.filter(tag => tag.state === 1).map(tag => tag.tag);
|
||||
}
|
||||
|
||||
function getTagsWithClients(outputName) {
|
||||
const output = getOutputState(outputName);
|
||||
if (!output || !output.tags) {
|
||||
return [];
|
||||
}
|
||||
return output.tags.filter(tag => tag.clients > 0).map(tag => tag.tag);
|
||||
}
|
||||
|
||||
function getUrgentTags(outputName) {
|
||||
const output = getOutputState(outputName);
|
||||
if (!output || !output.tags) {
|
||||
return [];
|
||||
}
|
||||
return output.tags.filter(tag => tag.state === 2).map(tag => tag.tag);
|
||||
}
|
||||
|
||||
function switchToTag(outputName, tagIndex) {
|
||||
const tagmask = 1 << tagIndex;
|
||||
setTags(outputName, tagmask, 0);
|
||||
}
|
||||
|
||||
function toggleTag(outputName, tagIndex) {
|
||||
const output = getOutputState(outputName);
|
||||
if (!output || !output.tags) {
|
||||
log.debug("toggleTag: no output or tags for", outputName);
|
||||
return;
|
||||
}
|
||||
|
||||
let currentMask = 0;
|
||||
output.tags.forEach(tag => {
|
||||
if (tag.state === 1) {
|
||||
currentMask |= (1 << tag.tag);
|
||||
}
|
||||
});
|
||||
|
||||
const clickedMask = 1 << tagIndex;
|
||||
const newMask = currentMask ^ clickedMask;
|
||||
|
||||
log.debug("toggleTag:", outputName, "tag:", tagIndex, "currentMask:", currentMask.toString(2), "clickedMask:", clickedMask.toString(2), "newMask:", newMask.toString(2));
|
||||
|
||||
if (newMask === 0) {
|
||||
log.debug("toggleTag: newMask is 0, switching to tag", tagIndex);
|
||||
setTags(outputName, 1 << tagIndex, 0);
|
||||
} else {
|
||||
log.debug("toggleTag: setting combined mask", newMask);
|
||||
setTags(outputName, newMask, 0);
|
||||
}
|
||||
}
|
||||
|
||||
function quit() {
|
||||
Quickshell.execDetached(["mmsg", "dispatch", "quit"]);
|
||||
}
|
||||
|
||||
Process {
|
||||
id: scaleQueryProcess
|
||||
command: ["mmsg", "get", "all-monitors"]
|
||||
running: false
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
try {
|
||||
const newScales = {};
|
||||
const data = JSON.parse(text.trim());
|
||||
const monitors = data.monitors || [];
|
||||
for (const mon of monitors) {
|
||||
if (mon.name && typeof mon.scale === "number" && mon.scale > 0) {
|
||||
newScales[mon.name] = mon.scale;
|
||||
}
|
||||
}
|
||||
outputScales = newScales;
|
||||
} catch (e) {
|
||||
log.warn("Failed to parse mmsg output:", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onExited: exitCode => {
|
||||
if (exitCode !== 0) {
|
||||
log.warn("mmsg failed with exit code:", exitCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function refreshOutputScales() {
|
||||
if (!dwlAvailable)
|
||||
return;
|
||||
scaleQueryProcess.running = true;
|
||||
}
|
||||
|
||||
function getOutputScale(outputName) {
|
||||
return outputScales[outputName];
|
||||
}
|
||||
|
||||
function getVisibleTags(outputName) {
|
||||
const output = getOutputState(outputName);
|
||||
if (!output || !output.tags) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const visibleTags = new Set();
|
||||
|
||||
output.tags.forEach(tag => {
|
||||
if (tag.state === 1 || tag.clients > 0) {
|
||||
visibleTags.add(tag.tag);
|
||||
}
|
||||
});
|
||||
|
||||
return Array.from(visibleTags).sort((a, b) => a - b);
|
||||
}
|
||||
|
||||
function generateOutputsConfig(outputsData, callback) {
|
||||
if (!outputsData || Object.keys(outputsData).length === 0) {
|
||||
if (callback)
|
||||
callback(false);
|
||||
return;
|
||||
}
|
||||
let lines = ["# Auto-generated by DMS - do not edit manually", ""];
|
||||
|
||||
for (const outputName in outputsData) {
|
||||
const output = outputsData[outputName];
|
||||
if (!output)
|
||||
continue;
|
||||
let width = 1920;
|
||||
let height = 1080;
|
||||
let refreshRate = 60;
|
||||
if (output.modes && output.current_mode !== undefined) {
|
||||
const mode = output.modes[output.current_mode];
|
||||
if (mode) {
|
||||
width = mode.width || 1920;
|
||||
height = mode.height || 1080;
|
||||
refreshRate = Math.round((mode.refresh_rate || 60000) / 1000);
|
||||
}
|
||||
}
|
||||
|
||||
const x = output.logical?.x ?? 0;
|
||||
const y = output.logical?.y ?? 0;
|
||||
const scale = output.logical?.scale ?? 1.0;
|
||||
const transform = transformToMango(output.logical?.transform ?? "Normal");
|
||||
const vrr = output.vrr_enabled ? 1 : 0;
|
||||
|
||||
const rule = ["name:^" + outputName + "$", "width:" + width, "height:" + height, "refresh:" + refreshRate, "x:" + x, "y:" + y, "scale:" + scale, "rr:" + transform, "vrr:" + vrr].join(",");
|
||||
|
||||
lines.push("monitorrule=" + rule);
|
||||
}
|
||||
|
||||
lines.push("");
|
||||
|
||||
const content = lines.join("\n");
|
||||
|
||||
Proc.runCommand("mango-write-outputs", ["sh", "-c", `mkdir -p "${mangoDmsDir}" && cat > "${outputsPath}" << 'EOF'\n${content}EOF`], (output, exitCode) => {
|
||||
if (exitCode !== 0) {
|
||||
log.warn("Failed to write outputs config:", output);
|
||||
if (callback)
|
||||
callback(false);
|
||||
return;
|
||||
}
|
||||
log.info("Generated outputs config at", outputsPath);
|
||||
if (CompositorService.isDwl)
|
||||
reloadConfig();
|
||||
if (callback)
|
||||
callback(true);
|
||||
});
|
||||
}
|
||||
|
||||
function reloadConfig() {
|
||||
Proc.runCommand("mango-reload", ["mmsg", "dispatch", "reload_config"], (output, exitCode) => {
|
||||
if (exitCode !== 0)
|
||||
log.warn("mmsg reload_config failed:", output);
|
||||
});
|
||||
}
|
||||
|
||||
function generateLayoutConfig() {
|
||||
if (!CompositorService.isDwl)
|
||||
return;
|
||||
|
||||
const defaultRadius = typeof SettingsData !== "undefined" ? SettingsData.cornerRadius : 12;
|
||||
const defaultGaps = typeof SettingsData !== "undefined" ? Math.max(4, (SettingsData.barConfigs[0]?.spacing ?? 4)) : 4;
|
||||
const defaultBorderSize = 2;
|
||||
|
||||
const cornerRadius = (typeof SettingsData !== "undefined" && SettingsData.mangoLayoutRadiusOverride >= 0) ? SettingsData.mangoLayoutRadiusOverride : defaultRadius;
|
||||
const gaps = (typeof SettingsData !== "undefined" && SettingsData.mangoLayoutGapsOverride >= 0) ? SettingsData.mangoLayoutGapsOverride : defaultGaps;
|
||||
const borderSize = (typeof SettingsData !== "undefined" && SettingsData.mangoLayoutBorderSize >= 0) ? SettingsData.mangoLayoutBorderSize : defaultBorderSize;
|
||||
|
||||
let content = `# Auto-generated by DMS - do not edit manually
|
||||
border_radius=${cornerRadius}
|
||||
gappih=${gaps}
|
||||
gappiv=${gaps}
|
||||
gappoh=${gaps}
|
||||
gappov=${gaps}
|
||||
borderpx=${borderSize}
|
||||
`;
|
||||
|
||||
Proc.runCommand("mango-write-layout", ["sh", "-c", `mkdir -p "${mangoDmsDir}" && cat > "${layoutPath}" << 'EOF'\n${content}EOF`], (output, exitCode) => {
|
||||
if (exitCode !== 0) {
|
||||
log.warn("Failed to write layout config:", output);
|
||||
return;
|
||||
}
|
||||
log.info("Generated layout config at", layoutPath);
|
||||
reloadConfig();
|
||||
});
|
||||
}
|
||||
|
||||
function transformToMango(transform) {
|
||||
switch (transform) {
|
||||
case "Normal":
|
||||
return 0;
|
||||
case "90":
|
||||
return 1;
|
||||
case "180":
|
||||
return 2;
|
||||
case "270":
|
||||
return 3;
|
||||
case "Flipped":
|
||||
return 4;
|
||||
case "Flipped90":
|
||||
return 5;
|
||||
case "Flipped180":
|
||||
return 6;
|
||||
case "Flipped270":
|
||||
return 7;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function generateCursorConfig() {
|
||||
if (!CompositorService.isDwl)
|
||||
return;
|
||||
|
||||
log.debug("Generating cursor config...");
|
||||
|
||||
const settings = typeof SettingsData !== "undefined" ? SettingsData.cursorSettings : null;
|
||||
if (!settings) {
|
||||
Proc.runCommand("mango-write-cursor", ["sh", "-c", `mkdir -p "${mangoDmsDir}" && : > "${cursorPath}"`], (output, exitCode) => {
|
||||
if (exitCode !== 0)
|
||||
log.warn("Failed to write cursor config:", output);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const themeName = settings.theme === "System Default" ? (SettingsData.systemDefaultCursorTheme || "") : settings.theme;
|
||||
const size = settings.size || 24;
|
||||
const hideTimeout = settings.dwl?.cursorHideTimeout || 0;
|
||||
|
||||
const isDefaultConfig = !themeName && size === 24 && hideTimeout === 0;
|
||||
if (isDefaultConfig) {
|
||||
Proc.runCommand("mango-write-cursor", ["sh", "-c", `mkdir -p "${mangoDmsDir}" && : > "${cursorPath}"`], (output, exitCode) => {
|
||||
if (exitCode !== 0)
|
||||
log.warn("Failed to write cursor config:", output);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
let content = `# Auto-generated by DMS - do not edit manually
|
||||
cursor_size=${size}`;
|
||||
|
||||
if (themeName)
|
||||
content += `\ncursor_theme=${themeName}`;
|
||||
|
||||
if (hideTimeout > 0)
|
||||
content += `\ncursor_hide_timeout=${hideTimeout}`;
|
||||
|
||||
content += `\n`;
|
||||
|
||||
Proc.runCommand("mango-write-cursor", ["sh", "-c", `mkdir -p "${mangoDmsDir}" && cat > "${cursorPath}" << 'EOF'\n${content}EOF`], (output, exitCode) => {
|
||||
if (exitCode !== 0) {
|
||||
log.warn("Failed to write cursor config:", output);
|
||||
return;
|
||||
}
|
||||
log.info("Generated cursor config at", cursorPath);
|
||||
reloadConfig();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -14,13 +14,13 @@ Singleton {
|
||||
id: root
|
||||
readonly property var log: Log.scoped("KeybindsService")
|
||||
|
||||
property bool available: CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl || CompositorService.isMango
|
||||
property bool available: CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isMango
|
||||
property string currentProvider: {
|
||||
if (CompositorService.isNiri)
|
||||
return "niri";
|
||||
if (CompositorService.isHyprland)
|
||||
return "hyprland";
|
||||
if (CompositorService.isDwl || CompositorService.isMango)
|
||||
if (CompositorService.isMango)
|
||||
return "mangowc";
|
||||
return "";
|
||||
}
|
||||
@@ -30,7 +30,7 @@ Singleton {
|
||||
return "niri";
|
||||
if (CompositorService.isHyprland)
|
||||
return "hyprland";
|
||||
if (CompositorService.isDwl || CompositorService.isMango)
|
||||
if (CompositorService.isMango)
|
||||
return "mangowc";
|
||||
return "";
|
||||
}
|
||||
@@ -290,13 +290,16 @@ Singleton {
|
||||
configFile: mainConfigPath,
|
||||
backupFile: backupPath,
|
||||
fragmentFiles: [compositorConfigDir + "/dms/binds.lua", compositorConfigDir + "/dms/binds-user.lua"],
|
||||
includes: [{
|
||||
includes: [
|
||||
{
|
||||
grepPattern: "dms.binds",
|
||||
includeLine: "require(\"dms.binds\")"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
grepPattern: "dms.binds-user",
|
||||
includeLine: "require(\"dms.binds-user\")"
|
||||
}]
|
||||
}
|
||||
]
|
||||
});
|
||||
break;
|
||||
case "mangowc":
|
||||
|
||||
@@ -10,9 +10,8 @@ import qs.Services
|
||||
|
||||
// Native MangoWM IPC client. mango advertises a JSON-over-Unix-socket protocol
|
||||
// via MANGO_INSTANCE_SIGNATURE; each connection issues one `watch <target>` verb
|
||||
// and gets a full JSON snapshot followed by newline-delimited updates. Replaces
|
||||
// the legacy dwl-ipc-v2 path (DwlService) for mango, exposing a
|
||||
// DwlService-compatible tag API plus a per-client window list.
|
||||
// and gets a full JSON snapshot followed by newline-delimited updates. Exposes
|
||||
// a dwl-style tag API plus a per-client window list.
|
||||
Singleton {
|
||||
id: root
|
||||
readonly property var log: Log.scoped("MangoService")
|
||||
@@ -219,7 +218,7 @@ Singleton {
|
||||
root.windows = data.clients;
|
||||
}
|
||||
|
||||
// ── DwlService-compatible tag API ──────────────────────────────────────
|
||||
// ── Tag API (dwl-style tag model) ──────────────────────────────────────
|
||||
|
||||
function getOutputState(outputName) {
|
||||
return (outputs && outputs[outputName]) ? outputs[outputName] : null;
|
||||
|
||||
@@ -4,7 +4,6 @@ pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.I3
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
@@ -314,11 +313,6 @@ Singleton {
|
||||
return;
|
||||
}
|
||||
|
||||
if (CompositorService.isDwl) {
|
||||
DwlService.quit();
|
||||
return;
|
||||
}
|
||||
|
||||
if (CompositorService.isMango) {
|
||||
MangoService.quit();
|
||||
return;
|
||||
|
||||
@@ -35,7 +35,6 @@ Singleton {
|
||||
readonly property var conditionMap: ({
|
||||
"isNiri": () => CompositorService.isNiri,
|
||||
"isHyprland": () => CompositorService.isHyprland,
|
||||
"isDwl": () => CompositorService.isDwl,
|
||||
"isMango": () => CompositorService.isMango,
|
||||
"keybindsAvailable": () => KeybindsService.available,
|
||||
"soundsAvailable": () => AudioService.soundsAvailable,
|
||||
|
||||
@@ -279,7 +279,7 @@ Singleton {
|
||||
}
|
||||
|
||||
// High-level apply matching the generateOutputsConfig() pattern used by
|
||||
// NiriService, HyprlandService and DwlService. Instead of writing a
|
||||
// NiriService, HyprlandService and MangoService. Instead of writing a
|
||||
// config file, the changes are applied directly via the
|
||||
// wlr-output-management protocol.
|
||||
function applyOutputsConfig(outputsData, connectedOutputs) {
|
||||
|
||||
Reference in New Issue
Block a user