Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions modules/common/Config.qml
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,16 @@ Singleton {
property string networkEthernet: "kcmshell6 kcm_networkmanagement"
property string taskManager: "plasma-systemmonitor --page-name Processes"
property string terminal: "kitty -1" // This is only for shell actions
property string update: "kitty -1 --hold=yes fish -i -c 'pkexec pacman -Syu'"
property string volumeMixer: `~/.config/hypr/hyprland/scripts/launch_first_available.sh "pavucontrol-qt" "pavucontrol"`
property string update: "kitty -1 --hold=yes bash -c "
"\n if [ \"${SystemInfo.distroId}\" = \"arch\" ] || [ \"${SystemInfo.distroId}\" = \"cachyos\" ] || [ \"${SystemInfo.distroId}\" = \"endeavouros\" ]; then
yay -Syu --combinedupgrade=false
elif command -v apt &>/dev/null && [ -f /etc/debian_version ]; then
sudo apt update && sudo apt upgrade -y
else
echo \"Unsupported distro\" && read -p \"Press Enter...\"
fi
"
property string volumeMixer: `~/.config/hypr/hyprland/scripts/launch_first_available.sh "pavucontrol-qt" "pavucontrol"`property string volumeMixer: `~/.config/hypr/hyprland/scripts/launch_first_available.sh "pavucontrol-qt" "pavucontrol"`
}

