-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: run app on background #793
Comments
|
cool! I feel good with it :) |
Yes, I saw that you mentioned in another issue that you are migrating persistence to shared_preferences. However, in the current architecture, saving the default behavior of the close button is easy. I have already done most of the work on the current code. I will commit all the code to GitHub later. |
ok :) Thank you for contributing |
enum CloseBtnAction {
none('always ask'),
hide('hide to tray'),
close('close');
final String description;
const CloseBtnAction(this.description);
@override
String toString() => name;
} class _CloseActionSection extends StatelessWidget with WatchItMixin {
const _CloseActionSection();
@override
Widget build(BuildContext context) {
final model = di<SettingsModel>();
final closeBtnAction =
watchPropertyValue((SettingsModel m) => m.closeBtnActionIndex);
return YaruSection(
margin: const EdgeInsets.only(
left: kYaruPagePadding,
top: kYaruPagePadding,
right: kYaruPagePadding,
),
headline: Text(context.l10n.closeButtonAction),
child: Column(
children: [
YaruTile(
title: Text(context.l10n.closeButtonAction),
trailing: YaruPopupMenuButton<CloseBtnAction>(
icon: const DropDownArrow(),
initialValue: closeBtnAction,
child: Text(closeBtnAction.description),
onSelected: (value) {
model.setCloseBtnActionIndex(value);
},
itemBuilder: (context) {
return [
for (var i = 0; i < CloseBtnAction.values.length; ++i)
PopupMenuItem(
value: CloseBtnAction.values[i],
child: Text(CloseBtnAction.values[i].description),
),
];
},
),
),
],
),
);
}
} It seems impossible to implement i18n in enum. Do you have any good suggestions? |
@dongfengweixiao it works in the snap :) However for Linux snap and flatpak we need to set the icon differently |
damn this also didnt help @dongfengweixiao |
let me look... |
musicpod/lib/app/view/system_tray.dart Lines 31 to 39 in fd2d6da
The existing code causes MusicPod to not display the tray icon on Arch Linux. It may be necessary to determine whether the current program is running in a sandbox environment. However, I have not yet verified whether this part of the code works effectively in a flatpak or snap environment. bool isFlatpakEnv() {
return File('/.flatpak-info').existsSync();
}
String _icon() {
if (isFlatpakEnv() || Platform.environment.containsKey('SNAP_NAME')) {
return kAppId;
} else if (Platform.isWindows) {
return 'assets/images/tray_icon.ico';
} else {
return 'assets/images/tray_icon.png';
}
} musicpod/.github/workflows/release.yml Line 99 in fd2d6da
Like in musicpod/lib/app/view/app.dart Lines 104 to 110 in fd2d6da
Directly calling However, these changes need to be completed next week. I'm going on a trip this weekend to visit one of the filming locations of "Black Myth: Wukong," Mount Wutai in Shanxi, China. |
Hey guys I rethought about this: I spent quite some time on using the actual media trays on macos, linux and windows. So there is already a media tray for music players we already use. Running the app in the background is a different thing but also has some edge cases we didnt thought about yet:
Until we didnt figure this all out I will remove this from main again |
Thanks for this awesome Apps, I use it every day!
But it will be great if this app can run in background when I click X button and show a little icon at corner of desktop system tray
The text was updated successfully, but these errors were encountered: