Skip to content

Commit 2684a1b

Browse files
committed
Fix recognition
1 parent d38dee6 commit 2684a1b

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/main/java/org/keepassxc/KindOfKeePassXC.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ static Optional<KeePassXCType> determineType() {
1212
var processHandle = ProcessHandle.allProcesses()
1313
.filter(ph -> ph.info().command().isPresent() && ph.info().command().get().contains("KeePassXC"))
1414
.findFirst();
15+
1516
if (processHandle.isPresent() && processHandle.get().info().command().get().contains("AppImage")) {
1617
LOG.debug("Found running KeePassXC AppImage");
1718
return Optional.of(KeePassXCType.AppImage);
@@ -20,24 +21,22 @@ static Optional<KeePassXCType> determineType() {
2021
processHandle = ProcessHandle.allProcesses()
2122
.filter(ph -> ph.info().commandLine().isPresent() && ph.info().commandLine().get().contains("keepassxc"))
2223
.findFirst();
23-
if (processHandle.isPresent()) {
24-
LOG.debug("Found running KeePassXC installed from repository");
25-
return Optional.of(KeePassXCType.Repo);
26-
}
2724

28-
processHandle = ProcessHandle.allProcesses()
29-
.filter(ph -> ph.info().command().isPresent() && ph.info().command().get().contains("keepassxc"))
30-
.findFirst();
31-
if (processHandle.isPresent() && processHandle.get().info().command().get().contains("app")) {
25+
if (processHandle.isPresent() && processHandle.get().info().commandLine().get().contains("bwrap")) {
3226
LOG.debug("Found running KeePassXC installed via Flatpak");
3327
return Optional.of(KeePassXCType.Flatpak);
3428
}
3529

36-
if (processHandle.isPresent() && processHandle.get().info().command().get().contains("snap")) {
30+
if (processHandle.isPresent() && processHandle.get().info().commandLine().get().contains("snap")) {
3731
LOG.debug("Found running KeePassXC installed via Snap");
3832
return Optional.of(KeePassXCType.Snap);
3933
}
4034

35+
if (processHandle.isPresent() && processHandle.get().info().commandLine().get().contains("bin")) {
36+
LOG.debug("Found running KeePassXC installed from repository");
37+
return Optional.of(KeePassXCType.Repo);
38+
}
39+
4140
LOG.debug("Could not find running KeePassXC application");
4241
return Optional.empty();
4342
}

0 commit comments

Comments
 (0)