1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-07 14:05:38 -05:00

Remove lsb_release dpeendency

This commit is contained in:
bbedward
2025-07-11 09:49:31 -04:00
parent 708fc55dd3
commit 6e64dfe499
2 changed files with 98 additions and 75 deletions

View File

@@ -10,10 +10,10 @@ Singleton {
property string osLogo: ""
property string osName: ""
// OS Detection
// OS Detection using /etc/os-release
Process {
id: osDetector
command: ["lsb_release", "-i", "-s"]
command: ["sh", "-c", "grep '^ID=' /etc/os-release | cut -d'=' -f2 | tr -d '\"'"]
running: true
stdout: SplitParser {
@@ -21,79 +21,80 @@ Singleton {
onRead: (data) => {
if (data.trim()) {
let osId = data.trim().toLowerCase()
console.log("Detected OS:", osId)
console.log("Detected OS from /etc/os-release:", osId)
// Set OS-specific Nerd Font icons and names
if (osId.includes("arch")) {
root.osLogo = "\uf303" // Arch Linux Nerd Font icon
root.osName = "Arch Linux"
console.log("Set Arch logo:", root.osLogo)
} else if (osId.includes("ubuntu")) {
root.osLogo = "\uf31b" // Ubuntu Nerd Font icon
root.osName = "Ubuntu"
} else if (osId.includes("fedora")) {
root.osLogo = "\uf30a" // Fedora Nerd Font icon
root.osName = "Fedora"
} else if (osId.includes("debian")) {
root.osLogo = "\uf306" // Debian Nerd Font icon
root.osName = "Debian"
} else if (osId.includes("opensuse")) {
root.osLogo = "\uef6d" // openSUSE Nerd Font icon
root.osName = "openSUSE"
} else if (osId.includes("manjaro")) {
root.osLogo = "\uf312" // Manjaro Nerd Font icon
root.osName = "Manjaro"
} else {
root.osLogo = "\uf033" // Generic Linux Nerd Font icon
root.osName = "Linux"
switch(osId) {
case "arch":
root.osLogo = "\uf303" // Arch Linux Nerd Font icon
root.osName = "Arch Linux"
break
case "ubuntu":
root.osLogo = "\uf31b" // Ubuntu Nerd Font icon
root.osName = "Ubuntu"
break
case "fedora":
root.osLogo = "\uf30a" // Fedora Nerd Font icon
root.osName = "Fedora"
break
case "debian":
root.osLogo = "\uf306" // Debian Nerd Font icon
root.osName = "Debian"
break
case "opensuse":
case "opensuse-leap":
case "opensuse-tumbleweed":
root.osLogo = "\uef6d" // openSUSE Nerd Font icon
root.osName = "openSUSE"
break
case "manjaro":
root.osLogo = "\uf312" // Manjaro Nerd Font icon
root.osName = "Manjaro"
break
case "nixos":
root.osLogo = "\uf313" // NixOS Nerd Font icon
root.osName = "NixOS"
break
case "rocky":
root.osLogo = "\uf32b" // Rocky Linux Nerd Font icon
root.osName = "Rocky Linux"
break
case "almalinux":
root.osLogo = "\uf31d" // AlmaLinux Nerd Font icon
root.osName = "AlmaLinux"
break
case "centos":
root.osLogo = "\uf304" // CentOS Nerd Font icon
root.osName = "CentOS"
break
case "rhel":
case "redhat":
root.osLogo = "\uf316" // Red Hat Nerd Font icon
root.osName = "Red Hat"
break
case "gentoo":
root.osLogo = "\uf30d" // Gentoo Nerd Font icon
root.osName = "Gentoo"
break
case "mint":
case "linuxmint":
root.osLogo = "\uf30e" // Linux Mint Nerd Font icon
root.osName = "Linux Mint"
break
case "elementary":
root.osLogo = "\uf309" // Elementary OS Nerd Font icon
root.osName = "Elementary OS"
break
case "pop":
root.osLogo = "\uf32a" // Pop!_OS Nerd Font icon
root.osName = "Pop!_OS"
break
default:
root.osLogo = "\uf17c" // Generic Linux Nerd Font icon
root.osName = "Linux"
}
}
}
}
onExited: (exitCode) => {
if (exitCode !== 0) {
// Fallback: try checking /etc/os-release
osDetectorFallback.running = true
}
}
}
// Fallback OS detection
Process {
id: osDetectorFallback
command: ["sh", "-c", "grep '^ID=' /etc/os-release | cut -d'=' -f2 | tr -d '\"'"]
running: false
stdout: SplitParser {
splitMarker: "\n"
onRead: (data) => {
if (data.trim()) {
let osId = data.trim().toLowerCase()
console.log("Detected OS (fallback):", osId)
if (osId.includes("arch")) {
root.osLogo = "\uf303"
root.osName = "Arch Linux"
} else if (osId.includes("ubuntu")) {
root.osLogo = "\uf31b"
root.osName = "Ubuntu"
} else if (osId.includes("fedora")) {
root.osLogo = "\uf30a"
root.osName = "Fedora"
} else if (osId.includes("debian")) {
root.osLogo = "\uf306"
root.osName = "Debian"
} else if (osId.includes("opensuse")) {
root.osLogo = "\uef6d"
root.osName = "openSUSE"
} else if (osId.includes("manjaro")) {
root.osLogo = "\uf312"
root.osName = "Manjaro"
} else {
root.osLogo = "\uf033"
root.osName = "Linux"
}
console.log("Set OS logo:", root.osLogo, "Name:", root.osName)
}
}
}