feat: add dbus and cli connect support

This commit is contained in:
Kingtous
2022-10-11 19:52:03 +08:00
parent 5756bee266
commit 3d7736836f
18 changed files with 219 additions and 9 deletions

View File

@@ -10,6 +10,7 @@ import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_hbb/desktop/widgets/tabbar_widget.dart';
import 'package:flutter_hbb/main.dart';
import 'package:flutter_hbb/models/peer_model.dart';
import 'package:flutter_hbb/utils/multi_window_manager.dart';
import 'package:get/get.dart';
@@ -1128,6 +1129,19 @@ Future<bool> restoreWindowPosition(WindowType type, {int? windowId}) async {
return false;
}
void checkArguments() {
// check connect args
final connectIndex = bootArgs.indexOf("--connect");
if (connectIndex == -1) {
return;
}
String? peerId = bootArgs.length < connectIndex + 1 ? null: bootArgs[connectIndex + 1];
if (peerId != null) {
rustDeskWinManager.newRemoteDesktop(peerId);
bootArgs.removeAt(connectIndex); bootArgs.removeAt(connectIndex);
}
}
/// Connect to a peer with [id].
/// If [isFileTransfer], starts a session only for file transfer.
/// If [isTcpTunneling], starts a session only for tcp tunneling.