mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
Remove lsb_release dpeendency
This commit is contained in:
@@ -10,10 +10,10 @@ Singleton {
|
|||||||
property string osLogo: ""
|
property string osLogo: ""
|
||||||
property string osName: ""
|
property string osName: ""
|
||||||
|
|
||||||
// OS Detection
|
// OS Detection using /etc/os-release
|
||||||
Process {
|
Process {
|
||||||
id: osDetector
|
id: osDetector
|
||||||
command: ["lsb_release", "-i", "-s"]
|
command: ["sh", "-c", "grep '^ID=' /etc/os-release | cut -d'=' -f2 | tr -d '\"'"]
|
||||||
running: true
|
running: true
|
||||||
|
|
||||||
stdout: SplitParser {
|
stdout: SplitParser {
|
||||||
@@ -21,79 +21,80 @@ Singleton {
|
|||||||
onRead: (data) => {
|
onRead: (data) => {
|
||||||
if (data.trim()) {
|
if (data.trim()) {
|
||||||
let osId = data.trim().toLowerCase()
|
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
|
// Set OS-specific Nerd Font icons and names
|
||||||
if (osId.includes("arch")) {
|
switch(osId) {
|
||||||
root.osLogo = "\uf303" // Arch Linux Nerd Font icon
|
case "arch":
|
||||||
root.osName = "Arch Linux"
|
root.osLogo = "\uf303" // Arch Linux Nerd Font icon
|
||||||
console.log("Set Arch logo:", root.osLogo)
|
root.osName = "Arch Linux"
|
||||||
} else if (osId.includes("ubuntu")) {
|
break
|
||||||
root.osLogo = "\uf31b" // Ubuntu Nerd Font icon
|
case "ubuntu":
|
||||||
root.osName = "Ubuntu"
|
root.osLogo = "\uf31b" // Ubuntu Nerd Font icon
|
||||||
} else if (osId.includes("fedora")) {
|
root.osName = "Ubuntu"
|
||||||
root.osLogo = "\uf30a" // Fedora Nerd Font icon
|
break
|
||||||
root.osName = "Fedora"
|
case "fedora":
|
||||||
} else if (osId.includes("debian")) {
|
root.osLogo = "\uf30a" // Fedora Nerd Font icon
|
||||||
root.osLogo = "\uf306" // Debian Nerd Font icon
|
root.osName = "Fedora"
|
||||||
root.osName = "Debian"
|
break
|
||||||
} else if (osId.includes("opensuse")) {
|
case "debian":
|
||||||
root.osLogo = "\uef6d" // openSUSE Nerd Font icon
|
root.osLogo = "\uf306" // Debian Nerd Font icon
|
||||||
root.osName = "openSUSE"
|
root.osName = "Debian"
|
||||||
} else if (osId.includes("manjaro")) {
|
break
|
||||||
root.osLogo = "\uf312" // Manjaro Nerd Font icon
|
case "opensuse":
|
||||||
root.osName = "Manjaro"
|
case "opensuse-leap":
|
||||||
} else {
|
case "opensuse-tumbleweed":
|
||||||
root.osLogo = "\uf033" // Generic Linux Nerd Font icon
|
root.osLogo = "\uef6d" // openSUSE Nerd Font icon
|
||||||
root.osName = "Linux"
|
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")) {
|
console.log("Set OS logo:", root.osLogo, "Name:", root.osName)
|
||||||
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"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -213,13 +213,15 @@ PanelWindow {
|
|||||||
id: historyNotifImage
|
id: historyNotifImage
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
readonly property int size: parent.width
|
readonly property int size: parent.width
|
||||||
|
property bool imageValid: true
|
||||||
|
|
||||||
source: model.image || ""
|
source: model.image || ""
|
||||||
fillMode: Image.PreserveAspectCrop
|
fillMode: Image.PreserveAspectCrop
|
||||||
cache: false
|
cache: true // Enable caching for history
|
||||||
antialiasing: true
|
antialiasing: true
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
smooth: true
|
smooth: true
|
||||||
|
visible: imageValid
|
||||||
|
|
||||||
// Proper sizing like EXAMPLE
|
// Proper sizing like EXAMPLE
|
||||||
width: size
|
width: size
|
||||||
@@ -238,16 +240,36 @@ PanelWindow {
|
|||||||
|
|
||||||
onStatusChanged: {
|
onStatusChanged: {
|
||||||
if (status === Image.Error) {
|
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) {
|
} 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
|
// Small app icon overlay when showing notification image
|
||||||
Loader {
|
Loader {
|
||||||
active: model.appIcon && model.appIcon !== ""
|
active: historyNotifImage.imageValid && model.appIcon && model.appIcon !== ""
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
sourceComponent: IconImage {
|
sourceComponent: IconImage {
|
||||||
|
|||||||
Reference in New Issue
Block a user