antler119 / system_tray

A Flutter package that makes it easy to customize and work with your Flutter desktop app's system tray.
MIT License
214 stars 51 forks source link

Is it possible to get the screen position of the system tray? #60

Open SaadArdati opened 1 year ago

SaadArdati commented 1 year ago

Many apps will position their windows right under their system tray icon. I wish to replicate the same behavior using the https://pub.dev/packages/window_manager package, but I need the coordinates of the system tray to be able to do that.

Is it possible to get information back about the tray's position?

Jarrodsz commented 1 year ago

would like to know the same, great plugin shame its so quiet here

anyone figured itout?

Jarrodsz commented 1 year ago

system_tray implements something similar


/// The bounds of this tray icon.
  Future<Rect?> getBounds() async {
    final Map<String, dynamic> arguments = {
      'devicePixelRatio': window.devicePixelRatio,
    };
    final Map<dynamic, dynamic>? resultData = await _channel.invokeMethod(
      'getBounds',
      arguments,
    );
    if (resultData == null) {
      return null;
    }
    return Rect.fromLTWH(
      resultData['x'],
      resultData['y'],
      resultData['width'],
      resultData['height'],
    );
  }
}``` im really flutter newbie perhaps something like that can be integrated?

window there is from final SingletonFlutterWindow window = SingletonFlutterWindow._(0, PlatformDispatcher.instance);