diff --git a/Modules/Bar/Bar.qml b/Modules/Bar/Bar.qml index bce4975..8a2c3f6 100644 --- a/Modules/Bar/Bar.qml +++ b/Modules/Bar/Bar.qml @@ -139,7 +139,6 @@ Variants { // demoPanel.isLoaded = !demoPanel.isLoaded // } // } - NIconButton { id: sidePanelToggle icon: "widgets" diff --git a/Modules/Bar/Brightness.qml b/Modules/Bar/Brightness.qml index 882fb49..0d26dfc 100644 --- a/Modules/Bar/Brightness.qml +++ b/Modules/Bar/Brightness.qml @@ -17,7 +17,8 @@ Item { function getIcon() { var brightness = BrightnessService.getMonitorForScreen(screen).brightness - return brightness <= 0 ? "brightness_1" : brightness < 0.33 ? "brightness_low" : brightness < 0.66 ? "brightness_medium" : "brightness_high" + return brightness <= 0 ? "brightness_1" : brightness < 0.33 ? "brightness_low" : brightness + < 0.66 ? "brightness_medium" : "brightness_high" } // Connection used to open the pill when brightness changes @@ -26,7 +27,7 @@ Item { function onBrightnessUpdated() { Logger.log("Bar-Brightness", "OnBrightnessUpdated") - var monitor = BrightnessService.getMonitorForScreen(screen); + var monitor = BrightnessService.getMonitorForScreen(screen) var currentBrightness = monitor.brightness // Ignore if this is the first time or if brightness hasn't actually changed diff --git a/Modules/LockScreen/LockScreen.qml b/Modules/LockScreen/LockScreen.qml index 4e88187..6a9bcf7 100644 --- a/Modules/LockScreen/LockScreen.qml +++ b/Modules/LockScreen/LockScreen.qml @@ -95,7 +95,7 @@ WlSessionLock { // Battery indicator component Item { id: batteryIndicator - + // Import UPower for battery data property var battery: UPower.displayDevice property bool isReady: battery && battery.ready && battery.isLaptopBattery && battery.isPresent diff --git a/Modules/SettingsPanel/SettingsPanel.qml b/Modules/SettingsPanel/SettingsPanel.qml index a35bead..ad0bff6 100644 --- a/Modules/SettingsPanel/SettingsPanel.qml +++ b/Modules/SettingsPanel/SettingsPanel.qml @@ -130,7 +130,7 @@ NLoader { "label": "Audio", "icon": "volume_up", "source": audioTab - },{ + }, { "id": SettingsPanel.Tab.Display, "label": "Display", "icon": "monitor", @@ -145,7 +145,7 @@ NLoader { "label": "Brightness", "icon": "brightness_6", "source": brightnessTab - }, { + }, { "id": SettingsPanel.Tab.TimeWeather, "label": "Time & Weather", "icon": "schedule", diff --git a/Modules/SettingsPanel/Tabs/BrightnessTab.qml b/Modules/SettingsPanel/Tabs/BrightnessTab.qml index 4f9f7df..142ef6e 100644 --- a/Modules/SettingsPanel/Tabs/BrightnessTab.qml +++ b/Modules/SettingsPanel/Tabs/BrightnessTab.qml @@ -143,102 +143,76 @@ Item { } // Single monitor display using the same data source as the bar icon - Rectangle { - Layout.fillWidth: true - radius: Style.radiusMedium * scaling - color: Color.mSurface - border.color: Color.mOutline - border.width: Math.max(1, Style.borderThin * scaling) - implicitHeight: contentCol.implicitHeight + Style.marginXL * 2 * scaling + Repeater { + model: BrightnessService.monitors + Rectangle { + Layout.fillWidth: true + radius: Style.radiusMedium * scaling + color: Color.mSurface + border.color: Color.mOutline + border.width: Math.max(1, Style.borderThin * scaling) + implicitHeight: contentCol.implicitHeight + Style.marginXL * 2 * scaling - ColumnLayout { - id: contentCol - anchors.fill: parent - anchors.margins: Style.marginLarge * scaling - spacing: Style.marginMedium * scaling - - RowLayout { - Layout.fillWidth: true + ColumnLayout { + id: contentCol + anchors.fill: parent + anchors.margins: Style.marginLarge * scaling spacing: Style.marginMedium * scaling - NText { - text: "Primary Monitor" - font.pointSize: Style.fontSizeLarge * scaling - font.weight: Style.fontWeightBold - color: Color.mSecondary - } - - Item { + RowLayout { Layout.fillWidth: true - } + spacing: Style.marginMedium * scaling - NText { - text: BrightnessService.currentMethod === "ddcutil" ? "External (DDC)" : "Internal" - font.pointSize: Style.fontSizeSmall * scaling - color: Color.mOnSurfaceVariant - Layout.alignment: Qt.AlignRight - } - } + NText { + text: `${model.modelData.name} [${model.modelData.model}]` + font.pointSize: Style.fontSizeLarge * scaling + font.weight: Style.fontWeightBold + color: Color.mSecondary + } - RowLayout { - Layout.fillWidth: true - spacing: Style.marginMedium * scaling + Item { + Layout.fillWidth: true + } - NText { - text: "Brightness:" - font.pointSize: Style.fontSizeMedium * scaling - color: Color.mOnSurface - } - - NSlider { - Layout.fillWidth: true - from: 0 - to: 100 - value: BrightnessService.brightness - stepSize: 1 - enabled: BrightnessService.available - onPressedChanged: { - if (!pressed && BrightnessService.available) { - BrightnessService.setBrightness(value) - } + NText { + text: model.method + font.pointSize: Style.fontSizeSmall * scaling + color: Color.mOnSurfaceVariant + Layout.alignment: Qt.AlignRight } } - NText { - text: BrightnessService.available ? Math.round(BrightnessService.brightness) + "%" : "N/A" - font.pointSize: Style.fontSizeMedium * scaling - font.weight: Style.fontWeightBold - color: BrightnessService.available ? Color.mPrimary : Color.mOnSurfaceVariant - Layout.alignment: Qt.AlignRight - } - } - - RowLayout { - Layout.fillWidth: true - spacing: Style.marginMedium * scaling - - NText { - text: "Method:" - font.pointSize: Style.fontSizeSmall * scaling - color: Color.mOnSurfaceVariant - } - - NText { - text: BrightnessService.currentMethod || "Unknown" - font.pointSize: Style.fontSizeSmall * scaling - color: Color.mOnSurface - Layout.alignment: Qt.AlignLeft - } - - Item { + RowLayout { Layout.fillWidth: true - } + spacing: Style.marginMedium * scaling - NText { - text: BrightnessService.available ? "Available" : "Unavailable" - font.pointSize: Style.fontSizeSmall * scaling - color: BrightnessService.available ? Color.mPrimary : Color.mError - Layout.alignment: Qt.AlignRight + NText { + text: "Brightness:" + font.pointSize: Style.fontSizeMedium * scaling + color: Color.mOnSurface + } + + NSlider { + Layout.fillWidth: true + from: 0 + to: 1 + value: model.brightness + stepSize: 0.05 + onPressedChanged: { + if (!pressed) { + var monitor = BrightnessService.getMonitorForScreen(model.modelData) + monitor.setBrightness(value) + } + } + } + + NText { + text: Math.round(model.brightness * 100) + "%" + font.pointSize: Style.fontSizeMedium * scaling + font.weight: Style.fontWeightBold + color: Color.mPrimary + Layout.alignment: Qt.AlignRight + } } } } diff --git a/Modules/SidePanel/PowerMenu.qml b/Modules/SidePanel/PowerMenu.qml index 35c5c1b..5a8d7e8 100644 --- a/Modules/SidePanel/PowerMenu.qml +++ b/Modules/SidePanel/PowerMenu.qml @@ -384,8 +384,6 @@ NPanel { running: false } - - Process { id: logoutProcess diff --git a/Services/BrightnessService.qml b/Services/BrightnessService.qml index d0fffb1..f75404e 100644 --- a/Services/BrightnessService.qml +++ b/Services/BrightnessService.qml @@ -66,7 +66,6 @@ Singleton { root.ddcMonitors = displays.map(d => { var modelMatch = d.match(/Monitor:.*:(.*):.*/) var busMatch = d.match(/I2C bus:[ ]*\/dev\/i2c-([0-9]+)/) - console.log(modelMatch) return { "model": modelMatch ? modelMatch[1] : "", "busNum": busMatch ? busMatch[1] : "" @@ -96,7 +95,7 @@ Singleton { readonly property Process initProc: Process { stdout: StdioCollector { onStreamFinished: { - var dataText = text.trim(); + var dataText = text.trim() if (dataText === "") { return } diff --git a/Services/CompositorService.qml b/Services/CompositorService.qml index c74457b..745ed23 100644 --- a/Services/CompositorService.qml +++ b/Services/CompositorService.qml @@ -16,20 +16,20 @@ Singleton { property string compositorType: "unknown" // "hyprland", "niri", or "unknown" property bool isHyprland: false property bool isNiri: false - + // Generic workspace and window data property ListModel workspaces: ListModel {} property var windows: [] property int focusedWindowIndex: -1 property string focusedWindowTitle: "(No active window)" property bool inOverview: false - + // Generic events - signal workspaceChanged() - signal activeWindowChanged() - signal overviewStateChanged() - signal windowListChanged() - + signal workspaceChanged + signal activeWindowChanged + signal overviewStateChanged + signal windowListChanged + // Compositor detection Component.onCompleted: { detectCompositor() @@ -54,8 +54,6 @@ Singleton { } } - - function detectCompositor() { try { // Try Hyprland first @@ -67,6 +65,7 @@ Singleton { return } } catch (e) { + // Hyprland not available } @@ -98,13 +97,13 @@ Singleton { } } - function setupHyprlandConnections() { - // Connections are set up at the top level, this function just marks that Hyprland is ready + function setupHyprlandConnections() {// Connections are set up at the top level, this function just marks that Hyprland is ready } function updateHyprlandWorkspaces() { - if (!isHyprland) return - + if (!isHyprland) + return + workspaces.clear() try { const hlWorkspaces = Hyprland.workspaces.values @@ -113,14 +112,14 @@ Singleton { // Only append workspaces with id >= 1 if (ws.id >= 1) { workspaces.append({ - "id": i, - "idx": ws.id, - "name": ws.name || "", - "output": ws.monitor?.name || "", - "isActive": ws.active === true, - "isFocused": ws.focused === true, - "isUrgent": ws.urgent === true - }) + "id": i, + "idx": ws.id, + "name": ws.name || "", + "output": ws.monitor?.name || "", + "isActive": ws.active === true, + "isFocused": ws.focused === true, + "isUrgent": ws.urgent === true + }) } } } catch (e) { @@ -145,15 +144,17 @@ Singleton { } function updateNiriWorkspaces() { - if (!isNiri) return - + if (!isNiri) + return + // Get workspaces from the Niri process niriWorkspaceProcess.running = true } function updateNiriWindows() { - if (!isNiri) return - + if (!isNiri) + return + // Get windows from the Niri process niriWindowsProcess.running = true } @@ -172,23 +173,23 @@ Singleton { for (const ws of workspacesData) { workspacesList.push({ - "id": ws.id, - "idx": ws.idx, - "name": ws.name || "", - "output": ws.output || "", - "isFocused": ws.is_focused === true, - "isActive": ws.is_active === true, - "isUrgent": ws.is_urgent === true, - "isOccupied": ws.active_window_id ? true : false - }) + "id": ws.id, + "idx": ws.idx, + "name": ws.name || "", + "output": ws.output || "", + "isFocused": ws.is_focused === true, + "isActive": ws.is_active === true, + "isUrgent": ws.is_urgent === true, + "isOccupied": ws.active_window_id ? true : false + }) } workspacesList.sort((a, b) => { - if (a.output !== b.output) { - return a.output.localeCompare(b.output) - } - return a.id - b.id - }) + if (a.output !== b.output) { + return a.output.localeCompare(b.output) + } + return a.id - b.id + }) // Update the workspaces ListModel workspaces.clear() @@ -222,18 +223,18 @@ Singleton { const windowsList = [] for (const win of windowsData) { windowsList.push({ - "id": win.id, - "title": win.title || "", - "appId": win.app_id || "", - "workspaceId": win.workspace_id || null, - "isFocused": win.is_focused === true - }) + "id": win.id, + "title": win.title || "", + "appId": win.app_id || "", + "workspaceId": win.workspace_id || null, + "isFocused": win.is_focused === true + }) } windowsList.sort((a, b) => a.id - b.id) windows = windowsList windowListChanged() - + // Update focused window index for (var i = 0; i < windowsList.length; i++) { if (windowsList[i].isFocused) { @@ -292,18 +293,18 @@ Singleton { const windowsList = [] for (const win of windowsData) { windowsList.push({ - "id": win.id, - "title": win.title || "", - "appId": win.app_id || "", - "workspaceId": win.workspace_id || null, - "isFocused": win.is_focused === true - }) + "id": win.id, + "title": win.title || "", + "appId": win.app_id || "", + "workspaceId": win.workspace_id || null, + "isFocused": win.is_focused === true + }) } windowsList.sort((a, b) => a.id - b.id) windows = windowsList windowListChanged() - + // Update focused window index for (var i = 0; i < windowsList.length; i++) { if (windowsList[i].isFocused) { @@ -384,4 +385,4 @@ Singleton { } return null } -} \ No newline at end of file +} diff --git a/Services/WorkspaceService.qml b/Services/WorkspaceService.qml index f928eea..4e2d3d0 100644 --- a/Services/WorkspaceService.qml +++ b/Services/WorkspaceService.qml @@ -14,7 +14,7 @@ Singleton { property ListModel workspaces: ListModel {} property bool isHyprland: false property bool isNiri: false - + Component.onCompleted: { // Connect to CompositorService workspace changes CompositorService.workspaceChanged.connect(updateWorkspaces) diff --git a/Widgets/NPanel.qml b/Widgets/NPanel.qml index 5717964..364af00 100644 --- a/Widgets/NPanel.qml +++ b/Widgets/NPanel.qml @@ -12,7 +12,9 @@ PanelWindow { property bool showOverlay: Settings.data.general.dimDesktop property int topMargin: Style.barHeight * scaling // Show dimming if this panel is opened OR if we're in a transition (to prevent flickering) - property color overlayColor: (showOverlay && (PanelService.openedPanel === root || isTransitioning)) ? Color.applyOpacity(Color.mShadow, "AA") : Color.transparent + property color overlayColor: (showOverlay && (PanelService.openedPanel === root + || isTransitioning)) ? Color.applyOpacity(Color.mShadow, + "AA") : Color.transparent property bool isTransitioning: false signal dismissed