feat: improve profile process rule selector (#1003)

* feat: improve profile process rule selector

* perf: only convert filter to lowercase once
This commit is contained in:
Ilya Zlobintsev
2026-05-02 22:03:52 +03:00
committed by GitHub
parent e37a756493
commit 3a4125879a
11 changed files with 35 additions and 17 deletions
Generated
+6 -6
View File
@@ -1662,7 +1662,7 @@ dependencies = [
[[package]]
name = "lact"
version = "0.9.0"
version = "0.9.1"
dependencies = [
"anyhow",
"divan",
@@ -1674,7 +1674,7 @@ dependencies = [
[[package]]
name = "lact-cli"
version = "0.9.0"
version = "0.9.1"
dependencies = [
"anyhow",
"lact-client",
@@ -1684,7 +1684,7 @@ dependencies = [
[[package]]
name = "lact-client"
version = "0.9.0"
version = "0.9.1"
dependencies = [
"amdgpu-sysfs",
"anyhow",
@@ -1699,7 +1699,7 @@ dependencies = [
[[package]]
name = "lact-daemon"
version = "0.9.0"
version = "0.9.1"
dependencies = [
"amdgpu-sysfs",
"anyhow",
@@ -1737,7 +1737,7 @@ dependencies = [
[[package]]
name = "lact-gui"
version = "0.9.0"
version = "0.9.1"
dependencies = [
"amdgpu-sysfs",
"anyhow",
@@ -1769,7 +1769,7 @@ dependencies = [
[[package]]
name = "lact-schema"
version = "0.9.0"
version = "0.9.1"
dependencies = [
"amdgpu-sysfs",
"anyhow",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "lact-cli"
version = "0.9.0"
version = "0.9.1"
edition.workspace = true
[dependencies]
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "lact-client"
version = "0.9.0"
version = "0.9.1"
edition.workspace = true
[dependencies]
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "lact-daemon"
version = "0.9.0"
version = "0.9.1"
edition.workspace = true
[features]
@@ -64,6 +64,11 @@ pub fn start_listener(event_tx: mpsc::Sender<ProfileWatcherEvent>) {
pub fn get_pid_info(pid: PID) -> std::io::Result<ProfileProcessInfo> {
let cmdline = libcopes::io::cmdline_reader(pid)?;
if cmdline.as_ref().is_empty() {
return Err(std::io::Error::other("empty cmdline"));
}
let exe = libcopes::io::exe_reader(pid).unwrap_or_else(|_| {
let arg0 = cmdline.as_ref().first().cloned().unwrap_or_default();
arg0.to_str()
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "lact-gui"
version = "0.9.0"
version = "0.9.1"
authors = ["Ilya Zlobintsev <ilya.zl@protonmail.com>"]
edition.workspace = true
@@ -271,7 +271,13 @@ impl relm4::factory::FactoryComponent for ProfileRuleRow {
process_listview.add_filter({
let process_filter = process_search_filter.clone();
move |process| process.0.cmdline.contains(process_filter.value().as_str())
move |process| {
process
.0
.cmdline
.to_ascii_lowercase()
.contains(process_filter.value().as_str())
}
});
process_listview
.selection_model
@@ -303,7 +309,8 @@ impl relm4::factory::FactoryComponent for ProfileRuleRow {
.extend_from_iter(state.process_list.into_values().map(ProcessListItem).rev());
}
ProfileRuleRowMsg::ProcessFilterChanged(filter) => {
self.process_search_filter.set_value(filter.as_str());
self.process_search_filter
.set_value(filter.to_ascii_lowercase());
self.process_listview.set_filter_status(0, false);
if !filter.is_empty() {
@@ -323,7 +330,13 @@ impl relm4::factory::FactoryComponent for ProfileRuleRow {
// Indexing is not aware of filters, so we have to apply the filter here to find a matching index
(0..self.process_listview.len())
.map(|i| self.process_listview.get(i).unwrap())
.filter(|item| item.borrow().0.cmdline.contains(filter_text.as_str()))
.filter(|item| {
item.borrow()
.0
.cmdline
.to_ascii_lowercase()
.contains(filter_text.as_str())
})
.nth(index as usize)
};
if let Some(item) = item {
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "lact-schema"
version = "0.9.0"
version = "0.9.1"
edition.workspace = true
[features]
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "lact"
version = "0.9.0"
version = "0.9.1"
edition.workspace = true
[features]
+1 -1
View File
@@ -3,7 +3,7 @@ metadata:
description: GPU control utility
arch: x86_64
license: MIT
version: 0.9.0
version: 0.9.1
maintainer: ilya-zlobintsev
url: https://github.com/ilya-zlobintsev/lact
source:
+1 -1
View File
@@ -3,7 +3,7 @@ metadata:
description: GPU control utility
arch: x86_64
license: MIT
version: 0.9.0
version: 0.9.1
maintainer: ilya-zlobintsev
url: https://github.com/ilya-zlobintsev/lact
source: