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:
parent
e0221d3393
commit
7e342008c7
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue