mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-01 19:18:28 -04:00
@@ -182,7 +182,7 @@ Item {
|
|||||||
function mapWorkspace(ws) {
|
function mapWorkspace(ws) {
|
||||||
return {
|
return {
|
||||||
"num": ws.number,
|
"num": ws.number,
|
||||||
"name": ws.name,
|
"name": stripSwayWorkspaceNumber(ws.number, ws.name),
|
||||||
"focused": ws.focused,
|
"focused": ws.focused,
|
||||||
"active": ws.active,
|
"active": ws.active,
|
||||||
"urgent": ws.urgent,
|
"urgent": ws.urgent,
|
||||||
@@ -202,6 +202,18 @@ Item {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sway/scroll fold `<num>:<name>` into the name field (num 1 → name "1:test"); drop the redundant prefix so the index option controls it
|
||||||
|
function stripSwayWorkspaceNumber(num, name) {
|
||||||
|
if (num === undefined || num === -1)
|
||||||
|
return name;
|
||||||
|
if (typeof name !== "string")
|
||||||
|
return name;
|
||||||
|
const prefix = num + ":";
|
||||||
|
if (!name.startsWith(prefix))
|
||||||
|
return name;
|
||||||
|
return name.slice(prefix.length);
|
||||||
|
}
|
||||||
|
|
||||||
// Numbered workspaces first in ascending order; purely-named workspaces (sway reports num -1) after, by name
|
// Numbered workspaces first in ascending order; purely-named workspaces (sway reports num -1) after, by name
|
||||||
function swayWorkspaceOrder(a, b) {
|
function swayWorkspaceOrder(a, b) {
|
||||||
const keyA = a.num === -1 ? Number.MAX_SAFE_INTEGER : a.num;
|
const keyA = a.num === -1 ? Number.MAX_SAFE_INTEGER : a.num;
|
||||||
|
|||||||
Reference in New Issue
Block a user