diff --git a/Services/WorkspaceManager.qml b/Services/WorkspaceManager.qml index b5dc29c..5df82e3 100644 --- a/Services/WorkspaceManager.qml +++ b/Services/WorkspaceManager.qml @@ -50,10 +50,11 @@ Singleton { // Initialize Hyprland integration function initHyprland() { - try { + try { + // Fixes the odd workspace issue. Hyprland.refreshWorkspaces(); - hlWorkspaces = Hyprland.workspaces.values; - updateHyprlandWorkspaces(); + // hlWorkspaces = Hyprland.workspaces.values; + // updateHyprlandWorkspaces(); return true; } catch (e) { console.error("Error initializing Hyprland:", e); @@ -149,4 +150,4 @@ Singleton { console.warn("No supported compositor detected for workspace switching"); } } -} +} \ No newline at end of file diff --git a/Widgets/Background.qml b/Widgets/Background.qml index ee042d0..b8eb602 100644 --- a/Widgets/Background.qml +++ b/Widgets/Background.qml @@ -6,28 +6,38 @@ import qs.Settings ShellRoot { property string wallpaperSource: WallpaperManager.currentWallpaper !== "" && !Settings.settings.useSWWW ? WallpaperManager.currentWallpaper : "" - PanelWindow { - visible: wallpaperSource !== "" - anchors { - bottom: true - top: true - right: true - left: true - } - margins { - top: 0 - } - color: "transparent" - WlrLayershell.layer: WlrLayer.Background - WlrLayershell.exclusionMode: ExclusionMode.Ignore - WlrLayershell.namespace: "quickshell-wallpaper" - Image { - anchors.fill: parent - fillMode: Image.PreserveAspectCrop - source: wallpaperSource + + Variants { + model: Quickshell.screens + + PanelWindow { + required property ShellScreen modelData + visible: wallpaperSource !== "" - cache: true - smooth: true + anchors { + bottom: true + top: true + right: true + left: true + } + margins { + top: 0 + } + color: "transparent" + screen: modelData + WlrLayershell.layer: WlrLayer.Background + WlrLayershell.exclusionMode: ExclusionMode.Ignore + WlrLayershell.namespace: "quickshell-wallpaper" + Image { + anchors.fill: parent + fillMode: Image.PreserveAspectCrop + source: wallpaperSource + visible: wallpaperSource !== "" + cache: true + smooth: true + } } } + + } \ No newline at end of file diff --git a/Widgets/LockScreen.qml b/Widgets/LockScreen.qml index 49b3247..29f20fc 100644 --- a/Widgets/LockScreen.qml +++ b/Widgets/LockScreen.qml @@ -141,9 +141,16 @@ WlSessionLock { FastBlur { anchors.fill: parent source: lockBgImage - radius: 48 // Adjust blur strength as needed + radius: 22 // Adjust blur strength as needed transparentBorder: true } + Rectangle { + anchors.fill: parent + color: Qt.rgba( + Theme.backgroundPrimary.r, + Theme.backgroundPrimary.g, + Theme.backgroundPrimary.b, 0.6) + } // Main content container (moved up, Rectangle removed) ColumnLayout { anchors.centerIn: parent diff --git a/Widgets/Overview.qml b/Widgets/Overview.qml index 2404854..2e63c6c 100644 --- a/Widgets/Overview.qml +++ b/Widgets/Overview.qml @@ -7,33 +7,48 @@ import qs.Settings ShellRoot { property string wallpaperSource: WallpaperManager.currentWallpaper !== "" && !Settings.settings.useSWWW ? WallpaperManager.currentWallpaper : "" - PanelWindow { - visible: wallpaperSource !== "" - anchors { - top: true - bottom: true - right: true - left: true - } - color: "transparent" - WlrLayershell.layer: WlrLayer.Background - WlrLayershell.exclusionMode: ExclusionMode.Ignore - WlrLayershell.namespace: "quickshell-overview" - Image { - id: bgImage - anchors.fill: parent - fillMode: Image.PreserveAspectCrop - source: wallpaperSource - cache: true - smooth: true - visible: wallpaperSource !== "" // Show the original for FastBlur input - } - FastBlur { - anchors.fill: parent + + Variants { + model: Quickshell.screens + + PanelWindow { + required property ShellScreen modelData + visible: wallpaperSource !== "" - source: bgImage - radius: 24 // Adjust blur strength as needed - transparentBorder: true + anchors { + top: true + bottom: true + right: true + left: true + } + color: "transparent" + screen: modelData + WlrLayershell.layer: WlrLayer.Background + WlrLayershell.exclusionMode: ExclusionMode.Ignore + WlrLayershell.namespace: "quickshell-overview" + Image { + id: bgImage + anchors.fill: parent + fillMode: Image.PreserveAspectCrop + source: wallpaperSource + cache: true + smooth: true + visible: wallpaperSource !== "" // Show the original for FastBlur input + } + FastBlur { + anchors.fill: parent + visible: wallpaperSource !== "" + source: bgImage + radius: 18 // Adjust blur strength as needed + transparentBorder: true + } + Rectangle { + anchors.fill: parent + color: Qt.rgba( + Theme.backgroundPrimary.r, + Theme.backgroundPrimary.g, + Theme.backgroundPrimary.b, 0.6) + } } } } \ No newline at end of file diff --git a/Widgets/Sidebar/Panel/System.qml b/Widgets/Sidebar/Panel/System.qml index c128996..fe095a6 100644 --- a/Widgets/Sidebar/Panel/System.qml +++ b/Widgets/Sidebar/Panel/System.qml @@ -214,6 +214,45 @@ Rectangle { } } + // Suspend button + Rectangle { + Layout.fillWidth: true + Layout.preferredHeight: 36 + radius: 6 + color: suspendButtonArea.containsMouse ? Theme.accentPrimary : "transparent" + + RowLayout { + anchors.fill: parent + anchors.margins: 12 + spacing: 8 + + Text { + text: "bedtime" + font.family: "Material Symbols Outlined" + font.pixelSize: 16 + color: suspendButtonArea.containsMouse ? Theme.onAccent : Theme.textPrimary + } + + Text { + text: "Suspend" + font.pixelSize: 14 + color: suspendButtonArea.containsMouse ? Theme.onAccent : Theme.textPrimary + Layout.fillWidth: true + } + } + + MouseArea { + id: suspendButtonArea + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onClicked: { + suspend(); + systemMenu.visible = false; + } + } + } + // Reboot button Rectangle { Layout.fillWidth: true @@ -366,7 +405,15 @@ Rectangle { command: ["niri", "msg", "action", "quit", "--skip-confirmation"] running: false } + Process { + id: suspendProcess + command: ["systemctl", "suspend"] + running: false + } + function suspend() { + suspendProcess.running = true; + } function shutdown() { shutdownProcess.running = true; } diff --git a/Widgets/Sidebar/Panel/WifiPanel.qml b/Widgets/Sidebar/Panel/WifiPanel.qml index 7a45f31..008a3c1 100644 --- a/Widgets/Sidebar/Panel/WifiPanel.qml +++ b/Widgets/Sidebar/Panel/WifiPanel.qml @@ -90,14 +90,12 @@ Item { property string connectSecurity: "" property var pendingConnect: null property string detectedInterface: "" - property var connectionsToDelete: [] function profileNameForSsid(ssid) { return "quickshell-" + ssid.replace(/[^a-zA-Z0-9]/g, "_"); } - function disconnectAndDeleteNetwork(ssid) { + function disconnectNetwork(ssid) { var profileName = wifiLogic.profileNameForSsid(ssid); - console.log('WifiPanel: disconnectAndDeleteNetwork called for SSID', ssid, 'profile', profileName); disconnectProfileProcess.connectionName = profileName; disconnectProfileProcess.running = true; } @@ -129,6 +127,9 @@ Item { wifiLogic.pendingConnect = null; } } + function isSecured(security) { + return security && security.trim() !== "" && security.trim() !== "--"; + } } // Disconnect, delete profile, refresh @@ -137,18 +138,6 @@ Item { property string connectionName: "" running: false command: ["nmcli", "connection", "down", "id", connectionName] - onRunningChanged: { - if (!running) { - deleteProfileProcess.connectionName = connectionName; - deleteProfileProcess.running = true; - } - } - } - Process { - id: deleteProfileProcess - property string connectionName: "" - running: false - command: ["nmcli", "connection", "delete", "id", connectionName] onRunningChanged: { if (!running) { wifiLogic.refreshNetworks(); @@ -159,24 +148,43 @@ Item { Process { id: listConnectionsProcess running: false - command: ["nmcli", "-t", "-f", "NAME,SSID", "connection", "show"] + command: ["nmcli", "-t", "-f", "NAME", "connection", "show"] stdout: StdioCollector { onStreamFinished: { var params = wifiLogic.pendingConnect; var lines = text.split("\n"); - var toDelete = []; + var expectedProfile = wifiLogic.profileNameForSsid(params.ssid); + var foundProfile = null; for (var i = 0; i < lines.length; ++i) { - var parts = lines[i].split(":"); - if (parts.length === 2 && parts[1] === params.ssid) { - toDelete.push(parts[0]); + if (lines[i] === expectedProfile) { + foundProfile = lines[i]; + break; } } - wifiLogic.connectionsToDelete = toDelete; - if (toDelete.length > 0) { - deleteProfileProcess.connectionName = toDelete[0]; - deleteProfileProcess.running = true; + if (foundProfile) { + // Profile exists, just bring it up (no password prompt) + upConnectionProcess.profileName = foundProfile; + upConnectionProcess.running = true; } else { - wifiLogic.doConnect(); + // No profile: check if secured + if (wifiLogic.isSecured(params.security)) { + if (params.password && params.password.length > 0) { + // Password provided, proceed to connect + wifiLogic.doConnect(); + } else { + // No password yet, prompt for it + wifiLogic.passwordPromptSsid = params.ssid; + wifiLogic.passwordInput = ""; + wifiLogic.showPasswordPrompt = true; + wifiLogic.connectStatus = ""; + wifiLogic.connectStatusSsid = ""; + wifiLogic.connectError = ""; + wifiLogic.connectSecurity = params.security; + } + } else { + // Open, connect directly + wifiLogic.doConnect(); + } } } } @@ -565,17 +573,9 @@ Item { hoverEnabled: true onClicked: { if (modelData.connected) { - wifiLogic.disconnectAndDeleteNetwork(modelData.ssid); - } else if (modelData.security && modelData.security !== "--") { - wifiLogic.passwordPromptSsid = modelData.ssid; - wifiLogic.passwordInput = ""; - wifiLogic.showPasswordPrompt = true; - wifiLogic.connectStatus = ""; - wifiLogic.connectStatusSsid = ""; - wifiLogic.connectError = ""; - wifiLogic.connectSecurity = modelData.security; + wifiLogic.disconnectNetwork(modelData.ssid); } else { - wifiLogic.connectNetwork(modelData.ssid, modelData.security) + wifiLogic.connectNetwork(modelData.ssid, modelData.security); } } }