Skip to content

Conversation

@porkloin
Copy link
Contributor

@porkloin porkloin commented Jan 3, 2026

Follow-on PR for #1234. This PR actually updates the matugen.go logic in appendConfig to take an additional argument checkFlatpaks which can be a list of known flatpak IDs. For the majority of applications defined elsewhere in matugen.go the arg is assigned to nil. I've added two flatpaks which I happen to know the IDs for as an initial test case: zen browser and vesktop.

I also added some tests to show that this shouldn't block on cases where a user has both flatpak and bin installs, etc.

Let me know if you'd like to see anything else here!

@porkloin porkloin marked this pull request as draft January 3, 2026 08:11
@porkloin porkloin marked this pull request as ready for review January 3, 2026 08:29
}
if len(checkCmd) > 0 && !utils.AnyCommandExists(checkCmd...) {
return
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will short circuit and not check the flatpaks if the first binary check doesnt find it in the path.

Should proably be like this:

cmdExists := len(checkCmd) == 0 || utils.AnyCommandExists(checkCmd...)
flatpakExists := len(checkFlatpaks) == 0 || utils.AnyFlatpakExists(checkFlatpaks...)

if !cmdExists && !flatpakExists {
    return
}

Same for appendTerminalConfig (should also get the flatpak argument)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Just fixed in a new commit, but == 0 check won't quite work on nil so it's slightly different but same general idea.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

len(slice) in golang results in 0 when the slice is nil , in many operations in GO nil slices behavior like empty slices.

Albeit, in this context it doesnt matter since the "skip evaluation" conditions are explicitly setting nil

But the distinction is

len(slice) == 0 evaluates to true for nil and pointers to an empty slice (not nil but empty slice)

checkCmd == nil only evaluates to true for nil pointer, but not for an empty slice.

@porkloin porkloin requested a review from bbedward January 3, 2026 20:18
@bbedward bbedward merged commit 02166a4 into AvengeMedia:master Jan 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants