GithubHelp home page GithubHelp logo

leanflutter / tray_manager Goto Github PK

View Code? Open in Web Editor NEW
208.0 6.0 31.0 448 KB

This plugin allows Flutter desktop apps to defines system tray.

Home Page: https://pub.dev/packages/tray_manager

License: MIT License

Dart 17.21% Swift 13.78% Ruby 2.12% CMake 18.48% C++ 45.77% C 2.63%

tray_manager's Introduction

tray_manager

pub version

This plugin allows Flutter desktop apps to defines system tray.


English | 简体中文


Platform Support

Linux macOS Windows
✔️ ✔️ ✔️

Screenshots

macOS Linux Windows
image

Quick Start

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  tray_manager: ^0.2.1

Or

dependencies:
  tray_manager:
    git:
      url: https://github.com/leanflutter/tray_manager.git
      ref: main

Linux requirements

  • ayatana-appindicator3-0.1 or appindicator3-0.1

Run the following command

sudo apt-get install libayatana-appindicator3-dev

Or

sudo apt-get install appindicator3-0.1 libappindicator3-dev

Usage

import 'package:flutter/material.dart' hide MenuItem;
import 'package:tray_manager/tray_manager.dart';

await trayManager.setIcon(
  Platform.isWindows
    ? 'images/tray_icon.ico'
    : 'images/tray_icon.png',
);
Menu menu = Menu(
  items: [
    MenuItem(
      key: 'show_window',
      label: 'Show Window',
    ),
    MenuItem.separator(),
    MenuItem(
      key: 'exit_app',
      label: 'Exit App',
    ),
  ],
);
await trayManager.setContextMenu(menu);

Please see the example app of this plugin for a full example.

Listening events

import 'package:flutter/material.dart';
import 'package:tray_manager/tray_manager.dart';

class HomePage extends StatefulWidget {
  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> with TrayListener {
  @override
  void initState() {
    trayManager.addListener(this);
    super.initState();
    _init();
  }

  @override
  void dispose() {
    trayManager.removeListener(this);
    super.dispose();
  }

  void _init() {
    // ...
  }

  @override
  Widget build(BuildContext context) {
    // ...
  }

  @override
  void onTrayIconMouseDown() {
    // do something, for example pop up the menu
    trayManager.popUpContextMenu();
  }

  @override
  void onTrayIconRightMouseDown() {
    // do something
  }

  @override
  void onTrayIconRightMouseUp() {
    // do something
  }

  @override
  void onTrayMenuItemClick(MenuItem menuItem) {
    if (menuItem.key == 'show_window') {
      // do something
    } else if (menuItem.key == 'exit_app') {
       // do something
    }
  }
}

Who's using it?

