1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-05 21:15: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)
}
}
}

View File

@@ -213,13 +213,15 @@ PanelWindow {
id: historyNotifImage
anchors.fill: parent
readonly property int size: parent.width
property bool imageValid: true
source: model.image || ""
fillMode: Image.PreserveAspectCrop
cache: false
cache: true // Enable caching for history
antialiasing: true
asynchronous: true
smooth: true
visible: imageValid
// Proper sizing like EXAMPLE
width: size
@@ -238,16 +240,36 @@ PanelWindow {
onStatusChanged: {
if (status === Image.Error) {
console.warn("Failed to load notification image:", source)
console.warn("Failed to load notification history image:", source)
imageValid = false
} else if (status === Image.Ready) {
console.log("Notification image loaded:", source, "size:", sourceSize.width + "x" + sourceSize.height)
console.log("Notification history image loaded:", source, "size:", sourceSize.width + "x" + sourceSize.height)
imageValid = true
}
}
}
// Fallback to app icon when primary image fails
Loader {
active: !historyNotifImage.imageValid && model.appIcon && model.appIcon !== ""
anchors.centerIn: parent
sourceComponent: IconImage {
width: 32
height: 32
asynchronous: true
source: {
if (!model.appIcon) return ""
if (model.appIcon.startsWith("file://") || model.appIcon.startsWith("/")) {
return model.appIcon
}
return Quickshell.iconPath(model.appIcon, "image-missing")
}
}
}
// Small app icon overlay when showing notification image
Loader {
active: model.appIcon && model.appIcon !== ""
active: historyNotifImage.imageValid && model.appIcon && model.appIcon !== ""
anchors.bottom: parent.bottom
anchors.right: parent.right
sourceComponent: IconImage {