Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Understand how to bind ExecutablePath and data from AppInfo #27

Open
ForNeVeR opened this issue Mar 16, 2024 · 2 comments
Open

Understand how to bind ExecutablePath and data from AppInfo #27

ForNeVeR opened this issue Mar 16, 2024 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed os:linux

Comments

@ForNeVeR
Copy link
Owner

See the code near this line:

// TODO: Understand how to bind ExecutablePath and data from AppInfo

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?

@ForNeVeR ForNeVeR added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers os:linux labels Mar 16, 2024
ForNeVeR added a commit to y0ung3r/ProcessDoctor that referenced this issue Mar 16, 2024
@y0ung3r
Copy link
Contributor

y0ung3r commented Mar 16, 2024

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
Copy link
Contributor

y0ung3r commented Mar 19, 2024

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:
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed os:linux
Projects
None yet
Development

No branches or pull requests

2 participants