Open ForNeVeR opened 7 months ago
Can a single executable have several AppInfo entries?
I don't think so. AppInfo
represents the metadata of the application installed on the system
At the moment I know of only three ways to get icons
Through the AppInfoAdapter
class (implemented now).
Through the FileFactory
class:
var file = FileFactory.NewForPath(ExecutablePath);
using var fileMetadata = file.QueryInfo(
"standard::*",
FileQueryInfoFlags.None,
cancellable: null);
using var iconTheme = new IconTheme(); using var icon = iconTheme.LookupIcon( fileMetadata.Icon, size: 1024, IconLookupFlags.UseBuiltin);
* Through the `IconTheme.ListIcons` method:
```csharp
using var iconTheme = new IconTheme();
var iconName = iconTheme
.ListIcons("Applications")
.FirstOrDefault(applicationName => applicationName == Name);
if (iconName is null)
return ExtractStockIcon(iconTheme);
using var icon = iconTheme.LoadIcon(
iconName,
size: 1024,
IconLookupFlags.UseBuiltin);
Maybe someone knows more ways? For example, these methods don't work for the firefox
application (Firefox Browser).
We need to find a way to get icons for as many applications as possible.
See the code near this line: https://github.com/ForNeVeR/ProcessDoctor/blob/0eeea967ab98402e5e1b2c0844aa0edc3c30cbb6/ProcessDoctor.Backend.Linux/LinuxProcess.cs#L35
So, we know the executable of some app and want to get the corresponding
AppInfo
from GLib.Currently, to do that, we enumerate all the available
AppInfo
objects and just pick the first one with the correspondingExecutable
field.Maybe we could improve this? How is it supposed to really work? Can a single executable have several
AppInfo
entries?