  • Airclap - Send any file to any device. cross platform, ultra fast and easy to use.
  • Biyi (比译) - A convenient translation and dictionary app.

API

TrayManager

Method Description Linux macOS Windows
destroy Destroys the tray icon immediately. ✔️ ✔️ ✔️
setIcon Sets the image associated with this tray icon. ✔️ ✔️ ✔️
setIconPosition Sets the icon position of the tray icon. ✔️
setToolTip Sets the hover text for this tray icon. ✔️ ✔️
setContextMenu Sets the context menu for this icon. ✔️ ✔️ ✔️
popUpContextMenu Pops up the context menu of the tray icon. ✔️ ✔️
getBounds Returns Rect The bounds of this tray icon. ✔️ ✔️

License

MIT

tray_manager's People

Contributors

cbenhagen avatar jpnurmi avatar liangludev avatar lijy91 avatar provokateurin avatar rafaelortizzableh avatar simonbengtsson avatar yahu1031 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

tray_manager's Issues

Failure to build on Ubuntu - "undefined reference to `g_time_zone_new_identifier'"

I have run

sudo apt-get install libayatana-appindicator3-dev

while building I am getting the following error:

/snap/flutter/current/usr/bin/ld: /lib/x86_64-linux-gnu/libayatana-ido3-0.4.so.0: undefined reference to 
`g_time_zone_new_identifier'  ⬅️ HERE

[  +10 ms] clang: error: linker command failed with exit code 1 (use -v to see invocation)
[  +62 ms] ninja: build stopped: subcommand failed.
[  +56 ms] Exception: Build process failed
Exited (sigterm)

cat etc/os-release

PRETTY_NAME="Ubuntu 22.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.1 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

Flutter Doctor -v

[✓] Flutter (Channel stable, 3.3.10, on Ubuntu 22.04.1 LTS 5.15.0-58-generic, locale en_US.UTF-8)
    • Flutter version 3.3.10 on channel stable at /home/gad/snap/flutter/common/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 135454af32 (5 weeks ago), 2022-12-15 07:36:55 -0800
    • Engine revision 3316dd8728
    • Dart version 2.18.6
    • DevTools version 2.15.0

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 10.0.0-4ubuntu1
    • cmake version 3.16.3
    • ninja version 1.10.0
    • pkg-config version 0.29.1

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).

[✓] VS Code (version 1.74.3)
    • VS Code at /usr/share/code
    • Flutter extension version 3.57.20221221

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Ubuntu 22.04.1 LTS 5.15.0-58-generic
    • Chrome (web)    • chrome • web-javascript • Google Chrome 109.0.5414.74

[✓] HTTP Host Availability
    • All required HTTP hosts are available

Demo code not compilable

Fail to compile code from the Usage section demo. The trayManager.setContextMenu() function is expecting 'Menu' type as parameter. The demo is passing in List.

List items = [
MenuItem(
key: 'show_window',
label: 'Show Window',
),
MenuItem.separator(),
MenuItem(
key: 'quit_app',
label: 'Quit',
),
];
await trayManager.setContextMenu(items);

Errors:
List items
Type: List

The argument type 'List' can't be assigned to the parameter type 'Menu'.dartargument_type_not_assignable

[macOS] onTrayIconMouseDown not triggered after long press

To reproduce:

  1. start the example app
  2. click setIcon and setContextMenu buttons
  3. click on tray icon for 1s
  4. menu opens on mouse down and closes automatically on mouse up as expected
  5. click tray icon again
  6. notice that mouse down is not handled

Mostly the same happens if you you press the tray icon about 200ms. The menu will stay open but the next mouse down is not handled as well. The first example is just easier to reproduce but most likely due to the same issue.

On Linux Mint 21 and Ubuntu 22.04 unable to build using libayatana library. undefined reference to `g_time_zone_new_identifier'

Once I build my minimalistic demo:

import 'dart:io' as io;
import 'package:flutter/material.dart' hide MenuItem;
import 'package:tray_manager/tray_manager.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.

  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> with TrayListener {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      // This call to setState tells the Flutter framework that something has
      // changed in this State, which causes it to rerun the build method below
      // so that the display can reflect the updated values. If we changed
      // _counter without calling setState(), then the build method would not be
      // called again, and so nothing would appear to happen.
      _counter++;
    });
  }

  @override
  void initState() {
    trayManager.addListener(this);
    _init();
    super.initState();
  }

  @override
  void dispose() {
    trayManager.removeListener(this);
    super.dispose();
  }

  void _init() async {
    // Add this line to override the default close handler
    initSystemTray();
    setState(() {});
  }

  @override
  void onTrayIconMouseDown() {
    // do something, for example pop up the menu
    trayManager.popUpContextMenu();
  }

  @override
  void onTrayIconRightMouseDown() {
    // do something
  }

  @override
  void onTrayIconRightMouseUp() {
    // do something
  }

  @override
  void onTrayMenuItemClick(MenuItem menuItem) {
    if (menuItem.key == 'exitr') {
      io.exit(0);
    }
  }

  void initSystemTray() async {
    List<MenuItem> items = [
      MenuItem.separator(),
      MenuItem(
        key: 'exit',
        label: 'Exit',
      ),
    ];
    await trayManager.setContextMenu(Menu(items: items));
  }

  @override
  Widget build(BuildContext context) {
    // This method is rerun every time setState is called, for instance as done
    // by the _incrementCounter method above.
    //
    // The Flutter framework has been optimized to make rerunning build methods
    // fast, so that you can just rebuild anything that needs updating rather
    // than having to individually change instances of widgets.
    return Scaffold(
      appBar: AppBar(
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text(widget.title),
      ),
      body: Center(
        // Center is a layout widget. It takes a single child and positions it
        // in the middle of the parent.
        child: Column(
          // Column is also a layout widget. It takes a list of children and
          // arranges them vertically. By default, it sizes itself to fit its
          // children horizontally, and tries to be as tall as its parent.
          //
          // Invoke "debug painting" (press "p" in the console, choose the
          // "Toggle Debug Paint" action from the Flutter Inspector in Android
          // Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
          // to see the wireframe for each widget.
          //
          // Column has various properties to control how it sizes itself and
          // how it positions its children. Here we use mainAxisAlignment to
          // center the children vertically; the main axis here is the vertical
          // axis because Columns are vertical (the cross axis would be
          // horizontal).
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

Via running:

flutter run -v

I get the following error:

$ flutter run -v
2022/11/09 13:09:21.033776 system_key.go:129: cannot determine nfs usage in generateSystemKey: cannot parse /etc/fstab: expected between 3 and 6 fields, found 8
[  +66 ms] executing: uname -m
[  +31 ms] Exit code 0 from: uname -m
[        ] x86_64
[   +6 ms] executing: [/home/pcmagas/snap/flutter/common/flutter/] git -c log.showSignature=false log -n 1
--pretty=format:%H
[  +10 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4
[        ] executing: [/home/pcmagas/snap/flutter/common/flutter/] git tag --points-at
e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4
[  +15 ms] Exit code 0 from: git tag --points-at e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4
[        ] 3.3.7
[  +46 ms] executing: [/home/pcmagas/snap/flutter/common/flutter/] git rev-parse --abbrev-ref --symbolic @{upstream}
[   +5 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{upstream}
[        ] origin/stable
[        ] executing: [/home/pcmagas/snap/flutter/common/flutter/] git ls-remote --get-url origin
[   +6 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[  +37 ms] Unable to locate an Android SDK.
[   +4 ms] executing: [/home/pcmagas/snap/flutter/common/flutter/] git rev-parse --abbrev-ref HEAD
[   +6 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[  +59 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +69 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[   +2 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +198 ms] Skipping pub get: version match.
[  +39 ms] Found plugin tray_manager at
/home/pcmagas/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/tray_manager-0.2.0/
[ +751 ms] Found plugin tray_manager at
/home/pcmagas/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/tray_manager-0.2.0/
[  +31 ms] Found plugin tray_manager at
/home/pcmagas/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/tray_manager-0.2.0/
[  +57 ms] Generating
/mnt/job/Kwdikas/indicator_minimnal/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
[ +300 ms] Initializing file store
[  +10 ms] Skipping target: gen_localizations
[   +4 ms] gen_dart_plugin_registrant: Starting due to {InvalidatedReasonKind.inputChanged: The following inputs have
updated contents: /mnt/job/Kwdikas/indicator_minimnal/.dart_tool/package_config_subset}
[  +17 ms] Found plugin tray_manager at
/home/pcmagas/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/tray_manager-0.2.0/
[   +5 ms] gen_dart_plugin_registrant: Complete
[        ] Skipping target: _composite
[   +2 ms] complete
[   +4 ms] Launching lib/main.dart on Linux in debug mode...
[   +3 ms] /home/pcmagas/snap/flutter/common/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev
/home/pcmagas/snap/flutter/common/flutter/bin/cache/dart-sdk/bin/snapshots/frontend_server.dart.snapshot --sdk-root
/home/pcmagas/snap/flutter/common/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/ --incremental
--target=flutter --debugger-module-names --experimental-emit-debug-metadata -DFLUTTER_WEB_AUTO_DETECT=true
--output-dill /tmp/flutter_tools.PKZNQH/flutter_tool.NTZXNO/app.dill --packages
/mnt/job/Kwdikas/indicator_minimnal/.dart_tool/package_config.json -Ddart.vm.profile=false -Ddart.vm.product=false
--enable-asserts --track-widget-creation --filesystem-scheme org-dartlang-root --initialize-from-dill
build/c075001b96339384a97db4862b8ab8db.cache.dill.track.dill --verbosity=error
--enable-experiment=alternative-invalidation-strategy
[  +24 ms] Building Linux application...
[  +24 ms] <- compile package:indicator_minimnal/main.dart
[   +2 ms] executing: [build/linux/x64/debug/] cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug
-DFLUTTER_TARGET_PLATFORM=linux-x64 /mnt/job/Kwdikas/indicator_minimnal/linux
[  +58 ms] -- Configuring done
[  +18 ms] -- Generating done
[ +241 ms] -- Build files have been written to: /mnt/job/Kwdikas/indicator_minimnal/build/linux/x64/debug
[   +6 ms] executing: ninja -C build/linux/x64/debug install
[   +9 ms] ninja: Entering directory `build/linux/x64/debug'
[+3895 ms] [1/7] Generating /mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/libflutter_linux_gtk.so,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_basic_message_channel.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_binary_codec.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_binary_messenger.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_dart_project.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_engine.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_json_message_codec.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_json_method_codec.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_message_codec.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_method_call.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_method_channel.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_method_codec.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_method_response.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_plugin_registrar.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_plugin_registry.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_standard_message_codec.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_standard_method_codec.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_string_codec.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_value.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_view.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/flutter_linux.h, _phony_
[  +13 ms] [  +74 ms] executing: uname -m
[   +2 ms] [  +38 ms] Exit code 0 from: uname -m
[        ] [        ] x86_64
[        ] [   +6 ms] executing: [/home/pcmagas/snap/flutter/common/flutter/] git -c log.showSignature=false log -n 1
--pretty=format:%H
[        ] [   +6 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] [        ] e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4
[        ] [        ] executing: [/home/pcmagas/snap/flutter/common/flutter/] git tag --points-at
e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4
[        ] [  +16 ms] Exit code 0 from: git tag --points-at e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4
[        ] [        ] 3.3.7
[        ] [ +104 ms] Unable to locate an Android SDK.
[        ] [   +5 ms] executing: [/home/pcmagas/snap/flutter/common/flutter/] git rev-parse --abbrev-ref HEAD
[        ] [   +7 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] [        ] stable
[        ] [  +62 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] [   +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[   +3 ms] [        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] [  +99 ms] executing: [/home/pcmagas/snap/flutter/common/flutter/] git rev-parse --abbrev-ref --symbolic
@{upstream}
[        ] [   +6 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{upstream}
[        ] [        ] origin/stable
[        ] [        ] executing: [/home/pcmagas/snap/flutter/common/flutter/] git ls-remote --get-url origin
[        ] [   +5 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] [        ] https://github.com/flutter/flutter.git
[        ] [   +1 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[   +2 ms] [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[        ] [        ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] [   +1 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'PubDependencies' is not required, skipping update.
[        ] [  +41 ms] Initializing file store
[        ] [   +7 ms] Done initializing file store
[        ] [  +42 ms] Skipping target: gen_localizations
[        ] [  +20 ms] Skipping target: gen_dart_plugin_registrant
[   +2 ms] [ +657 ms] Skipping target: unpack_linux
[        ] [ +471 ms] Skipping target: kernel_snapshot
[   +1 ms] [ +299 ms] Skipping target: debug_bundle_linux-x64_assets
[        ] [        ] Persisting file store
[        ] [   +9 ms] Done persisting file store
[        ] [   +5 ms] build succeeded.
[        ] [   +9 ms] "flutter assemble" took 1.706ms.
[        ] [ +242 ms] ensureAnalyticsSent: 238ms
[        ] [        ] Running shutdown hooks
[        ] [        ] Shutdown hooks complete
[        ] [   +2 ms] exiting with code 0
[ +502 ms] [2/5] Building CXX object CMakeFiles/indicator_minimnal.dir/flutter/generated_plugin_registrant.cc.o
[  +72 ms] [3/5] Building CXX object CMakeFiles/indicator_minimnal.dir/my_application.cc.o
[ +201 ms] [4/5] Linking CXX executable intermediates_do_not_run/indicator_minimnal
[        ] FAILED: intermediates_do_not_run/indicator_minimnal 
[   +9 ms] : && /snap/flutter/current/usr/bin/clang++  -g  -B/snap/flutter/current/usr/lib/gcc/x86_64-linux-gnu/9
-B/snap/flutter/current/usr/lib/x86_64-linux-gnu -B/snap/flutter/current/lib/x86_64-linux-gnu
-B/snap/flutter/current/usr/lib/ -L/snap/flutter/current/usr/lib/gcc/x86_64-linux-gnu/9
-L/snap/flutter/current/usr/lib/x86_64-linux-gnu -L/snap/flutter/current/lib/x86_64-linux-gnu
-L/snap/flutter/current/usr/lib/ -lblkid -lgcrypt -llzma -llz4 -lgpg-error -luuid -lpthread -ldl -lepoxy
-B/snap/flutter/current/usr/lib/gcc/x86_64-linux-gnu/9 -B/snap/flutter/current/usr/lib/x86_64-linux-gnu
-B/snap/flutter/current/lib/x86_64-linux-gnu -B/snap/flutter/current/usr/lib/
-L/snap/flutter/current/usr/lib/gcc/x86_64-linux-gnu/9 -L/snap/flutter/current/usr/lib/x86_64-linux-gnu
-L/snap/flutter/current/lib/x86_64-linux-gnu -L/snap/flutter/current/usr/lib/ -lblkid -lgcrypt -llzma -llz4
-lgpg-error -luuid -lpthread -ldl -lepoxy CMakeFiles/indicator_minimnal.dir/main.cc.o
CMakeFiles/indicator_minimnal.dir/my_application.cc.o
CMakeFiles/indicator_minimnal.dir/flutter/generated_plugin_registrant.cc.o  -o
intermediates_do_not_run/indicator_minimnal
-Wl,-rpath,/mnt/job/Kwdikas/indicator_minimnal/build/linux/x64/debug/plugins/tray_manager:/mnt/job/Kwdikas/indicator_
minimnal/linux/flutter/ephemeral:  plugins/tray_manager/libtray_manager_plugin.so
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/libflutter_linux_gtk.so
/snap/flutter/current/usr/lib/x86_64-linux-gnu/libgtk-3.so
/snap/flutter/current/usr/lib/x86_64-linux-gnu/libgdk-3.so
/snap/flutter/current/usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so
/snap/flutter/current/usr/lib/x86_64-linux-gnu/libpango-1.0.so
/snap/flutter/current/usr/lib/x86_64-linux-gnu/libharfbuzz.so
/snap/flutter/current/usr/lib/x86_64-linux-gnu/libatk-1.0.so
/snap/flutter/current/usr/lib/x86_64-linux-gnu/libcairo-gobject.so
/snap/flutter/current/usr/lib/x86_64-linux-gnu/libcairo.so
/snap/flutter/current/usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so
/snap/flutter/current/usr/lib/x86_64-linux-gnu/libgio-2.0.so
/snap/flutter/current/usr/lib/x86_64-linux-gnu/libgobject-2.0.so
/snap/flutter/current/usr/lib/x86_64-linux-gnu/libglib-2.0.so && :
[   +2 ms] /snap/flutter/current/usr/bin/ld: /lib/x86_64-linux-gnu/libayatana-ido3-0.4.so.0: undefined reference to
`g_time_zone_new_identifier'
[        ] clang: error: linker command failed with exit code 1 (use -v to see invocation)
[   +1 ms] ninja: build stopped: subcommand failed.
[  +12 ms] Building Linux application... (completed in 5,1s)
[+3842 ms] Exception: Build process failed
[   +3 ms] "flutter run" took 10.498ms.
[   +3 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:713:9)
           <asynchronous suspension>
           #2      FlutterCommand.run.<anonymous closure>
(package:flutter_tools/src/runner/flutter_command.dart:1209:27)
           <asynchronous suspension>
           #3      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #4      CommandRunner.runCommand (package:args/command_runner.dart:209:13)
           <asynchronous suspension>
           #5      FlutterCommandRunner.runCommand.<anonymous closure>
           (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
           <asynchronous suspension>
           #6      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand
(package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
           <asynchronous suspension>
           #8      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
           <asynchronous suspension>
           #9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #10     main (package:flutter_tools/executable.dart:91:3)
           <asynchronous suspension>
           
           
[  +71 ms] ensureAnalyticsSent: 70ms
[        ] Running shutdown hooks
[        ] Shutdown hooks complete
[        ] exiting with code 1

The major issue that I have is:

[   +2 ms] /snap/flutter/current/usr/bin/ld: /lib/x86_64-linux-gnu/libayatana-ido3-0.4.so.0: undefined reference to
`g_time_zone_new_identifier'

I am using Linux mint 21 with libayatana-appindicator3-dev as you mention on documentation. The package comes from jammy 22.04 ubuntu that repo though:

$ apt-cache madison libayatana-appindicator3-dev
libayatana-appindicator3-dev | 0.5.90-7ubuntu2 | http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages

Meaning that I am unable to run the application that uses this package under ubuntu 22.04 and derivative distros. Is there an alternative approach on how I can build and run my flutter application (for development) under ubuntu 22.04?

The ubuntu 22.04 is the latest LTS version hence it may cause many problems in the future for linux app development.

The flutter version I use is the 3.3.7 one:

Flutter 3.3.7 • channel stable • https://github.com/flutter/flutter.git
Framework • revision e99c9c7cd9 (7 days ago) • 2022-11-01 16:59:00 -0700
Engine • revision 857bd6b74c
Tools • Dart 2.18.4 • DevTools 2.15.0

With:

  tray_manager: ^0.2.0

At pubspec.yml.

control + clik not work

generally, control + click on keyboard is equal to right click on mouse, but it does not work in this tray.

[macos] onTrayMenuItemClick not activated in master any more.

Hello,

on macos in the example when using the package from pub:
tray_manager: ^0.1.3

void onTrayMenuItemClick(MenuItem menuItem) {
    print(menuItem.toJson());
    BotToast.showText(
      text: '${menuItem.toJson()}',
    );
  }

onTrayMenuItemClick is activated when I select a menu item.

When I use tray_manager from the master

tray_manager:
  path: ../

the example does not work any more.

I use the master because of issue 4

[linux] [error] clang: error: linker command failed with exit code 1

I get this error just trying to build the project after add the lib.

personal_wallet flutter build linux -v

personal_wallet flutter build linux -v
[ +100 ms] executing: uname -m
[  +31 ms] Exit code 0 from: uname -m
[        ] x86_64
[   +4 ms] executing: [/home/tato/snap/flutter/common/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[   +3 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] fb57da5f945d02ef4f98dfd9409a72b7cce74268
[        ] executing: [/home/tato/snap/flutter/common/flutter/] git tag --points-at fb57da5f945d02ef4f98dfd9409a72b7cce74268
[  +16 ms] Exit code 0 from: git tag --points-at fb57da5f945d02ef4f98dfd9409a72b7cce74268
[        ] 3.0.1
[  +12 ms] executing: [/home/tato/snap/flutter/common/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[   +7 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [/home/tato/snap/flutter/common/flutter/] git ls-remote --get-url origin
[   +6 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[  +87 ms] executing: [/home/tato/snap/flutter/common/flutter/] git rev-parse --abbrev-ref HEAD
[   +3 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[  +28 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +29 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[        ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[        ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'PubDependencies' is not required, skipping update.
[  +26 ms] Skipping pub get: version match.
[  +12 ms] Found plugin tray_manager at /home/tato/snap/flutter/common/flutter/.pub-cache/git/tray_manager-d7595175095e18213615c3237ced829979fa0b4d/
[  +26 ms] Found plugin tray_manager at /home/tato/snap/flutter/common/flutter/.pub-cache/git/tray_manager-d7595175095e18213615c3237ced829979fa0b4d/
[  +38 ms] Generating /home/tato/projects/personal_wallet/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
[  +36 ms] 💪 Building with sound null safety 💪
[   +4 ms] Building Linux application...
[   +9 ms] executing: [build/linux/x64/release/] cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DFLUTTER_TARGET_PLATFORM=linux-x64 /home/tato/projects/personal_wallet/linux
[  +22 ms] -- Configuring done
[   +3 ms] -- Generating done
[        ] -- Build files have been written to: /home/tato/projects/personal_wallet/build/linux/x64/release
[   +4 ms] executing: ninja -C build/linux/x64/release install
[   +4 ms] ninja: Entering directory `build/linux/x64/release'
[+1366 ms] [1/7] Generating /home/tato/projects/personal_wallet/linux/flutter/ephemeral/libflutter_linux_gtk.so,
/home/tato/projects/personal_wallet/linux/flutter/ephemeral/flutter_linux/fl_basic_message_channel.h, /home/tato/projects/personal_wallet/linux/flutter/ephemeral/flutter_linux/fl_binary_codec.h,
/home/tato/projects/personal_wallet/linux/flutter/ephemeral/flutter_linux/fl_binary_messenger.h, /home/tato/projects/personal_wallet/linux/flutter/ephemeral/flutter_linux/fl_dart_project.h,
/home/tato/projects/personal_wallet/linux/flutter/ephemeral/flutter_linux/fl_engine.h, /home/tato/projects/personal_wallet/linux/flutter/ephemeral/flutter_linux/fl_json_message_codec.h,
/home/tato/projects/personal_wallet/linux/flutter/ephemeral/flutter_linux/fl_json_method_codec.h, /home/tato/projects/personal_wallet/linux/flutter/ephemeral/flutter_linux/fl_message_codec.h,
/home/tato/projects/personal_wallet/linux/flutter/ephemeral/flutter_linux/fl_method_call.h, /home/tato/projects/personal_wallet/linux/flutter/ephemeral/flutter_linux/fl_method_channel.h,
/home/tato/projects/personal_wallet/linux/flutter/ephemeral/flutter_linux/fl_method_codec.h, /home/tato/projects/personal_wallet/linux/flutter/ephemeral/flutter_linux/fl_method_response.h,
/home/tato/projects/personal_wallet/linux/flutter/ephemeral/flutter_linux/fl_plugin_registrar.h, /home/tato/projects/personal_wallet/linux/flutter/ephemeral/flutter_linux/fl_plugin_registry.h,
/home/tato/projects/personal_wallet/linux/flutter/ephemeral/flutter_linux/fl_standard_message_codec.h,
/home/tato/projects/personal_wallet/linux/flutter/ephemeral/flutter_linux/fl_standard_method_codec.h, /home/tato/projects/personal_wallet/linux/flutter/ephemeral/flutter_linux/fl_string_codec.h,
/home/tato/projects/personal_wallet/linux/flutter/ephemeral/flutter_linux/fl_value.h, /home/tato/projects/personal_wallet/linux/flutter/ephemeral/flutter_linux/fl_view.h,
/home/tato/projects/personal_wallet/linux/flutter/ephemeral/flutter_linux/flutter_linux.h, _phony_
[   +4 ms] [  +97 ms] executing: uname -m
[        ] [  +35 ms] Exit code 0 from: uname -m
[        ] [        ] x86_64
[        ] [   +5 ms] executing: [/home/tato/snap/flutter/common/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] [   +3 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] [        ] fb57da5f945d02ef4f98dfd9409a72b7cce74268
[        ] [        ] executing: [/home/tato/snap/flutter/common/flutter/] git tag --points-at fb57da5f945d02ef4f98dfd9409a72b7cce74268
[        ] [  +14 ms] Exit code 0 from: git tag --points-at fb57da5f945d02ef4f98dfd9409a72b7cce74268
[        ] [        ] 3.0.1
[        ] [   +6 ms] executing: [/home/tato/snap/flutter/common/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[        ] [   +2 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] [        ] origin/stable
[        ] [        ] executing: [/home/tato/snap/flutter/common/flutter/] git ls-remote --get-url origin
[        ] [   +2 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] [        ] https://github.com/flutter/flutter.git
[        ] [  +29 ms] executing: [/home/tato/snap/flutter/common/flutter/] git rev-parse --abbrev-ref HEAD
[        ] [   +2 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] [        ] stable
[        ] [  +25 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] [   +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] [  +46 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[        ] [        ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'PubDependencies' is not required, skipping update.
[        ] [  +18 ms] Initializing file store
[        ] [   +3 ms] Done initializing file store
[        ] [  +23 ms] Skipping target: gen_localizations
[        ] [   +5 ms] Skipping target: gen_dart_plugin_registrant
[        ] [ +134 ms] Skipping target: unpack_linux
[        ] [ +196 ms] Skipping target: kernel_snapshot
[        ] [  +13 ms] Skipping target: aot_elf_release
[        ] [  +13 ms] Skipping target: linux_aot_bundle
[        ] [  +24 ms] Skipping target: release_bundle_linux-x64_assets
[        ] [        ] Persisting file store
[        ] [   +4 ms] Done persisting file store
[        ] [   +2 ms] build succeeded.
[        ] [   +4 ms] "flutter assemble" took 505ms.
[        ] [ +223 ms] ensureAnalyticsSent: 221ms
[        ] [        ] Running shutdown hooks
[        ] [        ] Shutdown hooks complete
[        ] [        ] exiting with code 0
[ +197 ms] [2/5] Building CXX object CMakeFiles/personal_wallet.dir/flutter/generated_plugin_registrant.cc.o
[  +24 ms] [3/5] Building CXX object CMakeFiles/personal_wallet.dir/my_application.cc.o
[ +118 ms] [4/5] Linking CXX executable intermediates_do_not_run/personal_wallet
[        ] FAILED: intermediates_do_not_run/personal_wallet 
[   +3 ms] : && /snap/flutter/current/usr/bin/clang++  -O3 -DNDEBUG  -B/snap/flutter/current/usr/lib/gcc/x86_64-linux-gnu/8 -B/snap/flutter/current/usr/lib/x86_64-linux-gnu
-B/snap/flutter/current/lib/x86_64-linux-gnu -B/snap/flutter/current/usr/lib/ -L/snap/flutter/current/usr/lib/gcc/x86_64-linux-gnu/8 -L/snap/flutter/current/usr/lib/x86_64-linux-gnu
-L/snap/flutter/current/lib/x86_64-linux-gnu -L/snap/flutter/current/usr/lib/ -lblkid -lgcrypt -llzma -llz4 -lgpg-error -luuid -lpthread -ldl -B/snap/flutter/current/usr/lib/gcc/x86_64-linux-gnu/8
-B/snap/flutter/current/usr/lib/x86_64-linux-gnu -B/snap/flutter/current/lib/x86_64-linux-gnu -B/snap/flutter/current/usr/lib/ -L/snap/flutter/current/usr/lib/gcc/x86_64-linux-gnu/8
-L/snap/flutter/current/usr/lib/x86_64-linux-gnu -L/snap/flutter/current/lib/x86_64-linux-gnu -L/snap/flutter/current/usr/lib/ -lblkid -lgcrypt -llzma -llz4 -lgpg-error -luuid -lpthread -ldl
CMakeFiles/personal_wallet.dir/main.cc.o CMakeFiles/personal_wallet.dir/my_application.cc.o CMakeFiles/personal_wallet.dir/flutter/generated_plugin_registrant.cc.o  -o
intermediates_do_not_run/personal_wallet  -Wl,-rpath,/home/tato/projects/personal_wallet/build/linux/x64/release/plugins/tray_manager:/home/tato/projects/personal_wallet/linux/flutter/ephemeral:
plugins/tray_manager/libtray_manager_plugin.so /snap/flutter/current/usr/lib/x86_64-linux-gnu/libgtk-3.so /snap/flutter/current/usr/lib/x86_64-linux-gnu/libgdk-3.so
/snap/flutter/current/usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so /snap/flutter/current/usr/lib/x86_64-linux-gnu/libpango-1.0.so /snap/flutter/current/usr/lib/x86_64-linux-gnu/libatk-1.0.so
/snap/flutter/current/usr/lib/x86_64-linux-gnu/libcairo-gobject.so /snap/flutter/current/usr/lib/x86_64-linux-gnu/libcairo.so /snap/flutter/current/usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so
/home/tato/projects/personal_wallet/linux/flutter/ephemeral/libflutter_linux_gtk.so /snap/flutter/current/usr/lib/x86_64-linux-gnu/libgio-2.0.so
/snap/flutter/current/usr/lib/x86_64-linux-gnu/libgobject-2.0.so /snap/flutter/current/usr/lib/x86_64-linux-gnu/libglib-2.0.so && :
[   +1 ms] //lib/x86_64-linux-gnu/libayatana-ido3-0.4.so.0: undefined reference to `g_time_zone_new_identifier'
[        ] clang: error: linker command failed with exit code 1 (use -v to see invocation)
[   +1 ms] ninja: build stopped: subcommand failed.
[  +18 ms] Building Linux application... (completed in 1.768ms)
[        ] "flutter linux" took 1.976ms.
[   +7 ms] Build process failed
[        ] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      _runBuild (package:flutter_tools/src/linux/build_linux.dart:186:5)
           <asynchronous suspension>
           #2      buildLinux (package:flutter_tools/src/linux/build_linux.dart:78:5)
           <asynchronous suspension>
           #3      BuildLinuxCommand.runCommand (package:flutter_tools/src/commands/build_linux.dart:85:5)
           <asynchronous suspension>
           #4      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1183:27)
           <asynchronous suspension>
           #5      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #6      CommandRunner.runCommand (package:args/command_runner.dart:209:13)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
           <asynchronous suspension>
           #8      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #9      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
           <asynchronous suspension>
           #10     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
           <asynchronous suspension>
           #11     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #12     main (package:flutter_tools/executable.dart:94:3)
           <asynchronous suspension>
           
           
[  +82 ms] ensureAnalyticsSent: 78ms
[   +2 ms] Running shutdown hooks
[        ] Shutdown hooks complete
[        ] exiting with code 1

[linux] setting icon works, but only sometimes

Hey, I ran into an issue testing the example project on a virtual machine running Ubuntu 20.04.3 LTS.

I tested the app on 2 virtual machines on different PCs. One works like a charm and the other one shows the tray icon only sometimes.

I tried launching the example app from the terminal on the problematic vm to see logs, and it throws:
GLib-GIO-CRITICAL **: 16:15:43.425: g_dbus_proxy_new: assertion 'G_IS_DBUS_CONNECTION (connection)' failed
whenever I try to set the tray icon.

One PC has Intel CPU and the second one has AMD CPU. I don't know if that's relevant, but it works as expected on intel.

Is there a way to hide the Tray Icon

I would like to show the Tray Icon only when I minimize the app (I use Window_Manager package to that) and hide the Tray Icon after double-clicking over it.

Can this be ahieved?

Need one more click on Macos system tray

When user right click tray icon many times.
Reproduce step:

  1. right click icon on tray icon
  2. right click again. (it wired from here, the tray icon still at select status)
  3. we need right click again to leave this status.

I found biyi have same issue. other application did not have this issue.

Linux: App crashes when appindicator is missing

When running an app with this plugin on Linux without libayatana-appindicator3-1 the app immediately crashes with:

error while loading shared libraries: libayatana-appindicator3.so.1: cannot open shared object file: No such file or directory

This happens even without ever invoking any trayManager functions. Would it be possible to detect this and fail more gracefully? Ideally I'd like if my app could continue to run without a tray icon, and I could inform the user to install the required package to enable it.

setToolTip error MissingPluginException(No implementation found for method setToolTip on channel tray_manager)

await TrayManager.instance.setToolTip("hello world");
[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: MissingPluginException(No implementation found for method setToolTip on channel tray_manager)
#0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:175:7)
<asynchronous suspension>
#1      TrayManager.setToolTip (package:tray_manager/src/tray_manager.dart:116:5)
<asynchronous suspension>
#2      _MyAppState.setTray (package:task_reminder_flutter/main.dart:48:5)
<asynchronous suspension>
Flutter (Channel beta, 2.9.0-0.1.pre, on Microsoft Windows [Version 10.0.19044.1415], locale zh-CN)
    • Flutter version 2.9.0-0.1.pre at D:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 8f1f9c10f0 (3 weeks ago), 2021-12-14 13:41:48 -0800
    • Engine revision 234aca678a
    • Dart version 2.16.0 (build 2.16.0-80.1.beta)
    • DevTools version 2.9.1

popUpContextMenu does not work

TrayManager.instance.popUpContextMenu() does not work on windows 11?
env: win11
Flutter 3.0.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision ee4e09cce0 (8 days ago) • 2022-05-09 16:45:18 -0700
Engine • revision d1b9a6938a
Tools • Dart 2.17.0 • DevTools 2.12.2

my code:

class _MyAppState extends State<MyApp> with TrayListener{

  @override
  void initState() {
    super.initState();
    initSystemTray();
    TrayManager.instance.addListener(this);
  }

  @override
  void dispose() {
    super.dispose();
    _timer?.cancel();
    TrayManager.instance.removeListener(this);
  }

  // 初始化菜单
  Future<void> initSystemTray() async {
    // 设置图标
    TrayManager.instance.setIcon(Platform.isWindows?'assets/tray_icon.ico':'assets/app_ico.png');
    List<MenuItem> menus = [
      MenuItem(key: "show_window",label: "打开窗口"),
      MenuItem.separator(),
      MenuItem(key: "exit",label: "退出")
    ];
    TrayManager.instance.setContextMenu(Menu(items: menus));
  }


  @override
  void onTrayIconMouseDown() {
    // windowManager.show();
    TrayManager.instance.popUpContextMenu();
  }

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Text("啦啦啦"),
      ),
    );
  }

  @override
  void onTrayIconRightMouseDown() {
    print("right mouse clicked");
    TrayManager.instance.popUpContextMenu();
  }

  @override
  void onTrayMenuItemClick(MenuItem menuItem) {
    if(menuItem.key == 'exit'){
      exit(0);
    }
  }
}

when right mouse down, it seems like main window was focused, but context mune does not pop up.just like this:
o

as the gif show, onTrayIconRightMouseDown was called and successed to print log, but TrayManager.instance.popUpContextMenu(); does not work.

Library can't be loaded on Debian 11

When trying to run a compiled application using this plugin on Debian 11, it crashes with
error while loading shared libraries: libappindicator3.so.1: cannot open shared object file: No such file or directory
This is likely caused by Debian removing libappindicator3-1 from their repositories because it's deprecated (https://www.reddit.com/r/debian/comments/pn1oia/what_happened_to_libappindicator31_in_debian_11/)

The recommended solution is to switch to libayatana-appindicator3-1, but this change needs to be added to all applications. So I guess the best way to fix this plugin is to check if libayatana is available on the user's system and use that instead.

System close to tray

How to keep the app in system when close button is clicked
Is it possible to override the close button so that when a user tries to close the app it just hides and remains in systemtray as background?

统信UOS操作系统设置托盘menu后会出现2个相同的图标。

统信UOS操作版本,专业版(1031),电脑为arm架构。
使用example就能复现。

setIcon后出现第一个托盘图标,该图标用鼠标点击左键和右键都能弹窗菜单;
调用setContextMenu设置托盘后会出现第2个相同的图标,该图标只能用鼠标右键弹窗菜单。
调用setContextMenu后报错
`
(tray_manager_example:20210): libayatana-appindicator-WARNING **: 12:00:14.835: Unable to connect to the Notification Watcher: GDBus.Error:com.deepin.DBus.Error.Unnamed: notifier item has been registered

(tray_manager_example:20210): Gdk-CRITICAL **: 12:00:14.929: gdk_window_thaw_toplevel_updates: assertion 'window->update_and_descendants_freeze_count > 0' failed
`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.