ForNeVeR / ProcessDoctor

Cross-platform process monitoring and control software.
MIT License
22 stars 2 forks source link

Understand how to bind ExecutablePath and data from AppInfo #27

Open ForNeVeR opened 7 months ago

ForNeVeR commented 7 months ago

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 corresponding Executable field.

Maybe we could improve this? How is it supposed to really work? Can a single executable have several AppInfo entries?

y0ung3r commented 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

y0ung3r commented 7 months ago

At the moment I know of only three ways to get icons

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.