feat: use ComputerName instead of hostname on macOS (#2729)

This commit is contained in:
Shlomo
2025-10-04 00:59:42 +03:00
committed by GitHub
parent dac49182f8
commit 7a1bef4fbd
+7 -2
View File
@@ -351,8 +351,13 @@ class SettingsTab extends StatelessWidget {
message: t.settingsTab.network.useSystemName,
child: IconButton(
onPressed: () async {
// Uses dart.io to find the systems hostname
final newAlias = Platform.localHostname;
final String newAlias;
if (Platform.isMacOS) {
final result = await Process.run('scutil', ['--get', 'ComputerName']);
newAlias = result.stdout.toString().trim();
} else {
newAlias = Platform.localHostname;
}
vm.aliasController.text = newAlias;
await ref.notifier(settingsProvider).setAlias(newAlias);