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

Compare commits

...

4 Commits

Author SHA1 Message Date
bbedward 4fb6a17e1b launcher: fix regex escaping launch args
fixes #2961
port 1.5

(cherry picked from commit a710d6d7cc)
2026-07-30 18:35:04 +00:00
bbedward e771e3b675 greeter: lua for hypr fallback 2026-07-30 14:31:39 -04:00
bbedward b1b7aa7aa2 Revert "dock: use required properties in dock item delegate, fixes context injection on Qt 6.8 (#2926)"
This reverts commit b8e2ce1da8.
2026-07-30 14:30:51 -04:00
bbedward c128793239 qs/socket: improve resilience of socket detection and connection
related #2369
port 1.5

(cherry picked from commit 64461c534f)
2026-07-27 17:41:17 +00:00
4 changed files with 103 additions and 67 deletions
+2 -4
View File
@@ -479,8 +479,6 @@ Item {
delegate: Item { delegate: Item {
id: delegateItem id: delegateItem
required property var modelData
required property int index
property var dockButton: { property var dockButton: {
switch (itemData.type) { switch (itemData.type) {
@@ -601,7 +599,7 @@ Item {
height: delegateItem.height height: delegateItem.height
actualIconSize: root.iconSize actualIconSize: root.iconSize
dockApps: root dockApps: root
index: delegateItem.index index: model.index
} }
DockTrashButton { DockTrashButton {
@@ -626,7 +624,7 @@ Item {
appData: itemData appData: itemData
contextMenu: root.contextMenu contextMenu: root.contextMenu
dockApps: root dockApps: root
index: delegateItem.index index: model.index
parentDockScreen: root.dockScreen parentDockScreen: root.dockScreen
showWindowTitle: itemData?.type === "window" || itemData?.type === "grouped" showWindowTitle: itemData?.type === "window" || itemData?.type === "grouped"
windowTitle: { windowTitle: {
+12 -8
View File
@@ -386,16 +386,20 @@ end)
HYPRLAND_LUA_EOF HYPRLAND_LUA_EOF
COMPOSITOR_CONFIG="$TEMP_CONFIG" COMPOSITOR_CONFIG="$TEMP_CONFIG"
elif [[ -z "$COMPOSITOR_CONFIG" ]]; then elif [[ -z "$COMPOSITOR_CONFIG" ]]; then
TEMP_CONFIG=$(mktemp) TEMP_CONFIG=$(mktemp --suffix=.lua)
cat > "$TEMP_CONFIG" << HYPRLAND_EOF cat > "$TEMP_CONFIG" << HYPRLAND_LUA_EOF
env = DMS_RUN_GREETER,1 hl.env("DMS_RUN_GREETER", "1")
misc { hl.config({
disable_hyprland_logo = true misc = {
} disable_hyprland_logo = true,
},
})
exec-once = sh -c "$QS_CMD; hyprctl dispatch exit" hl.on("hyprland.start", function()
HYPRLAND_EOF hl.exec_cmd('sh -c "$QS_CMD; hyprctl dispatch exit"')
end)
HYPRLAND_LUA_EOF
COMPOSITOR_CONFIG="$TEMP_CONFIG" COMPOSITOR_CONFIG="$TEMP_CONFIG"
else else
TEMP_CONFIG=$(mktemp) TEMP_CONFIG=$(mktemp)
+30 -53
View File
@@ -11,7 +11,7 @@ Singleton {
id: root id: root
readonly property var log: Log.scoped("DMSService") readonly property var log: Log.scoped("DMSService")
property bool dmsAvailable: false readonly property bool dmsAvailable: isConnected
property var capabilities: [] property var capabilities: []
property int apiVersion: 0 property int apiVersion: 0
property string cliVersion: "" property string cliVersion: ""
@@ -21,7 +21,7 @@ Singleton {
property var availableThemes: [] property var availableThemes: []
property var installedThemes: [] property var installedThemes: []
property bool isConnected: false property bool isConnected: false
property bool isConnecting: false readonly property bool isConnecting: requestSocket.connected && !requestSocket.linkUp
property bool subscribeConnected: false property bool subscribeConnected: false
readonly property string socketPath: Quickshell.env("DMS_SOCKET") readonly property string socketPath: Quickshell.env("DMS_SOCKET")
@@ -72,9 +72,10 @@ Singleton {
property var activeSubscriptions: ["network", "network.credentials", "loginctl", "freedesktop", "freedesktop.screensaver", "gamma", "theme.auto", "wallpaper", "bluetooth", "bluetooth.pairing", "brightness", "wlroutput", "evdev", "browser", "dbus", "clipboard", "sysupdate"] property var activeSubscriptions: ["network", "network.credentials", "loginctl", "freedesktop", "freedesktop.screensaver", "gamma", "theme.auto", "wallpaper", "bluetooth", "bluetooth.pairing", "brightness", "wlroutput", "evdev", "browser", "dbus", "clipboard", "sysupdate"]
Component.onCompleted: { Component.onCompleted: {
if (socketPath && socketPath.length > 0) { if (!socketPath || socketPath.length === 0)
detectUpdateCommand(); return;
} detectUpdateCommand();
requestSocket.connected = true;
} }
function detectUpdateCommand() { function detectUpdateCommand() {
@@ -82,12 +83,6 @@ Singleton {
checkAurHelper.running = true; checkAurHelper.running = true;
} }
function startSocketConnection() {
if (socketPath && socketPath.length > 0) {
testProcess.running = true;
}
}
Process { Process {
id: checkAurHelper id: checkAurHelper
command: ["sh", "-c", "command -v paru || command -v yay"] command: ["sh", "-c", "command -v paru || command -v yay"]
@@ -105,7 +100,6 @@ Singleton {
} else { } else {
updateCommand = "dms update"; updateCommand = "dms update";
checkingUpdateCommand = false; checkingUpdateCommand = false;
startSocketConnection();
} }
} }
} }
@@ -114,7 +108,6 @@ Singleton {
if (exitCode !== 0) { if (exitCode !== 0) {
updateCommand = "dms update"; updateCommand = "dms update";
checkingUpdateCommand = false; checkingUpdateCommand = false;
startSocketConnection();
} }
} }
} }
@@ -135,7 +128,6 @@ Singleton {
updateCommand = "dms update"; updateCommand = "dms update";
} }
checkingUpdateCommand = false; checkingUpdateCommand = false;
startSocketConnection();
} }
} }
@@ -143,52 +135,27 @@ Singleton {
if (exitCode !== 0) { if (exitCode !== 0) {
updateCommand = "dms update"; updateCommand = "dms update";
checkingUpdateCommand = false; checkingUpdateCommand = false;
startSocketConnection();
} }
} }
} }
Process {
id: testProcess
command: ["test", "-S", root.socketPath]
onExited: exitCode => {
if (exitCode === 0) {
root.dmsAvailable = true;
connectSocket();
} else {
root.dmsAvailable = false;
}
}
}
function connectSocket() {
if (!dmsAvailable || isConnected || isConnecting) {
return;
}
isConnecting = true;
requestSocket.connected = true;
}
DankSocket { DankSocket {
id: requestSocket id: requestSocket
path: root.socketPath path: root.socketPath
connected: false connected: false
onConnectionStateChanged: { onConnectionStateChanged: {
if (connected) { if (linkUp) {
root.isConnected = true; root.isConnected = true;
root.isConnecting = false;
root.connectionStateChanged(); root.connectionStateChanged();
subscribeSocket.connected = true; subscribeSocket.connected = true;
} else { return;
root.isConnected = false;
root.isConnecting = false;
root.apiVersion = 0;
root.capabilities = [];
root.connectionStateChanged();
} }
root.isConnected = false;
root.apiVersion = 0;
root.capabilities = [];
root.failPendingRequests();
root.connectionStateChanged();
} }
parser: SplitParser { parser: SplitParser {
@@ -219,10 +186,10 @@ Singleton {
connected: false connected: false
onConnectionStateChanged: { onConnectionStateChanged: {
root.subscribeConnected = connected; root.subscribeConnected = linkUp;
if (connected) { if (!linkUp)
sendSubscribeRequest(); return;
} sendSubscribeRequest();
} }
parser: SplitParser { parser: SplitParser {
@@ -446,10 +413,20 @@ Singleton {
function handleResponse(response) { function handleResponse(response) {
const callback = pendingRequests[response.id]; const callback = pendingRequests[response.id];
if (!callback)
return;
delete pendingRequests[response.id];
callback(response);
}
if (callback) { function failPendingRequests() {
delete pendingRequests[response.id]; const pending = pendingRequests;
callback(response); pendingRequests = {};
clipboardRequestIds = {};
for (const id in pending) {
pending[id]({
"error": "not connected to DMS socket"
});
} }
} }
+59 -2
View File
@@ -217,6 +217,64 @@ Singleton {
return envObj; return envObj;
} }
function splitShellArgs(str) {
const args = [];
let current = "";
let hasToken = false;
let quote = "";
let escaped = false;
for (const ch of str) {
if (escaped) {
current += ch;
escaped = false;
continue;
}
switch (quote) {
case "'":
if (ch === "'") {
quote = "";
continue;
}
current += ch;
continue;
case "\"":
switch (ch) {
case "\"":
quote = "";
continue;
case "\\":
escaped = true;
continue;
}
current += ch;
continue;
}
switch (ch) {
case "\\":
escaped = true;
continue;
case "'":
case "\"":
quote = ch;
hasToken = true;
continue;
case " ":
case "\t":
case "\n":
if (!hasToken && current.length === 0)
continue;
args.push(current);
current = "";
hasToken = false;
continue;
}
current += ch;
}
if (current.length > 0 || hasToken)
args.push(current);
return args;
}
function launchDesktopEntry(desktopEntry, useNvidia) { function launchDesktopEntry(desktopEntry, useNvidia) {
if (!desktopEntry || !desktopEntry.command) if (!desktopEntry || !desktopEntry.command)
return; return;
@@ -230,8 +288,7 @@ Singleton {
cmd = [nvidiaCommand].concat(cmd); cmd = [nvidiaCommand].concat(cmd);
if (override?.extraFlags) { if (override?.extraFlags) {
const extraArgs = override.extraFlags.trim().split(/\s+/).filter(arg => arg.length > 0); cmd = cmd.concat(splitShellArgs(override.extraFlags));
cmd = cmd.concat(extraArgs);
} }
const userPrefix = SettingsData.launchPrefix?.trim() || ""; const userPrefix = SettingsData.launchPrefix?.trim() || "";