mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-14 09:42:10 -04:00
wallpapers: support more image formats + case insensitivity
fixes #1694 fixes #1660
This commit is contained in:
@@ -649,6 +649,76 @@ func checkI2CAvailability() checkResult {
|
|||||||
return checkResult{catOptionalFeatures, "I2C/DDC", statusOK, fmt.Sprintf("%d monitor(s) detected", len(devices)), "External monitor brightness control", doctorDocsURL + "#optional-features"}
|
return checkResult{catOptionalFeatures, "I2C/DDC", statusOK, fmt.Sprintf("%d monitor(s) detected", len(devices)), "External monitor brightness control", doctorDocsURL + "#optional-features"}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func checkKImageFormats() checkResult {
|
||||||
|
url := doctorDocsURL + "#optional-features"
|
||||||
|
desc := "Extra image format support (AVIF, HEIF, JXL)"
|
||||||
|
|
||||||
|
pluginDir := findQtPluginDir()
|
||||||
|
if pluginDir == "" {
|
||||||
|
return checkResult{catOptionalFeatures, "kimageformats", statusInfo, "Cannot detect (qtpaths not found)", desc, url}
|
||||||
|
}
|
||||||
|
|
||||||
|
imageFormatsDir := filepath.Join(pluginDir, "imageformats")
|
||||||
|
keyPlugins := []struct{ file, format string }{
|
||||||
|
{"kimg_avif.so", "AVIF"},
|
||||||
|
{"kimg_heif.so", "HEIF"},
|
||||||
|
{"kimg_jxl.so", "JXL"},
|
||||||
|
{"kimg_exr.so", "EXR"},
|
||||||
|
}
|
||||||
|
|
||||||
|
var found []string
|
||||||
|
for _, p := range keyPlugins {
|
||||||
|
if _, err := os.Stat(filepath.Join(imageFormatsDir, p.file)); err == nil {
|
||||||
|
found = append(found, p.format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(found) == 0 {
|
||||||
|
return checkResult{catOptionalFeatures, "kimageformats", statusWarn, "Not installed", desc, url}
|
||||||
|
}
|
||||||
|
|
||||||
|
details := ""
|
||||||
|
if doctorVerbose {
|
||||||
|
details = fmt.Sprintf("Formats: %s (%s)", strings.Join(found, ", "), imageFormatsDir)
|
||||||
|
}
|
||||||
|
|
||||||
|
return checkResult{catOptionalFeatures, "kimageformats", statusOK, fmt.Sprintf("Installed (%d formats)", len(found)), details, url}
|
||||||
|
}
|
||||||
|
|
||||||
|
func findQtPluginDir() string {
|
||||||
|
// Check QT_PLUGIN_PATH env var first (used by NixOS and custom setups)
|
||||||
|
if envPath := os.Getenv("QT_PLUGIN_PATH"); envPath != "" {
|
||||||
|
for dir := range strings.SplitSeq(envPath, ":") {
|
||||||
|
if _, err := os.Stat(filepath.Join(dir, "imageformats")); err == nil {
|
||||||
|
return dir
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try qtpaths
|
||||||
|
for _, cmd := range []string{"qtpaths6", "qtpaths"} {
|
||||||
|
if output, err := exec.Command(cmd, "-query", "QT_INSTALL_PLUGINS").Output(); err == nil {
|
||||||
|
if dir := strings.TrimSpace(string(output)); dir != "" {
|
||||||
|
return dir
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback: common distro paths
|
||||||
|
for _, dir := range []string{
|
||||||
|
"/usr/lib/qt6/plugins",
|
||||||
|
"/usr/lib64/qt6/plugins",
|
||||||
|
"/usr/lib/x86_64-linux-gnu/qt6/plugins",
|
||||||
|
"/usr/lib/aarch64-linux-gnu/qt6/plugins",
|
||||||
|
} {
|
||||||
|
if _, err := os.Stat(filepath.Join(dir, "imageformats")); err == nil {
|
||||||
|
return dir
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func detectNetworkBackend(stackResult *network.DetectResult) string {
|
func detectNetworkBackend(stackResult *network.DetectResult) string {
|
||||||
switch stackResult.Backend {
|
switch stackResult.Backend {
|
||||||
case network.BackendNetworkManager:
|
case network.BackendNetworkManager:
|
||||||
@@ -703,6 +773,7 @@ func checkOptionalDependencies() []checkResult {
|
|||||||
results = append(results, checkResult{catOptionalFeatures, "cups-pk-helper", cupsPkStatus, cupsPkMsg, "Printer management", optionalFeaturesURL})
|
results = append(results, checkResult{catOptionalFeatures, "cups-pk-helper", cupsPkStatus, cupsPkMsg, "Printer management", optionalFeaturesURL})
|
||||||
|
|
||||||
results = append(results, checkI2CAvailability())
|
results = append(results, checkI2CAvailability())
|
||||||
|
results = append(results, checkKImageFormats())
|
||||||
|
|
||||||
terminals := []string{"ghostty", "kitty", "alacritty", "foot", "wezterm"}
|
terminals := []string{"ghostty", "kitty", "alacritty", "foot", "wezterm"}
|
||||||
if idx := slices.IndexFunc(terminals, utils.CommandExists); idx >= 0 {
|
if idx := slices.IndexFunc(terminals, utils.CommandExists); idx >= 0 {
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ Rectangle {
|
|||||||
if (!path)
|
if (!path)
|
||||||
return false;
|
return false;
|
||||||
var ext = path.split('.').pop().toLowerCase();
|
var ext = path.split('.').pop().toLowerCase();
|
||||||
return ["jpg", "jpeg", "png", "gif", "webp", "svg", "bmp"].indexOf(ext) >= 0;
|
return ["jpg", "jpeg", "png", "gif", "webp", "svg", "bmp", "jxl", "avif", "heif", "exr"].indexOf(ext) >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DankRipple {
|
DankRipple {
|
||||||
|
|||||||
@@ -280,6 +280,7 @@ FocusScope {
|
|||||||
showDirsFirst: true
|
showDirsFirst: true
|
||||||
showDotAndDotDot: false
|
showDotAndDotDot: false
|
||||||
showHidden: root.showHiddenFiles
|
showHidden: root.showHiddenFiles
|
||||||
|
caseSensitive: false
|
||||||
nameFilters: fileExtensions
|
nameFilters: fileExtensions
|
||||||
showFiles: true
|
showFiles: true
|
||||||
showDirs: true
|
showDirs: true
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ StyledRect {
|
|||||||
function determineFileType(fileName) {
|
function determineFileType(fileName) {
|
||||||
const ext = getFileExtension(fileName);
|
const ext = getFileExtension(fileName);
|
||||||
|
|
||||||
const imageExts = ["png", "jpg", "jpeg", "gif", "bmp", "webp", "svg", "ico"];
|
const imageExts = ["png", "jpg", "jpeg", "gif", "bmp", "webp", "svg", "ico", "jxl", "avif", "heif", "exr"];
|
||||||
if (imageExts.includes(ext)) {
|
if (imageExts.includes(ext)) {
|
||||||
return "image";
|
return "image";
|
||||||
}
|
}
|
||||||
@@ -119,7 +119,7 @@ StyledRect {
|
|||||||
id: gridPreviewImage
|
id: gridPreviewImage
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: 2
|
anchors.margins: 2
|
||||||
property var weExtensions: [".jpg", ".jpeg", ".png", ".webp", ".gif", ".bmp", ".tga"]
|
property var weExtensions: [".jpg", ".jpeg", ".png", ".webp", ".gif", ".bmp", ".tga", ".jxl", ".avif", ".heif", ".exr"]
|
||||||
property int weExtIndex: 0
|
property int weExtIndex: 0
|
||||||
property string imagePath: {
|
property string imagePath: {
|
||||||
if (weMode && delegateRoot.fileIsDir)
|
if (weMode && delegateRoot.fileIsDir)
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ StyledRect {
|
|||||||
function determineFileType(fileName) {
|
function determineFileType(fileName) {
|
||||||
const ext = getFileExtension(fileName);
|
const ext = getFileExtension(fileName);
|
||||||
|
|
||||||
const imageExts = ["png", "jpg", "jpeg", "gif", "bmp", "webp", "svg", "ico"];
|
const imageExts = ["png", "jpg", "jpeg", "gif", "bmp", "webp", "svg", "ico", "jxl", "avif", "heif", "exr"];
|
||||||
if (imageExts.includes(ext)) {
|
if (imageExts.includes(ext)) {
|
||||||
return "image";
|
return "image";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ FloatingWindow {
|
|||||||
browserIcon: "person"
|
browserIcon: "person"
|
||||||
browserType: "profile"
|
browserType: "profile"
|
||||||
showHiddenFiles: true
|
showHiddenFiles: true
|
||||||
fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp"]
|
fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp", "*.jxl", "*.avif", "*.heif", "*.exr"]
|
||||||
onFileSelected: path => {
|
onFileSelected: path => {
|
||||||
PortalService.setProfileImage(path);
|
PortalService.setProfileImage(path);
|
||||||
close();
|
close();
|
||||||
@@ -152,7 +152,7 @@ FloatingWindow {
|
|||||||
browserIcon: "wallpaper"
|
browserIcon: "wallpaper"
|
||||||
browserType: "wallpaper"
|
browserType: "wallpaper"
|
||||||
showHiddenFiles: true
|
showHiddenFiles: true
|
||||||
fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp"]
|
fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp", "*.jxl", "*.avif", "*.heif", "*.exr"]
|
||||||
onFileSelected: path => {
|
onFileSelected: path => {
|
||||||
SessionData.setWallpaper(path);
|
SessionData.setWallpaper(path);
|
||||||
close();
|
close();
|
||||||
|
|||||||
@@ -306,7 +306,8 @@ Item {
|
|||||||
showDirsFirst: false
|
showDirsFirst: false
|
||||||
showDotAndDotDot: false
|
showDotAndDotDot: false
|
||||||
showHidden: false
|
showHidden: false
|
||||||
nameFilters: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp"]
|
caseSensitive: false
|
||||||
|
nameFilters: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp", "*.jxl", "*.avif", "*.heif", "*.exr"]
|
||||||
showFiles: true
|
showFiles: true
|
||||||
showDirs: false
|
showDirs: false
|
||||||
sortField: FolderListModel.Name
|
sortField: FolderListModel.Name
|
||||||
@@ -320,7 +321,7 @@ Item {
|
|||||||
browserIcon: "folder_open"
|
browserIcon: "folder_open"
|
||||||
browserType: "wallpaper"
|
browserType: "wallpaper"
|
||||||
showHiddenFiles: false
|
showHiddenFiles: false
|
||||||
fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp"]
|
fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp", "*.jxl", "*.avif", "*.heif", "*.exr"]
|
||||||
parentPopout: root.parentPopout
|
parentPopout: root.parentPopout
|
||||||
|
|
||||||
onFileSelected: path => {
|
onFileSelected: path => {
|
||||||
|
|||||||
@@ -1302,7 +1302,7 @@ Item {
|
|||||||
browserIcon: "wallpaper"
|
browserIcon: "wallpaper"
|
||||||
browserType: "wallpaper"
|
browserType: "wallpaper"
|
||||||
showHiddenFiles: true
|
showHiddenFiles: true
|
||||||
fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp"]
|
fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp", "*.jxl", "*.avif", "*.heif", "*.exr"]
|
||||||
onFileSelected: path => {
|
onFileSelected: path => {
|
||||||
if (SessionData.perMonitorWallpaper) {
|
if (SessionData.perMonitorWallpaper) {
|
||||||
SessionData.setMonitorWallpaper(selectedMonitorName, path);
|
SessionData.setMonitorWallpaper(selectedMonitorName, path);
|
||||||
@@ -1324,7 +1324,7 @@ Item {
|
|||||||
browserIcon: "light_mode"
|
browserIcon: "light_mode"
|
||||||
browserType: "wallpaper"
|
browserType: "wallpaper"
|
||||||
showHiddenFiles: true
|
showHiddenFiles: true
|
||||||
fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp"]
|
fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp", "*.jxl", "*.avif", "*.heif", "*.exr"]
|
||||||
onFileSelected: path => {
|
onFileSelected: path => {
|
||||||
SessionData.wallpaperPathLight = path;
|
SessionData.wallpaperPathLight = path;
|
||||||
SessionData.syncWallpaperForCurrentMode();
|
SessionData.syncWallpaperForCurrentMode();
|
||||||
@@ -1344,7 +1344,7 @@ Item {
|
|||||||
browserIcon: "dark_mode"
|
browserIcon: "dark_mode"
|
||||||
browserType: "wallpaper"
|
browserType: "wallpaper"
|
||||||
showHiddenFiles: true
|
showHiddenFiles: true
|
||||||
fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp"]
|
fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp", "*.jxl", "*.avif", "*.heif", "*.exr"]
|
||||||
onFileSelected: path => {
|
onFileSelected: path => {
|
||||||
SessionData.wallpaperPathDark = path;
|
SessionData.wallpaperPathDark = path;
|
||||||
SessionData.syncWallpaperForCurrentMode();
|
SessionData.syncWallpaperForCurrentMode();
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (process) {
|
if (process) {
|
||||||
process.command = ["sh", "-c", `ls -1 "${wallpaperDir}"/*.jpg "${wallpaperDir}"/*.jpeg "${wallpaperDir}"/*.png "${wallpaperDir}"/*.bmp "${wallpaperDir}"/*.gif "${wallpaperDir}"/*.webp 2>/dev/null | sort`];
|
process.command = ["sh", "-c", `find "${wallpaperDir}" -maxdepth 1 -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.bmp" -o -iname "*.gif" -o -iname "*.webp" -o -iname "*.jxl" -o -iname "*.avif" -o -iname "*.heif" -o -iname "*.exr" \) 2>/dev/null | sort`];
|
||||||
process.targetScreenName = screenName;
|
process.targetScreenName = screenName;
|
||||||
process.currentWallpaper = currentWallpaper;
|
process.currentWallpaper = currentWallpaper;
|
||||||
process.goToPrevious = false;
|
process.goToPrevious = false;
|
||||||
@@ -272,7 +272,7 @@ Singleton {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Use global process for fallback
|
// Use global process for fallback
|
||||||
cyclingProcess.command = ["sh", "-c", `ls -1 "${wallpaperDir}"/*.jpg "${wallpaperDir}"/*.jpeg "${wallpaperDir}"/*.png "${wallpaperDir}"/*.bmp "${wallpaperDir}"/*.gif "${wallpaperDir}"/*.webp 2>/dev/null | sort`];
|
cyclingProcess.command = ["sh", "-c", `find "${wallpaperDir}" -maxdepth 1 -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.bmp" -o -iname "*.gif" -o -iname "*.webp" -o -iname "*.jxl" -o -iname "*.avif" -o -iname "*.heif" -o -iname "*.exr" \) 2>/dev/null | sort`];
|
||||||
cyclingProcess.targetScreenName = screenName || "";
|
cyclingProcess.targetScreenName = screenName || "";
|
||||||
cyclingProcess.currentWallpaper = currentWallpaper;
|
cyclingProcess.currentWallpaper = currentWallpaper;
|
||||||
cyclingProcess.running = true;
|
cyclingProcess.running = true;
|
||||||
@@ -296,7 +296,7 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (process) {
|
if (process) {
|
||||||
process.command = ["sh", "-c", `ls -1 "${wallpaperDir}"/*.jpg "${wallpaperDir}"/*.jpeg "${wallpaperDir}"/*.png "${wallpaperDir}"/*.bmp "${wallpaperDir}"/*.gif "${wallpaperDir}"/*.webp 2>/dev/null | sort`];
|
process.command = ["sh", "-c", `find "${wallpaperDir}" -maxdepth 1 -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.bmp" -o -iname "*.gif" -o -iname "*.webp" -o -iname "*.jxl" -o -iname "*.avif" -o -iname "*.heif" -o -iname "*.exr" \) 2>/dev/null | sort`];
|
||||||
process.targetScreenName = screenName;
|
process.targetScreenName = screenName;
|
||||||
process.currentWallpaper = currentWallpaper;
|
process.currentWallpaper = currentWallpaper;
|
||||||
process.goToPrevious = true;
|
process.goToPrevious = true;
|
||||||
@@ -304,7 +304,7 @@ Singleton {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Use global process for fallback
|
// Use global process for fallback
|
||||||
prevCyclingProcess.command = ["sh", "-c", `ls -1 "${wallpaperDir}"/*.jpg "${wallpaperDir}"/*.jpeg "${wallpaperDir}"/*.png "${wallpaperDir}"/*.bmp "${wallpaperDir}"/*.gif "${wallpaperDir}"/*.webp 2>/dev/null | sort`];
|
prevCyclingProcess.command = ["sh", "-c", `find "${wallpaperDir}" -maxdepth 1 -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.bmp" -o -iname "*.gif" -o -iname "*.webp" -o -iname "*.jxl" -o -iname "*.avif" -o -iname "*.heif" -o -iname "*.exr" \) 2>/dev/null | sort`];
|
||||||
prevCyclingProcess.targetScreenName = screenName || "";
|
prevCyclingProcess.targetScreenName = screenName || "";
|
||||||
prevCyclingProcess.currentWallpaper = currentWallpaper;
|
prevCyclingProcess.currentWallpaper = currentWallpaper;
|
||||||
prevCyclingProcess.running = true;
|
prevCyclingProcess.running = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user