This plugin allows Flutter desktop apps to defines system tray.

Overview

tray_manager

pub version

This plugin allows Flutter desktop apps to defines system tray.

Discord


Platform Support

Linux macOS Windows
✔️ ✔️ ✔️

Quick Start

Installation

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

dependencies:
  tray_manager: ^0.0.2

Or

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

⚠️ Linux requirements

  • appindicator3-0.1

Run the following command

sudo apt-get install appindicator3-0.1 libappindicator3-dev

Usage

Register/Unregsiter a system/inapp wide hot key.

import 'package:tray_manager/tray_manager.dart';

await TrayManager.instance.setIcon('images/tray_icon.png');
List<MenuItem> menuItems = [
  MenuItem(title: 'Show/Hide Main Window'),
  MenuItem.separator,
  MenuItem(title: 'Exit App'),
];
await TrayManager.instance.setContextMenu(menuItems);
await TrayManager.instance.popUpContextMenu();

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

API

TrayManager

Method Description Linux macOS Windows
destroy Destroys the tray icon immediately. ✔️ ✔️ ✔️
setIcon Sets the image associated with this tray icon. ✔️ ✔️ ✔️
setToolTip - ✔️
setContextMenu - ✔️ ✔️ ✔️
popUpContextMenu Pops up the context menu of the tray icon. When menu is passed, the menu will be shown instead of the tray icon's context menu. ✔️ ✔️
getBounds Returns Rect The bounds of this tray icon. ✔️ ✔️ ✔️

License

MIT License

