mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
autoformatting
This commit is contained in:
@@ -32,7 +32,6 @@ Item {
|
|||||||
|
|
||||||
readonly property string windowTitle: CompositorService.getFocusedWindowTitle()
|
readonly property string windowTitle: CompositorService.getFocusedWindowTitle()
|
||||||
|
|
||||||
|
|
||||||
readonly property bool showIcon: (widgetSettings.showIcon !== undefined) ? widgetSettings.showIcon : widgetMetadata.showIcon
|
readonly property bool showIcon: (widgetSettings.showIcon !== undefined) ? widgetSettings.showIcon : widgetMetadata.showIcon
|
||||||
|
|
||||||
// 6% of total width
|
// 6% of total width
|
||||||
@@ -43,7 +42,7 @@ Item {
|
|||||||
readonly property bool isVertical: barPosition === "left" || barPosition === "right"
|
readonly property bool isVertical: barPosition === "left" || barPosition === "right"
|
||||||
readonly property bool compact: (Settings.data.bar.density === "compact")
|
readonly property bool compact: (Settings.data.bar.density === "compact")
|
||||||
|
|
||||||
readonly property real textSize: {
|
readonly property real textSize: {
|
||||||
var base = isVertical ? width : height
|
var base = isVertical ? width : height
|
||||||
return Math.max(1, compact ? base * 0.43 : base * 0.33)
|
return Math.max(1, compact ? base * 0.43 : base * 0.33)
|
||||||
}
|
}
|
||||||
@@ -53,8 +52,6 @@ Item {
|
|||||||
implicitHeight: (barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.barHeight * scaling)
|
implicitHeight: (barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.barHeight * scaling)
|
||||||
implicitWidth: (barPosition === "left" || barPosition === "right") ? Math.round(Style.capsuleHeight * 0.8 * scaling) : (horizontalLayout.implicitWidth + Style.marginM * 2 * scaling)
|
implicitWidth: (barPosition === "left" || barPosition === "right") ? Math.round(Style.capsuleHeight * 0.8 * scaling) : (horizontalLayout.implicitWidth + Style.marginM * 2 * scaling)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
visible: windowTitle !== ""
|
visible: windowTitle !== ""
|
||||||
|
|
||||||
function calculatedVerticalHeight() {
|
function calculatedVerticalHeight() {
|
||||||
|
|||||||
@@ -71,28 +71,29 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setupBackendConnections() {
|
function setupBackendConnections() {
|
||||||
if (!backend) return
|
if (!backend)
|
||||||
|
return
|
||||||
|
|
||||||
// Connect backend signals to facade signals
|
// Connect backend signals to facade signals
|
||||||
backend.workspaceChanged.connect(() => {
|
backend.workspaceChanged.connect(() => {
|
||||||
// Sync workspaces when they change
|
// Sync workspaces when they change
|
||||||
syncWorkspaces()
|
syncWorkspaces()
|
||||||
// Forward the signal
|
// Forward the signal
|
||||||
workspaceChanged()
|
workspaceChanged()
|
||||||
})
|
})
|
||||||
|
|
||||||
backend.activeWindowChanged.connect(activeWindowChanged)
|
backend.activeWindowChanged.connect(activeWindowChanged)
|
||||||
backend.windowListChanged.connect(() => {
|
backend.windowListChanged.connect(() => {
|
||||||
// Sync windows when they change
|
// Sync windows when they change
|
||||||
windows = backend.windows
|
windows = backend.windows
|
||||||
// Forward the signal
|
// Forward the signal
|
||||||
windowListChanged()
|
windowListChanged()
|
||||||
})
|
})
|
||||||
|
|
||||||
// Property bindings
|
// Property bindings
|
||||||
backend.focusedWindowIndexChanged.connect(() => {
|
backend.focusedWindowIndexChanged.connect(() => {
|
||||||
focusedWindowIndex = backend.focusedWindowIndex
|
focusedWindowIndex = backend.focusedWindowIndex
|
||||||
})
|
})
|
||||||
|
|
||||||
// Initial sync
|
// Initial sync
|
||||||
syncWorkspaces()
|
syncWorkspaces()
|
||||||
|
|||||||
@@ -31,15 +31,16 @@ Item {
|
|||||||
|
|
||||||
// Initialization
|
// Initialization
|
||||||
function initialize() {
|
function initialize() {
|
||||||
if (initialized) return
|
if (initialized)
|
||||||
|
return
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Hyprland.refreshWorkspaces()
|
Hyprland.refreshWorkspaces()
|
||||||
Hyprland.refreshToplevels()
|
Hyprland.refreshToplevels()
|
||||||
Qt.callLater(() => {
|
Qt.callLater(() => {
|
||||||
safeUpdateWorkspaces()
|
safeUpdateWorkspaces()
|
||||||
safeUpdateWindows()
|
safeUpdateWindows()
|
||||||
})
|
})
|
||||||
initialized = true
|
initialized = true
|
||||||
Logger.log("HyprlandService", "Initialized successfully")
|
Logger.log("HyprlandService", "Initialized successfully")
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -69,7 +70,8 @@ Item {
|
|||||||
|
|
||||||
for (var i = 0; i < hlWorkspaces.length; i++) {
|
for (var i = 0; i < hlWorkspaces.length; i++) {
|
||||||
const ws = hlWorkspaces[i]
|
const ws = hlWorkspaces[i]
|
||||||
if (!ws || ws.id < 1) continue
|
if (!ws || ws.id < 1)
|
||||||
|
continue
|
||||||
|
|
||||||
const wsData = {
|
const wsData = {
|
||||||
"id": i,
|
"id": i,
|
||||||
@@ -102,7 +104,8 @@ Item {
|
|||||||
const hlToplevels = Hyprland.toplevels.values
|
const hlToplevels = Hyprland.toplevels.values
|
||||||
for (var i = 0; i < hlToplevels.length; i++) {
|
for (var i = 0; i < hlToplevels.length; i++) {
|
||||||
const toplevel = hlToplevels[i]
|
const toplevel = hlToplevels[i]
|
||||||
if (!toplevel) continue
|
if (!toplevel)
|
||||||
|
continue
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const wsId = toplevel.workspace ? toplevel.workspace.id : null
|
const wsId = toplevel.workspace ? toplevel.workspace.id : null
|
||||||
@@ -110,10 +113,12 @@ Item {
|
|||||||
occupiedIds[wsId] = true
|
occupiedIds[wsId] = true
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
||||||
// Ignore individual toplevel errors
|
// Ignore individual toplevel errors
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
||||||
// Return empty if we can't determine occupancy
|
// Return empty if we can't determine occupancy
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +142,8 @@ Item {
|
|||||||
|
|
||||||
for (var i = 0; i < hlToplevels.length; i++) {
|
for (var i = 0; i < hlToplevels.length; i++) {
|
||||||
const toplevel = hlToplevels[i]
|
const toplevel = hlToplevels[i]
|
||||||
if (!toplevel) continue
|
if (!toplevel)
|
||||||
|
continue
|
||||||
|
|
||||||
const windowData = extractWindowData(toplevel)
|
const windowData = extractWindowData(toplevel)
|
||||||
if (windowData) {
|
if (windowData) {
|
||||||
@@ -163,12 +169,14 @@ Item {
|
|||||||
|
|
||||||
// Extract window data safely from a toplevel
|
// Extract window data safely from a toplevel
|
||||||
function extractWindowData(toplevel) {
|
function extractWindowData(toplevel) {
|
||||||
if (!toplevel) return null
|
if (!toplevel)
|
||||||
|
return null
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Safely extract properties
|
// Safely extract properties
|
||||||
const windowId = safeGetProperty(toplevel, "address", "")
|
const windowId = safeGetProperty(toplevel, "address", "")
|
||||||
if (!windowId) return null
|
if (!windowId)
|
||||||
|
return null
|
||||||
|
|
||||||
const appId = extractAppId(toplevel)
|
const appId = extractAppId(toplevel)
|
||||||
const title = safeGetProperty(toplevel, "title", "")
|
const title = safeGetProperty(toplevel, "title", "")
|
||||||
@@ -189,26 +197,30 @@ Item {
|
|||||||
|
|
||||||
// Extract app ID from various possible sources
|
// Extract app ID from various possible sources
|
||||||
function extractAppId(toplevel) {
|
function extractAppId(toplevel) {
|
||||||
if (!toplevel) return ""
|
if (!toplevel)
|
||||||
|
return ""
|
||||||
|
|
||||||
// Try direct properties
|
// Try direct properties
|
||||||
var appId = safeGetProperty(toplevel, "class", "")
|
var appId = safeGetProperty(toplevel, "class", "")
|
||||||
if (appId) return appId
|
if (appId)
|
||||||
|
return appId
|
||||||
|
|
||||||
appId = safeGetProperty(toplevel, "initialClass", "")
|
appId = safeGetProperty(toplevel, "initialClass", "")
|
||||||
if (appId) return appId
|
if (appId)
|
||||||
|
return appId
|
||||||
|
|
||||||
appId = safeGetProperty(toplevel, "appId", "")
|
appId = safeGetProperty(toplevel, "appId", "")
|
||||||
if (appId) return appId
|
if (appId)
|
||||||
|
return appId
|
||||||
|
|
||||||
// Try lastIpcObject
|
// Try lastIpcObject
|
||||||
try {
|
try {
|
||||||
const ipcData = toplevel.lastIpcObject
|
const ipcData = toplevel.lastIpcObject
|
||||||
if (ipcData) {
|
if (ipcData) {
|
||||||
return String(ipcData.class || ipcData.initialClass ||
|
return String(ipcData.class || ipcData.initialClass || ipcData.appId || ipcData.wm_class || "")
|
||||||
ipcData.appId || ipcData.wm_class || "")
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
||||||
// Ignore IPC errors
|
// Ignore IPC errors
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,6 +235,7 @@ Item {
|
|||||||
return String(value)
|
return String(value)
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
||||||
// Property access failed
|
// Property access failed
|
||||||
}
|
}
|
||||||
return defaultValue
|
return defaultValue
|
||||||
|
|||||||
+46
-51
@@ -48,24 +48,24 @@ Item {
|
|||||||
|
|
||||||
for (const ws of workspacesData) {
|
for (const ws of workspacesData) {
|
||||||
workspacesList.push({
|
workspacesList.push({
|
||||||
"id": ws.id,
|
"id": ws.id,
|
||||||
"idx": ws.idx,
|
"idx": ws.idx,
|
||||||
"name": ws.name || "",
|
"name": ws.name || "",
|
||||||
"output": ws.output || "",
|
"output": ws.output || "",
|
||||||
"isFocused": ws.is_focused === true,
|
"isFocused": ws.is_focused === true,
|
||||||
"isActive": ws.is_active === true,
|
"isActive": ws.is_active === true,
|
||||||
"isUrgent": ws.is_urgent === true,
|
"isUrgent": ws.is_urgent === true,
|
||||||
"isOccupied": ws.active_window_id ? true : false
|
"isOccupied": ws.active_window_id ? true : false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort workspaces by output, then by index
|
// Sort workspaces by output, then by index
|
||||||
workspacesList.sort((a, b) => {
|
workspacesList.sort((a, b) => {
|
||||||
if (a.output !== b.output) {
|
if (a.output !== b.output) {
|
||||||
return a.output.localeCompare(b.output)
|
return a.output.localeCompare(b.output)
|
||||||
}
|
}
|
||||||
return a.idx - b.idx
|
return a.idx - b.idx
|
||||||
})
|
})
|
||||||
|
|
||||||
// Update the workspaces ListModel
|
// Update the workspaces ListModel
|
||||||
workspaces.clear()
|
workspaces.clear()
|
||||||
@@ -95,12 +95,12 @@ Item {
|
|||||||
|
|
||||||
for (const win of windowsData) {
|
for (const win of windowsData) {
|
||||||
windowsList.push({
|
windowsList.push({
|
||||||
"id": win.id,
|
"id": win.id,
|
||||||
"title": win.title || "",
|
"title": win.title || "",
|
||||||
"appId": win.app_id || "",
|
"appId": win.app_id || "",
|
||||||
"workspaceId": win.workspace_id || null,
|
"workspaceId": win.workspace_id || null,
|
||||||
"isFocused": win.is_focused === true
|
"isFocused": win.is_focused === true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
windowsList.sort((a, b) => a.id - b.id)
|
windowsList.sort((a, b) => a.id - b.id)
|
||||||
@@ -132,32 +132,27 @@ Item {
|
|||||||
|
|
||||||
stdout: SplitParser {
|
stdout: SplitParser {
|
||||||
onRead: data => {
|
onRead: data => {
|
||||||
try {
|
try {
|
||||||
const event = JSON.parse(data.trim())
|
const event = JSON.parse(data.trim())
|
||||||
|
|
||||||
if (event.WorkspacesChanged) {
|
if (event.WorkspacesChanged) {
|
||||||
updateWorkspaces()
|
updateWorkspaces()
|
||||||
}
|
} else if (event.WindowOpenedOrChanged) {
|
||||||
else if (event.WindowOpenedOrChanged) {
|
handleWindowOpenedOrChanged(event.WindowOpenedOrChanged)
|
||||||
handleWindowOpenedOrChanged(event.WindowOpenedOrChanged)
|
} else if (event.WindowClosed) {
|
||||||
}
|
handleWindowClosed(event.WindowClosed)
|
||||||
else if (event.WindowClosed) {
|
} else if (event.WindowsChanged) {
|
||||||
handleWindowClosed(event.WindowClosed)
|
handleWindowsChanged(event.WindowsChanged)
|
||||||
}
|
} else if (event.WorkspaceActivated) {
|
||||||
else if (event.WindowsChanged) {
|
updateWorkspaces()
|
||||||
handleWindowsChanged(event.WindowsChanged)
|
} else if (event.WindowFocusChanged) {
|
||||||
}
|
handleWindowFocusChanged(event.WindowFocusChanged)
|
||||||
else if (event.WorkspaceActivated) {
|
}
|
||||||
updateWorkspaces()
|
// Removed OverviewOpenedOrClosed handling
|
||||||
}
|
} catch (e) {
|
||||||
else if (event.WindowFocusChanged) {
|
Logger.error("NiriService", "Error parsing event stream:", e, data)
|
||||||
handleWindowFocusChanged(event.WindowFocusChanged)
|
}
|
||||||
}
|
}
|
||||||
// Removed OverviewOpenedOrClosed handling
|
|
||||||
} catch (e) {
|
|
||||||
Logger.error("NiriService", "Error parsing event stream:", e, data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,12 +227,12 @@ Item {
|
|||||||
|
|
||||||
for (const win of windowsData) {
|
for (const win of windowsData) {
|
||||||
windowsList.push({
|
windowsList.push({
|
||||||
"id": win.id,
|
"id": win.id,
|
||||||
"title": win.title || "",
|
"title": win.title || "",
|
||||||
"appId": win.app_id || "",
|
"appId": win.app_id || "",
|
||||||
"workspaceId": win.workspace_id || null,
|
"workspaceId": win.workspace_id || null,
|
||||||
"isFocused": win.is_focused === true
|
"isFocused": win.is_focused === true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
windowsList.sort((a, b) => a.id - b.id)
|
windowsList.sort((a, b) => a.id - b.id)
|
||||||
|
|||||||
Reference in New Issue
Block a user