Skip to content

Commit

Permalink
Fix query delay for apps
Browse files Browse the repository at this point in the history
  • Loading branch information
qianlifeng committed Jul 25, 2024
1 parent b4d8a9b commit 99bdf6c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 19 deletions.
27 changes: 15 additions & 12 deletions Wox.UI.Flutter/wox/lib/components/wox_list_item_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,15 @@ class WoxListItemView extends StatelessWidget {
]),
),
// Tails
if (tails.isNotEmpty)
ConstrainedBox(
constraints: BoxConstraints(maxWidth: WoxSettingUtil.instance.currentSetting.appWidth / 2),
child: Padding(
padding: const EdgeInsets.only(left: 10.0, right: 5.0),
child: Obx(() {
if (LoggerSwitch.enablePaintLog) Logger.instance.info(const UuidV4().generate(), "repaint: list item view $key - tails");
Obx(() {
if (LoggerSwitch.enablePaintLog) Logger.instance.info(const UuidV4().generate(), "repaint: list item view $key - tails");

return SingleChildScrollView(
if (tails.isNotEmpty) {
return ConstrainedBox(
constraints: BoxConstraints(maxWidth: WoxSettingUtil.instance.currentSetting.appWidth / 2),
child: Padding(
padding: const EdgeInsets.only(left: 10.0, right: 5.0),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
Expand Down Expand Up @@ -169,10 +169,13 @@ class WoxListItemView extends StatelessWidget {
),
],
),
);
}),
),
),
),
),
);
} else {
return const SizedBox();
}
}),
],
),
);
Expand Down
1 change: 1 addition & 0 deletions Wox.UI.Flutter/wox/lib/entity/wox_query.dart
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ class WoxQueryResult {
data['ContextData'] = contextData;
data['Actions'] = actions.map((v) => v.toJson()).toList();
data['RefreshInterval'] = refreshInterval;
data['Tails'] = tails.map((v) => v.toJson()).toList();
return data;
}
}
Expand Down
7 changes: 0 additions & 7 deletions Wox/plugin/system/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,11 @@ func (a *ApplicationPlugin) Query(ctx context.Context, query plugin.Query) []plu
isNameMatch, nameScore := system.IsStringMatchScore(ctx, info.Name, query.Search)
isPathNameMatch, pathNameScore := system.IsStringMatchScore(ctx, filepath.Base(info.Path), query.Search)
if isNameMatch || isPathNameMatch {
var tails []plugin.QueryResultTail
// get cpu and mem info
if info.IsRunning() {
tails = a.getRunningProcessResult(info.Pid)
}

result := plugin.QueryResult{
Id: uuid.NewString(),
Title: info.Name,
SubTitle: info.Path,
Icon: info.Icon,
Tails: tails,
Score: util.MaxInt64(nameScore, pathNameScore),
Actions: []plugin.QueryResultAction{
{
Expand Down

0 comments on commit 99bdf6c

Please sign in to comment.