1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-30 09:32:05 -04:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Lucas
6b15670918 nix: update quickshell version (#2263)
Updated the quickshell revision to 783c95, matching the "stable" package in other DMS distributions.
2026-04-24 17:17:36 -04:00
Walid Salah
c52b9e19a1 Fix focused app when switching to empty workspace (#2259)
* Fix multiple screens on niri, when switching to an empty wokspace the other screen focused app widget would get confused

* Blank workspace fix
2026-04-24 17:17:36 -04:00
4 changed files with 54 additions and 27 deletions

10
flake.lock generated
View File

@@ -23,16 +23,16 @@
]
},
"locked": {
"lastModified": 1766725085,
"narHash": "sha256-O2aMFdDUYJazFrlwL7aSIHbUSEm3ADVZjmf41uBJfHs=",
"lastModified": 1776854048,
"narHash": "sha256-lLbV66V3RMNp1l8/UelmR4YzoJ5ONtgvEtiUMJATH/o=",
"ref": "refs/heads/master",
"rev": "41828c4180fb921df7992a5405f5ff05d2ac2fff",
"revCount": 715,
"rev": "783c953987dc56ff0601abe6845ed96f1d00495a",
"revCount": 806,
"type": "git",
"url": "https://git.outfoxxed.me/quickshell/quickshell"
},
"original": {
"rev": "41828c4180fb921df7992a5405f5ff05d2ac2fff",
"rev": "783c953987dc56ff0601abe6845ed96f1d00495a",
"type": "git",
"url": "https://git.outfoxxed.me/quickshell/quickshell"
}

View File

@@ -4,7 +4,7 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
quickshell = {
url = "git+https://git.outfoxxed.me/quickshell/quickshell?rev=41828c4180fb921df7992a5405f5ff05d2ac2fff";
url = "git+https://git.outfoxxed.me/quickshell/quickshell?rev=783c953987dc56ff0601abe6845ed96f1d00495a";
inputs.nixpkgs.follows = "nixpkgs";
};
};

View File

@@ -42,19 +42,26 @@ BasePill {
const active = ToplevelManager.activeToplevel;
if (!active) {
// Only clear if our tracked window is no longer alive
if (activeWindow) {
const alive = ToplevelManager.toplevels?.values;
if (alive && !Array.from(alive).some(t => t === activeWindow))
activeWindow = null;
if (CompositorService.isNiri) {
if (NiriService.currentOutput === (parentScreen?.name ?? ""))
activeWindow = null;
} else {
const alive = ToplevelManager.toplevels?.values;
if (alive && !Array.from(alive).some(t => t === activeWindow))
activeWindow = null;
}
}
return;
}
if (!parentScreen || CompositorService.filterCurrentDisplay([active], parentScreen?.name)?.length > 0) {
activeWindow = active;
} else if (activeWindow) {
const alive = ToplevelManager.toplevels?.values;
if (alive && !Array.from(alive).some(t => t === activeWindow))
activeWindow = null;
}
// else: active window is on a different screen so keep the previous value
}
Component.onCompleted: {
@@ -65,7 +72,8 @@ BasePill {
Connections {
target: ToplevelManager
function onActiveToplevelChanged() {
root.updateActiveWindow();
if (!CompositorService.isNiri)
root.updateActiveWindow();
}
}
@@ -76,6 +84,16 @@ BasePill {
}
}
Connections {
target: CompositorService.isNiri ? NiriService : null
function onWindowsChanged() {
root.updateActiveWindow();
}
function onCurrentOutputChanged() {
root.updateActiveWindow();
}
}
Connections {
target: DesktopEntries
function onApplicationsChanged() {
@@ -107,21 +125,17 @@ BasePill {
}
readonly property bool hasWindowsOnCurrentWorkspace: {
if (CompositorService.isNiri) {
let currentWorkspaceId = null;
for (var i = 0; i < NiriService.allWorkspaces.length; i++) {
const ws = NiriService.allWorkspaces[i];
if (ws.is_focused) {
currentWorkspaceId = ws.id;
break;
}
}
if (!currentWorkspaceId) {
if (!activeWindow || !(activeWindow.title || activeWindow.appId))
return false;
}
const workspaceWindows = NiriService.windows.filter(w => w.workspace_id === currentWorkspaceId);
return workspaceWindows.length > 0 && activeWindow && (activeWindow.title || activeWindow.appId);
if (NiriService.currentOutput !== (parentScreen?.name ?? ""))
return true;
const focusedWin = NiriService.windows.find(w => w.is_focused);
if (!focusedWin)
return false;
const screenWsIds = new Set(
NiriService.allWorkspaces.filter(ws => ws.output === parentScreen.name).map(ws => ws.id)
);
return screenWsIds.has(focusedWin.workspace_id);
}
if (CompositorService.isHyprland) {

View File

@@ -371,8 +371,21 @@ Singleton {
function filterCurrentDisplay(toplevels, screenName) {
if (!toplevels || toplevels.length === 0 || !screenName)
return toplevels;
if (useNiriSorting)
if (useNiriSorting) {
const active = ToplevelManager.activeToplevel;
if (active && toplevels.length === 1 && toplevels[0] === active) {
if (NiriService.currentOutput !== screenName)
return [];
const focusedWin = NiriService.windows.find(nw => nw.is_focused);
if (!focusedWin)
return [];
const screenWsIds = new Set(
NiriService.allWorkspaces.filter(ws => ws.output === screenName).map(ws => ws.id)
);
return screenWsIds.has(focusedWin.workspace_id) ? toplevels : [];
}
return NiriService.filterCurrentDisplay(toplevels, screenName);
}
if (isHyprland)
return filterHyprlandCurrentDisplaySafe(toplevels, screenName);
return toplevels;