Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion l10n.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
synthetic-package: false
arb-dir: lib/localization
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart
Expand Down
52 changes: 48 additions & 4 deletions lib/apps_list/widgets/window_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:freezed_annotation/freezed_annotation.dart';
import '../../localization/app_localizations.dart';
import '../../logs/logs.dart';
import '../../native_platform/native_platform.dart';
import '../../settings/settings.dart';
import '../apps_list.dart';

part 'window_tile.freezed.dart';
Expand Down Expand Up @@ -46,6 +47,16 @@ class _WindowTileState extends State<WindowTile> {
Widget build(BuildContext context) {
Color statusColor;

final hidePid = context.select(
(SettingsCubit cubit) => cubit.state.hideProcessPid,
);
final showExecutableFirst = context.select(
(SettingsCubit cubit) => cubit.state.showExecutableFirst,
);
final limitWindowTitle = context.select(
(SettingsCubit cubit) => cubit.state.limitWindowTitleToOneLine,
);

switch (widget.window.process.status) {
case ProcessStatus.normal:
statusColor = Colors.green;
Expand Down Expand Up @@ -76,14 +87,22 @@ class _WindowTileState extends State<WindowTile> {
);
},
),
title: Text(widget.window.title),
subtitle: Column(
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('PID: ${widget.window.process.pid}'),
Text(widget.window.process.executable),
if (showExecutableFirst)
Text(
widget.window.process.executable,
key: const Key('window-tile-executable-first'),
),
Text(
widget.window.title,
maxLines: limitWindowTitle ? 1 : null,
overflow: limitWindowTitle ? TextOverflow.ellipsis : null,
),
],
),
subtitle: _buildSubtitle(hidePid, showExecutableFirst),
contentPadding: const EdgeInsets.symmetric(
vertical: 2,
horizontal: 20,
Expand All @@ -110,6 +129,31 @@ class _WindowTileState extends State<WindowTile> {
),
);
}

Widget? _buildSubtitle(bool hidePid, bool showExecutableFirst) {
final List<Widget> children = [];
if (!hidePid) {
children.add(
Text(
'PID: ${widget.window.process.pid}',
key: const Key('window-tile-pid'),
),
);
}
if (!showExecutableFirst) {
children.add(
Text(
widget.window.process.executable,
key: const Key('window-tile-executable-subtitle'),
),
);
}
if (children.isEmpty) return null;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: children,
);
}
}

