fix: find supported terminal on operating systems other than Debian. closes #61

The implementation of `_getTerminalEmulator` is specific to Debian-based systems, as it relies on the `x-terminal-emulator` symbolic link. This link does not exist on other Linux distributions or on macOS.

This patch first tries to find the `x-terminal-emulator` symbolic link. If it doesn't exist or returns an empty string, it then iterates over a list of supported terminal emulators and uses the `whichSync` function to check if they exist in the PATH. It sets `_terminalEmulator` to the first terminal emulator it finds in the PATH.
This commit is contained in:
Martin Wimpress 2024-06-27 04:14:49 +01:00 committed by Martin Wimpress
parent e0221d3393
commit 7e342008c7
1 changed files with 12 additions and 0 deletions

View File

@ -89,6 +89,18 @@ class _ManagerState extends State<Manager> with PreferencesMixin {
_terminalEmulator = path.basename(terminalEmulator);
});
}
} else {
// If x-terminal-emulator doesn't exist or returns empty, look for
// supported terminals in the PATH
for (String terminal in _supportedTerminalEmulators) {
String? terminalPath = whichSync(terminal);
if (terminalPath != null) {
setState(() {
_terminalEmulator = terminal;
});
break;
}
}
}
}