Copyright (c) 2021 LiJianying <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Comments
  • [linux] [error] clang: error: linker command failed with exit code 1

    [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
    
    
    opened by tatosjb 7
  • [macOS] onTrayIconMouseDown not triggered after long press

    [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.

    opened by cbenhagen 4
  • Library can't be loaded on Debian 11

    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.

    opened by redsolver 3
  • Is there a way to hide the Tray Icon

    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?

    opened by gaddlord 2
  • On Linux Mint 21 and Ubuntu 22.04 unable to build using libayatana library. undefined reference to `g_time_zone_new_identifier'

    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.

    opened by pc-magas 2
  • Demo code not compilable

    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

    opened by codemonza 1
  • popUpContextMenu does not work

    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.

    opened by sufu777 1
  • Fix flutter beta error regarding MenuItem import

    Fix flutter beta error regarding MenuItem import

    There is an error when using this library with the most recent flutter beta (2.13.0-0.1.pre) which can be fixed by simply removing an unused import of material.dart.

    The name 'MenuItem' is defined in the libraries 'package:flutter/src/widgets/platform_menu_bar.dart' and 
    'package:tray_manager/src/menu_item.dart (via package:tray_manager/tray_manager.dart)'
    

    An easy way for client code to fix this is to hide the MenuItem import from material if this is not needed.

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

    Basically the MenuItem class name collides with a new class in flutter which was added in this commit. There is some mentions of the plans for flutter to add native menu bar support in the flutter roadmap which can be read more about in this ticket https://github.com/flutter/flutter/issues/23600.

    opened by simonbengtsson 1
  • System close to tray

    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?

    opened by 15563988825 1
  • [macos] onTrayMenuItemClick not activated in master any more.

    [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

    opened by jeanantoine 1
  • Need one more click on Macos system tray

    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.

    opened by dodatw 1
  • [linux] setting icon works, but only sometimes

    [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.

    opened by jakub-stefaniak 0
Releases(v0.2.0)
Owner
LeanFlutter
To make the flutter even simpler
LeanFlutter
Biyi (比译) is a convenient translation and dictionary app written in dart / Flutter.

Biyi (比译) is a convenient translation and dictionary app written in dart / Flutter.

biyidev 897 Jan 9, 2023
A sound meter app. Made with Flutter.

A sound meter app. Made with Flutter.

Fareez Iqmal 7 Dec 21, 2022
Flutter starter project - a template with best practices for starting a new app or becoming familiar with the architecture of our projects

Flutter starter project - a template with best practices for starting a new app or becoming familiar with the architecture of our projects

PatchAI 72 Nov 24, 2022
Instagram Clone made with Flutter

Instagram Clone made with Flutter

Hmida 22 Oct 14, 2022
A fitness app fetching data from Json built on flutter.

A fitness app fetching data from Json built on flutter.

null 0 Oct 5, 2021
A Flutter package that makes navigation and routing easy.

A Flutter package that makes navigation and routing easy.

null 197 Jan 5, 2023
This plugin allows Flutter desktop apps to defines system tray.

tray_manager This plugin allows Flutter desktop apps to defines system tray. tray_manager Platform Support Quick Start Installation ⚠️ Linux requireme

LeanFlutter 122 Dec 22, 2022
This plugin allows Flutter desktop apps to defines system/inapp wide hotkey (i.e. shortcut).

hotkey_manager This plugin allows Flutter desktop apps to defines system/inapp wide hotkey (i.e. shortcut). hotkey_manager Platform Support Quick Star

LeanFlutter 81 Dec 21, 2022
This plugin allows Flutter desktop apps to defines system/inapp wide hotkey (i.e. shortcut).

hotkey_manager This plugin allows Flutter desktop apps to defines system/inapp wide hotkey (i.e. shortcut). hotkey_manager Platform Support Quick Star

LeanFlutter 81 Dec 21, 2022
A Flutter package that makes it easy to customize and work with your Flutter desktop app's system tray.

system_tray A Flutter package that that enables support for system tray menu for desktop flutter apps. on Windows, macOS and Linux. Features: - Modify

AnTler 140 Dec 30, 2022
A Flutter package that makes it easy to customize and work with your Flutter desktop app's system tray.

system_tray A Flutter package that that enables support for system tray menu for desktop flutter apps. on Windows, macOS and Linux. Features: - Modify

AnTler 140 Dec 30, 2022
This plugin allows Flutter desktop apps to resizing and repositioning the window.

window_manager This plugin allows Flutter desktop apps to resizing and repositioning the window. window_manager Platform Support Quick Start Installat

LeanFlutter 346 Jan 3, 2023
This plugin allows Flutter desktop apps to Retrieve information about screen size, displays, cursor position, etc.

screen_retriever This plugin allows Flutter desktop apps to Retrieve information about screen size, displays, cursor position, etc. screen_retriever P

LeanFlutter 27 Dec 6, 2022
This plugin allows Flutter desktop apps to Retrieve information about screen size, displays, cursor position, etc.

screen_retriever This plugin allows Flutter desktop apps to Retrieve information about screen size, displays, cursor position, etc. screen_retriever P

LeanFlutter 27 Dec 6, 2022
This plugin allows Flutter desktop apps to extract text from screen.

screen_text_extractor This plugin allows Flutter desktop apps to extract text from screen. screen_text_extractor Platform Support Quick Start Installa

LeanFlutter 30 Dec 21, 2022
This plugin allows Flutter desktop apps to resizing and repositioning the window.

window_manager This plugin allows Flutter desktop apps to resizing and repositioning the window. window_manager Platform Support Quick Start Installat

LeanFlutter 351 Jan 7, 2023
This plugin allows Flutter desktop apps to register and handle custom protocols

protocol_handler This plugin allows Flutter desktop apps to register and handle custom protocols (i.e. deep linking). English | 简体中文 protocol_handler

LeanFlutter 57 Dec 22, 2022
A capable library for managing Windows tray icons in your Flutter app 🦋

skip to content A capable tray icon plugin for Windows. ?? package on pub.dev ?? source on github.com ?? dart docs api reference Manage multiple icon

Bent Hillerkus 5 May 27, 2022
The Import Lint package defines import lint rules and report on lints found in Dart code.

Why import lint? The Import Lint package defines import lint rules and report on lints found in Dart code. ?? Usage Add import_lint as a dev_dependenc

ryo 15 Dec 9, 2022
A Flutter plugin that allows you to check if an app is installed/enabled, launch an app and get the list of installed apps.

Flutter AppAvailability Plugin A Flutter plugin that allows you to check if an app is installed/enabled, launch an app and get the list of installed a

Lorenzo Pichilli 89 Dec 2, 2022