property JsonObject settings: JsonObject {
Expand Down
26 changes: 19 additions & 7 deletions modules/ii/bar/UpdatesCount.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ MouseArea {
property bool isMaterial: Config.options.bar.cornerStyle === 3
property bool borderless: Config.options.bar.borderless

implicitWidth: vertical ? Appearance.sizes.verticalBarWidth : (contentLoader.item?.implicitWidth ?? 0)
implicitWidth: vertical ? Appearance.sizes.verticalBarWidth : (contentLoader.item?.implicitWidth ?? 0)
implicitHeight: vertical ? (contentLoader.item?.implicitHeight ?? 0) : Appearance.sizes.barHeight

cursorShape: Qt.PointingHandCursor
Expand All @@ -29,7 +29,8 @@ MouseArea {
onPressed: (mouse) => {
if (mouse.button === Qt.RightButton) {
Updates.refresh()
Quickshell.execDetached(["notify-send",
Quickshell.execDetached([
"notify-send",
Translation.tr("Updates"),
Translation.tr("Checking for updates..."),
"-a", "Shell"
Expand All @@ -42,8 +43,17 @@ MouseArea {
id: updateProc
command: [
"kitty", "--hold",
"fish", "-i", "-l", "-c",
"yay -Syu --combinedupgrade=false"
"bash", "-c",
"\
if [ \"${SystemInfo.distroId}\" = \"arch\" ] || [ \"${SystemInfo.distroId}\" = \"cachyos\" ] || [ \"${SystemInfo.distroId}\" = \"endeavouros\" ]; then
yay -Syu --combinedupgrade=false
elif command -v apt &>/dev/null && [ -f /etc/debian_version ]; then
sudo apt update && sudo apt upgrade -y
else
echo \"Unsupported distro for updates\"
read -p \"Press Enter to exit...\"
fi
"
]
onExited: (exitCode, exitStatus) => {
Updates.refresh()
Expand All @@ -57,13 +67,15 @@ MouseArea {
repeat: false
onTriggered: {
if (Updates.count === 0) {
Quickshell.execDetached(["notify-send",
Quickshell.execDetached([
"notify-send",
Translation.tr("Updates"),
Translation.tr("System up to date"),
"-a", "Shell"
])
} else {
Quickshell.execDetached(["notify-send",
Quickshell.execDetached([
"notify-send",
Translation.tr("Updates"),
Translation.tr("Update cancelled — %1 updates still pending").arg(Updates.count),
"-a", "Shell", "-u", "normal"
Expand Down Expand Up @@ -186,4 +198,4 @@ MouseArea {
}
}
}
}
}
19 changes: 14 additions & 5 deletions modules/ii/settings/pages/About.qml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,17 @@ ContentPage {
function runSystemUpdate() {
Quickshell.execDetached([
"kitty", "--hold",
"fish", "-i", "-l", "-c",
"yay -Syu --combinedupgrade=false"
"bash", "-c",
"\
if [ \"${SystemInfo.distroId}\" = \"arch\" ] || [ \"${SystemInfo.distroId}\" = \"cachyos\" ] || [ \"${SystemInfo.distroId}\" = \"endeavouros\" ]; then
yay -Syu --combinedupgrade=false
elif command -v apt &>/dev/null && [ -f /etc/debian_version ]; then
sudo apt update && sudo apt upgrade -y
else
echo \"Unsupported distro for updates\"
read -p \"Press Enter to exit...\"
fi
"
])
Qt.callLater(() => GlobalStates.settingsOpen = false)
}
Expand Down Expand Up @@ -53,7 +62,7 @@ ContentPage {

Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 156
Layout.preferredHeight: 156
Layout.topMargin: !isMinimal ? 35 : 4
Layout.leftMargin: !isMinimal ? 16 : 0
Layout.rightMargin: !isMinimal ? 16 : 0
Expand Down Expand Up @@ -161,7 +170,7 @@ ContentPage {
Layout.topMargin: !isMinimal ? 0 : -8
spacing: 8

RowLayout { //This is not in the grid because I was planning to do something else.
RowLayout { // This is not in the grid because I was planning to do something else.
Layout.fillWidth: true
spacing: 8

Expand Down Expand Up @@ -241,4 +250,4 @@ ContentPage {
}
}
}
}
}
2 changes: 1 addition & 1 deletion modules/ii/settings/pages/ServicesConfig.qml
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ ContentPage {

ContentSection {
icon: "deployed_code_update"
title: Translation.tr("System updates (Arch only)")
title: Translation.tr("System updates")

GroupedList {
ConfigSwitch {
Expand Down
35 changes: 27 additions & 8 deletions scripts/colors/switchwall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,30 @@ check_and_prompt_upscale() {
if command -v upscayl &>/dev/null; then
nohup upscayl > /dev/null 2>&1 &
else
if [[ "$distro_id" == "arch" || "$distro_id" == "cachyos" || "$distro_id" == "endeavouros" ]]; then
install_cmd="yay -S upscayl-bin"
install_label="Install Upscayl (Arch)"
elif command -v apt &>/dev/null && [ -f /etc/debian_version ]; then
install_cmd="sudo apt install upscayl"
install_label="Install Upscayl (Debian/Kali)"
else
install_cmd="sudo apt install upscayl"
install_label="Install Upscayl"
fi
action2=$(notify-send \
-a "Wallpaper switcher" \
-c "im.error" \
-A "install_upscayl=Install Upscayl (Arch)" \
-A "install_upscayl=$install_label" \
"Install Upscayl?" \
"yay -S upscayl-bin")
"$install_cmd")
if [[ "$action2" == "install_upscayl" ]]; then
kitty -1 yay -S upscayl-bin
kitty -1 $install_cmd
if command -v upscayl &>/dev/null; then
nohup upscayl > /dev/null 2>&1 &
fi
fi
fi
fi
fi
fi
}

Expand Down Expand Up @@ -212,15 +221,25 @@ switch() {
fi
if [ ${#missing_deps[@]} -gt 0 ]; then
echo "Missing deps: ${missing_deps[*]}"
echo "Arch: sudo pacman -S ${missing_deps[*]}"
if [[ "$distro_id" == "arch" || "$distro_id" == "cachyos" || "$distro_id" == "endeavouros" ]]; then
install_cmd="sudo pacman -S ${missing_deps[*]}"
install_label="Install (Arch)"
elif command -v apt &>/dev/null && [ -f /etc/debian_version ]; then
install_cmd="sudo apt install ${missing_deps[*]}"
install_label="Install (Debian/Kali)"
else
install_cmd="sudo apt install ${missing_deps[*]}"
install_label="Install"
fi
echo "Install: $install_cmd"
action=$(notify-send \
-a "Wallpaper switcher" \
-c "im.error" \
-A "install_arch=Install (Arch)" \
-A "install_deps=$install_label" \
"Can't switch to video wallpaper" \
"Missing dependencies: ${missing_deps[*]}")
if [[ "$action" == "install_arch" ]]; then
kitty -1 sudo pacman -S "${missing_deps[*]}"
if [[ "$action" == "install_deps" ]]; then
kitty -1 $install_cmd
if command -v mpvpaper &>/dev/null && command -v ffmpeg &>/dev/null; then
notify-send 'Wallpaper switcher' 'Alright, try again!' -a "Wallpaper switcher"
fi
Expand Down
19 changes: 18 additions & 1 deletion services/SystemInfo.qml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,24 @@ Singleton {
Process {
id: getPackages
running: false
command: ["bash", "-c", "pacman_count=$(pacman -Q | wc -l); flatpak_count=$(flatpak list 2>/dev/null | wc -l || echo 0); if [ \"$flatpak_count\" -gt 0 ]; then echo \"$pacman_count pacman, $flatpak_count fp\"; else echo \"$pacman_count pacman\"; fi"]
command: ["bash", "-c", "\
if [ \"${SystemInfo.distroId}\" = \"arch\" ] || [ \"${SystemInfo.distroId}\" = \"cachyos\" ] || [ \"${SystemInfo.distroId}\" = \"endeavouros\" ]; then
pkg_count=$(pacman -Q 2>/dev/null | wc -l)
pkg_tool=\"pacman\"
elif command -v dpkg &>/dev/null; then
pkg_count=$(dpkg -l 2>/dev/null | grep -c '^ii' || echo 0)
pkg_tool=\"dpkg\"
else
pkg_count=0
pkg_tool=\"unknown\"
fi
flatpak_count=$(flatpak list 2>/dev/null | wc -l || echo 0)
if [ \"$flatpak_count\" -gt 0 ]; then
echo \"${pkg_count} ${pkg_tool}, ${flatpak_count} fp\"
else
echo \"${pkg_count} ${pkg_tool}\"
fi
"]
stdout: SplitParser { onRead: data => root.packages = data.trim() }
}

Expand Down
35 changes: 29 additions & 6 deletions services/Updates.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ import Quickshell
import Quickshell.Io

/*
* System updates service. Currently only supports Arch.
* System updates service.
* Supports Arch (pacman/checkupdates/yay) and Debian-based (apt).
*/
Singleton {
id: root

property bool available: false
property alias checking: checkUpdatesProc.running
property int count: 0

readonly property bool updateAdvised: available && count > Config.options.updates.adviseUpdateThreshold
readonly property bool updateStronglyAdvised: available && count > Config.options.updates.stronglyAdviseUpdateThreshold

Expand All @@ -36,19 +37,41 @@ Singleton {
}
}

// Distro-aware availability check
Process {
id: checkAvailabilityProc
running: Config.ready && Config.options.updates.enableCheck
command: ["which", "checkupdates"]
command: ["bash", "-c", "\
if [ \"${SystemInfo.distroId}\" = \"arch\" ] || [ \"${SystemInfo.distroId}\" = \"cachyos\" ] || [ \"${SystemInfo.distroId}\" = \"endeavouros\" ]; then
which checkupdates >/dev/null 2>&1 && echo \"arch\"
elif command -v apt &>/dev/null && [ -f /etc/debian_version ]; then
echo \"debian\"
else
echo \"unsupported\"
fi
"]
onExited: (exitCode, exitStatus) => {
root.available = (exitCode === 0);
root.refresh();
const out = (exitStatus?.toString() ?? "").trim()
root.available = (out === "arch" || out === "debian")
root.refresh()
}
}

// Distro-aware update count
Process {
id: checkUpdatesProc
command: ["bash", "-c", "pacman=$(checkupdates 2>/dev/null | wc -l); aur=$(yay -Qua 2>/dev/null | wc -l || paru -Qua 2>/dev/null | wc -l || echo 0); echo $((pacman + aur))"]
command: ["bash", "-c", "\
if [ \"${SystemInfo.distroId}\" = \"arch\" ] || [ \"${SystemInfo.distroId}\" = \"cachyos\" ] || [ \"${SystemInfo.distroId}\" = \"endeavouros\" ]; then
pacman=$(checkupdates 2>/dev/null | wc -l)
aur=$(yay -Qua 2>/dev/null | wc -l || paru -Qua 2>/dev/null | wc -l || echo 0)
echo $((pacman + aur))
elif command -v apt &>/dev/null && [ -f /etc/debian_version ]; then
apt update -qq 2>/dev/null
apt list --upgradable 2>/dev/null | tail -n +2 | wc -l
else
echo 0
fi
"]
stdout: StdioCollector {
onStreamFinished: {
root.count = parseInt(text.trim())
Expand Down
2 changes: 1 addition & 1 deletion translations/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@
"Symbol": "Symbol",
"System Age •": "System Age •",
"System Icons": "System Icons",
"System updates (Arch only)": "System updates (Arch only)",
"System updates": "System updates",
"There might be a download in progress. Check your Downloads folder.": "There might be a download in progress. Check your Downloads folder.",
"Title font": "Title font",
"Toggle anime results. Usage: %1anime SHOW/HIDE": "Toggle anime results. Usage: %1anime SHOW/HIDE",
Expand Down