1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-05-02 02:22:06 -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": { "locked": {
"lastModified": 1766725085, "lastModified": 1776854048,
"narHash": "sha256-O2aMFdDUYJazFrlwL7aSIHbUSEm3ADVZjmf41uBJfHs=", "narHash": "sha256-lLbV66V3RMNp1l8/UelmR4YzoJ5ONtgvEtiUMJATH/o=",
"ref": "refs/heads/master", "ref": "refs/heads/master",
"rev": "41828c4180fb921df7992a5405f5ff05d2ac2fff", "rev": "783c953987dc56ff0601abe6845ed96f1d00495a",
"revCount": 715, "revCount": 806,
"type": "git", "type": "git",
"url": "https://git.outfoxxed.me/quickshell/quickshell" "url": "https://git.outfoxxed.me/quickshell/quickshell"
}, },
"original": { "original": {
"rev": "41828c4180fb921df7992a5405f5ff05d2ac2fff", "rev": "783c953987dc56ff0601abe6845ed96f1d00495a",
"type": "git", "type": "git",
"url": "https://git.outfoxxed.me/quickshell/quickshell" "url": "https://git.outfoxxed.me/quickshell/quickshell"
} }

View File

@@ -4,7 +4,7 @@
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
quickshell = { 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"; inputs.nixpkgs.follows = "nixpkgs";
}; };
}; };

View File

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

View File

@@ -371,8 +371,21 @@ Singleton {
function filterCurrentDisplay(toplevels, screenName) { function filterCurrentDisplay(toplevels, screenName) {
if (!toplevels || toplevels.length === 0 || !screenName) if (!toplevels || toplevels.length === 0 || !screenName)
return toplevels; 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); return NiriService.filterCurrentDisplay(toplevels, screenName);
}
if (isHyprland) if (isHyprland)
return filterHyprlandCurrentDisplaySafe(toplevels, screenName); return filterHyprlandCurrentDisplaySafe(toplevels, screenName);
return toplevels; return toplevels;