mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-03 20:32:07 -04:00
Merge branch 'master' of github.com:bbedward/DankMaterialShell
This commit is contained in:
@@ -277,7 +277,11 @@ Item {
|
|||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
implicitSize: 40
|
implicitSize: 40
|
||||||
source: Quickshell.iconPath(DesktopEntries.byId(Paths.moddedAppId(appData.appId)).icon, true)
|
source: {
|
||||||
|
if (appData.appId === "__SEPARATOR__") return ""
|
||||||
|
var desktopEntry = DesktopEntries.byId(Paths.moddedAppId(appData.appId))
|
||||||
|
return desktopEntry && desktopEntry.icon ? Quickshell.iconPath(desktopEntry.icon, true) : ""
|
||||||
|
}
|
||||||
mipmap: true
|
mipmap: true
|
||||||
smooth: true
|
smooth: true
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
|
|||||||
@@ -95,12 +95,13 @@ Item {
|
|||||||
title = title.substring(0, 47) + "..."
|
title = title.substring(0, 47) + "..."
|
||||||
}
|
}
|
||||||
var uniqueId = toplevel.title + "|" + (toplevel.appId || "") + "|" + index
|
var uniqueId = toplevel.title + "|" + (toplevel.appId || "") + "|" + index
|
||||||
|
|
||||||
items.push({
|
items.push({
|
||||||
"type": "window",
|
"type": "window",
|
||||||
"appId": toplevel.appId || "",
|
"appId": toplevel.appId,
|
||||||
"windowId": index,
|
"windowId": index,
|
||||||
"windowTitle": title,
|
"windowTitle": title,
|
||||||
"workspaceId": -1, // Will be handled by sorting
|
"workspaceId": -1,
|
||||||
"isPinned": false,
|
"isPinned": false,
|
||||||
"isRunning": true,
|
"isRunning": true,
|
||||||
"uniqueId": uniqueId
|
"uniqueId": uniqueId
|
||||||
|
|||||||
@@ -252,8 +252,14 @@ Rectangle {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: {
|
text: {
|
||||||
if (CompositorService.isHyprland) {
|
if (CompositorService.isHyprland) {
|
||||||
|
if (modelData && modelData.id === -1) {
|
||||||
|
return index + 1
|
||||||
|
}
|
||||||
return modelData && modelData.id ? modelData.id : ""
|
return modelData && modelData.id ? modelData.id : ""
|
||||||
}
|
}
|
||||||
|
if (modelData === -1) {
|
||||||
|
return index + 1
|
||||||
|
}
|
||||||
return modelData - 1
|
return modelData - 1
|
||||||
}
|
}
|
||||||
color: isActive ? Qt.rgba(
|
color: isActive ? Qt.rgba(
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ Singleton {
|
|||||||
// Compositor detection
|
// Compositor detection
|
||||||
property bool isHyprland: false
|
property bool isHyprland: false
|
||||||
property bool isNiri: false
|
property bool isNiri: false
|
||||||
|
property bool uwsmActive: false
|
||||||
property string compositor: "unknown"
|
property string compositor: "unknown"
|
||||||
|
|
||||||
readonly property string hyprlandSignature: Quickshell.env("HYPRLAND_INSTANCE_SIGNATURE")
|
readonly property string hyprlandSignature: Quickshell.env("HYPRLAND_INSTANCE_SIGNATURE")
|
||||||
@@ -21,7 +22,6 @@ Singleton {
|
|||||||
property bool useNiriSorting: isNiri && NiriService
|
property bool useNiriSorting: isNiri && NiriService
|
||||||
property bool useHyprlandSorting: false
|
property bool useHyprlandSorting: false
|
||||||
|
|
||||||
// Unified sorted toplevels - automatically chooses sorting based on compositor
|
|
||||||
property var sortedToplevels: {
|
property var sortedToplevels: {
|
||||||
if (!ToplevelManager.toplevels || !ToplevelManager.toplevels.values) {
|
if (!ToplevelManager.toplevels || !ToplevelManager.toplevels.values) {
|
||||||
return []
|
return []
|
||||||
@@ -48,13 +48,26 @@ Singleton {
|
|||||||
if (workspaceCompare !== 0) return workspaceCompare
|
if (workspaceCompare !== 0) return workspaceCompare
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then by position on workspace (x first for columns, then y within column)
|
|
||||||
if (a.lastIpcObject && b.lastIpcObject && a.lastIpcObject.at && b.lastIpcObject.at) {
|
if (a.lastIpcObject && b.lastIpcObject && a.lastIpcObject.at && b.lastIpcObject.at) {
|
||||||
const xCompare = a.lastIpcObject.at[0] - b.lastIpcObject.at[0]
|
const aX = a.lastIpcObject.at[0]
|
||||||
if (xCompare !== 0) return xCompare
|
const bX = b.lastIpcObject.at[0]
|
||||||
return a.lastIpcObject.at[1] - b.lastIpcObject.at[1]
|
const aY = a.lastIpcObject.at[1]
|
||||||
|
const bY = b.lastIpcObject.at[1]
|
||||||
|
|
||||||
|
const xCompare = aX - bX
|
||||||
|
if (Math.abs(xCompare) > 10) return xCompare
|
||||||
|
return aY - bY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (a.lastIpcObject && !b.lastIpcObject) return -1
|
||||||
|
if (!a.lastIpcObject && b.lastIpcObject) return 1
|
||||||
|
|
||||||
|
if (a.title && b.title) {
|
||||||
|
return a.title.localeCompare(b.title)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -68,6 +81,7 @@ Singleton {
|
|||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
detectCompositor()
|
detectCompositor()
|
||||||
|
uwsmCheck.running = true
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterCurrentWorkspace(toplevels, screen){
|
function filterCurrentWorkspace(toplevels, screen){
|
||||||
@@ -90,14 +104,31 @@ Singleton {
|
|||||||
|
|
||||||
for (var i = 0; i < hyprlandToplevels.length; i++) {
|
for (var i = 0; i < hyprlandToplevels.length; i++) {
|
||||||
var hyprToplevel = hyprlandToplevels[i]
|
var hyprToplevel = hyprlandToplevels[i]
|
||||||
if (hyprToplevel.activated && hyprToplevel.monitor && hyprToplevel.monitor.name === screenName) {
|
if (hyprToplevel.monitor && hyprToplevel.monitor.name === screenName && hyprToplevel.workspace) {
|
||||||
currentWorkspaceId = hyprToplevel.workspace ? hyprToplevel.workspace.id : null
|
if (hyprToplevel.activated) {
|
||||||
break
|
currentWorkspaceId = hyprToplevel.workspace.id
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if (currentWorkspaceId === null) {
|
||||||
|
currentWorkspaceId = hyprToplevel.workspace.id
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentWorkspaceId === null && Hyprland.focusedWorkspace) {
|
if (currentWorkspaceId === null && Hyprland.workspaces) {
|
||||||
currentWorkspaceId = Hyprland.focusedWorkspace.id
|
const workspaces = Array.from(Hyprland.workspaces.values)
|
||||||
|
for (var k = 0; k < workspaces.length; k++) {
|
||||||
|
var workspace = workspaces[k]
|
||||||
|
if (workspace.monitor && workspace.monitor === screenName) {
|
||||||
|
if (Hyprland.focusedWorkspace && workspace.id === Hyprland.focusedWorkspace.id) {
|
||||||
|
currentWorkspaceId = workspace.id
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if (currentWorkspaceId === null) {
|
||||||
|
currentWorkspaceId = workspace.id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentWorkspaceId === null) {
|
if (currentWorkspaceId === null) {
|
||||||
@@ -158,10 +189,27 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function logout() {
|
function logout() {
|
||||||
|
if (uwsmActive) {
|
||||||
|
Quickshell.execDetached(["uwsm", "stop"])
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (isNiri) {
|
if (isNiri) {
|
||||||
NiriService.quit()
|
NiriService.quit()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hyprland fallback
|
||||||
Hyprland.dispatch("exit")
|
Hyprland.dispatch("exit")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: uwsmCheck
|
||||||
|
// `uwsm check is-active` returns 0 if in uwsm-managed session, 1 otherwise
|
||||||
|
command: ["uwsm", "check", "is-active"]
|
||||||
|
running: false
|
||||||
|
onExited: function(exitCode) {
|
||||||
|
uwsmActive = exitCode === 0
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user