/// Button to toggle the favorite status of a window.
Expand Down
29 changes: 29 additions & 0 deletions lib/localization/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,35 @@
"@pinSuspendedWindowsTooltip": {
"description": "Tooltip for the pin suspended windows setting"
},
"@_SETTINGS_PERSONALIZATION_SECTION": {},
"personalizationTitle": "Personalization",
"@personalizationTitle": {
"description": "The title of the personalization section of the settings page."
},
"hidePidSetting": "Hide PID",
"@hidePidSetting": {
"description": "Label for the option that hides PIDs on process cards."
},
"hidePidSettingDescription": "Hide the process ID from each process card.",
"@hidePidSettingDescription": {
"description": "Description for the hide PID setting."
},
"exeFirstSetting": "Executable at top",
"@exeFirstSetting": {
"description": "Label for the option that shows the executable name above the title."
},
"exeFirstSettingDescription": "Display the executable name in place of the title line.",
"@exeFirstSettingDescription": {
"description": "Description for the executable first setting."
},
"limitWindowTitleToOneLine": "Limit title to one line",
"@limitWindowTitleToOneLine": {
"description": "Label for the option that truncates long window titles."
},
"limitWindowTitleToOneLineDescription": "Truncate long window titles with ellipsis to keep cards uniform.",
"@limitWindowTitleToOneLineDescription": {
"description": "Description for the limit window title setting."
},
"showHiddenWindows": "Show hidden windows",
"@showHiddenWindows": {
"description": "Label for the show hidden windows setting"
Expand Down
42 changes: 42 additions & 0 deletions lib/localization/app_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,48 @@ abstract class AppLocalizations {
/// **'If enabled, suspended windows will always be shown at the top of the window list.'**
String get pinSuspendedWindowsTooltip;

/// The title of the personalization section of the settings page.
///
/// In en, this message translates to:
/// **'Personalization'**
String get personalizationTitle;

/// Label for the option that hides PIDs on process cards.
///
/// In en, this message translates to:
/// **'Hide PID'**
String get hidePidSetting;

/// Description for the hide PID setting.
///
/// In en, this message translates to:
/// **'Hide the process ID from each process card.'**
String get hidePidSettingDescription;

/// Label for the option that shows the executable name above the title.
///
/// In en, this message translates to:
/// **'Executable at top'**
String get exeFirstSetting;

/// Description for the executable first setting.
///
/// In en, this message translates to:
/// **'Display the executable name in place of the title line.'**
String get exeFirstSettingDescription;

/// Label for the option that truncates long window titles.
///
/// In en, this message translates to:
/// **'Limit title to one line'**
String get limitWindowTitleToOneLine;

/// Description for the limit window title setting.
///
/// In en, this message translates to:
/// **'Truncate long window titles with ellipsis to keep cards uniform.'**
String get limitWindowTitleToOneLineDescription;

/// Label for the show hidden windows setting
///
/// In en, this message translates to:
Expand Down
23 changes: 23 additions & 0 deletions lib/localization/app_localizations_de.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,29 @@ class AppLocalizationsDe extends AppLocalizations {
String get pinSuspendedWindowsTooltip =>
'If enabled, suspended windows will always be shown at the top of the window list.';

@override
String get personalizationTitle => 'Personalization';

@override
String get hidePidSetting => 'Hide PID';

@override
String get hidePidSettingDescription => 'Hide the process ID from each process card.';

@override
String get exeFirstSetting => 'Executable at top';

@override
String get exeFirstSettingDescription =>
'Display the executable name in place of the title line.';

@override
String get limitWindowTitleToOneLine => 'Limit title to one line';

@override
String get limitWindowTitleToOneLineDescription =>
'Truncate long window titles with ellipsis to keep cards uniform.';

@override
String get showHiddenWindows => 'Versteckte Fenster anzeigen';

Expand Down
23 changes: 23 additions & 0 deletions lib/localization/app_localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,29 @@ class AppLocalizationsEn extends AppLocalizations {
String get pinSuspendedWindowsTooltip =>
'If enabled, suspended windows will always be shown at the top of the window list.';

@override
String get personalizationTitle => 'Personalization';

@override
String get hidePidSetting => 'Hide PID';

@override
String get hidePidSettingDescription => 'Hide the process ID from each process card.';

@override
String get exeFirstSetting => 'Executable at top';

@override
String get exeFirstSettingDescription =>
'Display the executable name in place of the title line.';

@override
String get limitWindowTitleToOneLine => 'Limit title to one line';

@override
String get limitWindowTitleToOneLineDescription =>
'Truncate long window titles with ellipsis to keep cards uniform.';

@override
String get showHiddenWindows => 'Show hidden windows';

Expand Down
23 changes: 23 additions & 0 deletions lib/localization/app_localizations_it.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,29 @@ class AppLocalizationsIt extends AppLocalizations {
String get pinSuspendedWindowsTooltip =>
'If enabled, suspended windows will always be shown at the top of the window list.';

@override
String get personalizationTitle => 'Personalization';

@override
String get hidePidSetting => 'Hide PID';

@override
String get hidePidSettingDescription => 'Hide the process ID from each process card.';

@override
String get exeFirstSetting => 'Executable at top';

@override
String get exeFirstSettingDescription =>
'Display the executable name in place of the title line.';

@override
String get limitWindowTitleToOneLine => 'Limit title to one line';

@override
String get limitWindowTitleToOneLineDescription =>
'Truncate long window titles with ellipsis to keep cards uniform.';

@override
String get showHiddenWindows => 'Mostra finestre nascoste';

Expand Down
21 changes: 21 additions & 0 deletions lib/localization/app_localizations_zh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,27 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get pinSuspendedWindowsTooltip => '如果启用,已挂起的窗口将始终显示在窗口列表的顶部。';

@override
String get personalizationTitle => '个性化';

@override
String get hidePidSetting => '隐藏 PID';

@override
String get hidePidSettingDescription => '在卡片上不显示进程 ID。';

@override
String get exeFirstSetting => 'exe 名称置顶';

@override
String get exeFirstSettingDescription => '始终将可执行文件名显示在卡片最上方。';

@override
String get limitWindowTitleToOneLine => '标题限定一行';

@override
String get limitWindowTitleToOneLineDescription => '长标题自动截断并加省略号,保持卡片统一高度。';

@override
String get showHiddenWindows => '显示隐藏窗口';

Expand Down
29 changes: 29 additions & 0 deletions lib/localization/app_zh.arb
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,35 @@
"@pinSuspendedWindowsTooltip": {
"description": "Tooltip for the pin suspended windows setting"
},
"@_SETTINGS_PERSONALIZATION_SECTION": {},
"personalizationTitle": "个性化",
"@personalizationTitle": {
"description": "The title of the personalization section of the settings page."
},
"hidePidSetting": "隐藏 PID",
"@hidePidSetting": {
"description": "Label for the option that hides PIDs on process cards."
},
"hidePidSettingDescription": "在卡片上不显示进程 ID。",
"@hidePidSettingDescription": {
"description": "Description for the hide PID setting."
},
"exeFirstSetting": "exe 名称置顶",
"@exeFirstSetting": {
"description": "Label for the option that shows the executable name above the title."
},
"exeFirstSettingDescription": "始终将可执行文件名显示在卡片最上方。",
"@exeFirstSettingDescription": {
"description": "Description for the executable first setting."
},
"limitWindowTitleToOneLine": "标题限定一行",
"@limitWindowTitleToOneLine": {
"description": "Label for the option that truncates long window titles."
},
"limitWindowTitleToOneLineDescription": "长标题自动截断并加省略号,保持卡片统一高度。",
"@limitWindowTitleToOneLineDescription": {
"description": "Description for the limit window title setting."
},
"showHiddenWindows": "显示隐藏窗口",
"@showHiddenWindows": {
"description": "Label for the show hidden windows setting"
Expand Down
23 changes: 23 additions & 0 deletions lib/settings/cubit/settings_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ class SettingsCubit extends Cubit<SettingsState> {
final int refreshInterval = await storage.getValue('refreshInterval') ?? 5;
final bool showHiddenWindows = await storage.getValue('showHiddenWindows') ?? false;
final bool startHiddenInTray = await storage.getValue('startHiddenInTray') ?? false;
final bool hideProcessPid = await storage.getValue('hideProcessPid') ?? false;
final bool showExecutableFirst =
await storage.getValue('showExecutableFirst') ?? false;
final bool limitWindowTitleToOneLine =
await storage.getValue('limitWindowTitleToOneLine') ?? false;

return SettingsCubit._(
autostartService,
Expand All @@ -85,6 +90,9 @@ class SettingsCubit extends Cubit<SettingsState> {
refreshInterval: refreshInterval,
showHiddenWindows: showHiddenWindows,
startHiddenInTray: startHiddenInTray,
hideProcessPid: hideProcessPid,
showExecutableFirst: showExecutableFirst,
limitWindowTitleToOneLine: limitWindowTitleToOneLine,
working: false,
),
);
Expand Down Expand Up @@ -159,6 +167,21 @@ class SettingsCubit extends Cubit<SettingsState> {
emit(state.copyWith(startHiddenInTray: value));
}

Future<void> updateHideProcessPid(bool value) async {
emit(state.copyWith(hideProcessPid: value));
await _storage.saveValue(key: 'hideProcessPid', value: value);
}

Future<void> updateShowExecutableFirst(bool value) async {
emit(state.copyWith(showExecutableFirst: value));
await _storage.saveValue(key: 'showExecutableFirst', value: value);
}

Future<void> updateLimitWindowTitleToOneLine(bool value) async {
emit(state.copyWith(limitWindowTitleToOneLine: value));
await _storage.saveValue(key: 'limitWindowTitleToOneLine', value: value);
}

/// Remove the hotkey for a specific application.
Future<void> removeAppSpecificHotkey(String executable) async {
final AppSpecificHotkey appSpecificHotkey = state.appSpecificHotKeys.firstWhere(
Expand Down
6 changes: 6 additions & 0 deletions lib/settings/cubit/settings_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ abstract class SettingsState with _$SettingsState {
required int refreshInterval,
required bool showHiddenWindows,
required bool startHiddenInTray,
required bool hideProcessPid,
required bool showExecutableFirst,
required bool limitWindowTitleToOneLine,

/// True if the app is currently working on something and a loading
/// indicator should be shown.
Expand All @@ -48,6 +51,9 @@ abstract class SettingsState with _$SettingsState {
refreshInterval: 5,
showHiddenWindows: false,
startHiddenInTray: false,
hideProcessPid: false,
showExecutableFirst: false,
limitWindowTitleToOneLine: false,
working: false,
);
}
Loading