diff --git a/Modules/ArchUpdaterPanel/ArchUpdaterPanel.qml b/Modules/ArchUpdaterPanel/ArchUpdaterPanel.qml index 43203fc..9152ddd 100644 --- a/Modules/ArchUpdaterPanel/ArchUpdaterPanel.qml +++ b/Modules/ArchUpdaterPanel/ArchUpdaterPanel.qml @@ -112,7 +112,11 @@ NPanel { label: "" description: "" checked: ArchUpdaterService.isPackageSelected(modelData.name) - onToggled: ArchUpdaterService.togglePackageSelection(modelData.name) + onToggled: function (checked) { + ArchUpdaterService.togglePackageSelection(modelData.name) + // Force refresh of the checked property + checkbox.checked = ArchUpdaterService.isPackageSelected(modelData.name) + } activeColor: (modelData.source === "aur") ? Color.mSecondary : Color.mPrimary activeOnColor: (modelData.source === "aur") ? Color.mOnSecondary : Color.mOnPrimary Layout.fillWidth: false diff --git a/README.md b/README.md index 12ffa43..b7d81b2 100644 --- a/README.md +++ b/README.md @@ -27,11 +27,11 @@ Features a modern modular architecture with a status bar, notification system, c ## Preview -![Launcher](https://assets.noctalia.dev/screenshots/launcher.png) +![Launcher](https://assets.noctalia.dev/screenshots/launcher.png?v=2) -![SettingsPanel](https://assets.noctalia.dev/screenshots/settings-panel.png) +![SettingsPanel](https://assets.noctalia.dev/screenshots/settings-panel.png?v=2) -![SidePanel](https://assets.noctalia.dev/screenshots/light-mode.png) +![SidePanel](https://assets.noctalia.dev/screenshots/light-mode.png?v=2) --- diff --git a/Services/ArchUpdaterService.qml b/Services/ArchUpdaterService.qml index 84c8228..de3b3af 100644 --- a/Services/ArchUpdaterService.qml +++ b/Services/ArchUpdaterService.qml @@ -142,28 +142,40 @@ Singleton { return updateInProgress = true + // Split selected packages by source - const repoPkgs = selectedPackages.filter(pkg => { - const repoPkg = repoPackages.find(p => p.name === pkg) - return repoPkg && repoPkg.source === "repo" - }) - const aurPkgs = selectedPackages.filter(pkg => { - const aurPkg = aurPackages.find(p => p.name === pkg) - return aurPkg && aurPkg.source === "aur" - }) + const repoPkgs = [] + const aurPkgs = [] + + for (const pkgName of selectedPackages) { + const repoPkg = repoPackages.find(p => p.name === pkgName) + if (repoPkg && repoPkg.source === "repo") { + repoPkgs.push(pkgName) + } + + const aurPkg = aurPackages.find(p => p.name === pkgName) + if (aurPkg && aurPkg.source === "aur") { + aurPkgs.push(pkgName) + } + } // Update repo packages if (repoPkgs.length > 0) { const repoCommand = ["pkexec", "pacman", "-S", "--noconfirm"].concat(repoPkgs) + Logger.log("ArchUpdater", "Running repo command:", repoCommand.join(" ")) Quickshell.execDetached(repoCommand) } // Update AUR packages if (aurPkgs.length > 0) { - const aurCommand = ["sh", "-c", `command -v yay >/dev/null 2>&1 && yay -S ${aurPkgs.join( - ' ')} --noconfirm || command -v paru >/dev/null 2>&1 && paru -S ${aurPkgs.join( - ' ')} --noconfirm || true`] - Quickshell.execDetached(aurCommand) + const aurHelper = getAurHelper() + if (aurHelper) { + const aurCommand = [aurHelper, "-S", "--noconfirm"].concat(aurPkgs) + Logger.log("ArchUpdater", "Running AUR command:", aurCommand.join(" ")) + Quickshell.execDetached(aurCommand) + } else { + Logger.warn("ArchUpdater", "No AUR helper found for packages:", aurPkgs.join(", ")) + } } // Clear selection and refresh @@ -172,6 +184,22 @@ Singleton { refreshAfterUpdate() } + // Helper function to detect AUR helper + function getAurHelper() { + // Check for yay first, then paru + const yayCheck = Quickshell.exec("command -v yay", true) + if (yayCheck.exitCode === 0 && yayCheck.stdout.trim()) { + return "yay" + } + + const paruCheck = Quickshell.exec("command -v paru", true) + if (paruCheck.exitCode === 0 && paruCheck.stdout.trim()) { + return "paru" + } + + return null + } + // Package selection functions function togglePackageSelection(packageName) { const index = selectedPackages.indexOf(packageName)