Skip to content

Commit

Permalink
v1.26.1 (#61)
Browse files Browse the repository at this point in the history
* feat: allow opening web dashboard from the tray on Windows

* chore: v1.26.1
  • Loading branch information
igoogolx authored Jan 3, 2025
1 parent 662dfc4 commit bff4348
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
9 changes: 7 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import 'package:path_provider/path_provider.dart';
import 'package:uuid/uuid.dart';
import 'package:version/version.dart';
import 'package:window_manager/window_manager.dart';

import 'package:url_launcher/url_launcher.dart';

var uuid = Uuid();

Expand All @@ -28,6 +28,11 @@ void exitApp() {
exit(0);
}

void openDashboard() async {
final Uri url = Uri.parse(urlStr);
launchUrl(url);
}

void main(args) async {
WidgetsFlutterBinding.ensureInitialized();
await notifier.ensureInitialized();
Expand Down Expand Up @@ -70,7 +75,7 @@ void main(args) async {
windowManager.waitUntilReadyToShow(windowOptions, () async {});

if (Platform.isWindows) {
initSystemTray(exitApp, () {
initSystemTray(openDashboard,exitApp, () {
windowManager.show();
windowManager.focus();
});
Expand Down
2 changes: 2 additions & 0 deletions lib/tray.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:flutter/cupertino.dart';
import 'package:system_tray/system_tray.dart';

Future<void> initSystemTray(
void Function() openDashboard,
exitApp,
focusWindow,
) async {
Expand All @@ -18,6 +19,7 @@ Future<void> initSystemTray(
final Menu menu = Menu();
final List<MenuItemBase> menuItems = [
MenuItemLabel(label: 'Lux', enabled: false),
MenuItemLabel(label: 'Web Dashboard', onClicked: (menuItem) => openDashboard()),
MenuItemLabel(label: 'Exit', onClicked: (menuItem) => exitApp()),
];

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.26.0
version: 1.26.1

environment:
sdk: '>=3.0.6 <4.0.0'
Expand Down

0 comments on commit bff4348

Please sign in to comment.