mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
TaskbarGrouped: BugFix + simplifications
- fixed workspace switching, when workspace is empty. - moved some logic to the compositor service - removed unecessary Qt.createQmlObject
This commit is contained in:
@@ -35,17 +35,6 @@ Item {
|
||||
readonly property bool hideUnoccupied: (widgetSettings.hideUnoccupied !== undefined) ? widgetSettings.hideUnoccupied : false
|
||||
property ListModel localWorkspaces: ListModel {}
|
||||
|
||||
function getWindowsForWorkspace(workspaceId) {
|
||||
var windowsInWs = []
|
||||
for (var i = 0; i < CompositorService.windows.count; i++) {
|
||||
var window = CompositorService.windows.get(i)
|
||||
if (window.workspaceId === workspaceId) {
|
||||
windowsInWs.push(window)
|
||||
}
|
||||
}
|
||||
return windowsInWs
|
||||
}
|
||||
|
||||
function refreshWorkspaces() {
|
||||
localWorkspaces.clear()
|
||||
if (screen !== null) {
|
||||
@@ -56,21 +45,10 @@ Item {
|
||||
continue
|
||||
}
|
||||
|
||||
var windowsInWs = getWindowsForWorkspace(ws.id)
|
||||
var windowsModel = Qt.createQmlObject('import QtQuick 2.0; ListModel {}', root)
|
||||
for (var j = 0; j < windowsInWs.length; j++) {
|
||||
windowsModel.append(windowsInWs[j])
|
||||
}
|
||||
localWorkspaces.append({
|
||||
"id": ws.id,
|
||||
"name": ws.name,
|
||||
"output": ws.output,
|
||||
"isFocused": ws.isFocused,
|
||||
"isOccupied": ws.isOccupied,
|
||||
"isActive": ws.isActive,
|
||||
"isUrgent": ws.isUrgent,
|
||||
"windows": windowsModel
|
||||
})
|
||||
// Copy all properties from ws and add windows
|
||||
var workspaceData = Object.assign({}, ws)
|
||||
workspaceData.windows = CompositorService.getWindowsForWorkspace(ws.id)
|
||||
localWorkspaces.append(workspaceData)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -253,4 +231,4 @@ Item {
|
||||
delegate: workspaceRepeaterDelegate
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,6 +256,17 @@ Singleton {
|
||||
return ""
|
||||
}
|
||||
|
||||
function getWindowsForWorkspace(workspaceId) {
|
||||
var windowsInWs = []
|
||||
for (var i = 0; i < windows.count; i++) {
|
||||
var window = windows.get(i)
|
||||
if (window.workspaceId === workspaceId) {
|
||||
windowsInWs.push(window)
|
||||
}
|
||||
}
|
||||
return windowsInWs
|
||||
}
|
||||
|
||||
// Generic workspace switching
|
||||
function switchToWorkspace(workspace) {
|
||||
if (backend && backend.switchToWorkspace) {
|
||||
|
||||
Reference in New Issue
Block a user