mirror of
https://github.com/ilya-zlobintsev/LACT.git
synced 2026-08-19 01:14:43 -05:00
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:
Generated
+6
-6
@@ -1662,7 +1662,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lact"
|
name = "lact"
|
||||||
version = "0.9.0"
|
version = "0.9.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"divan",
|
"divan",
|
||||||
@@ -1674,7 +1674,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lact-cli"
|
name = "lact-cli"
|
||||||
version = "0.9.0"
|
version = "0.9.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"lact-client",
|
"lact-client",
|
||||||
@@ -1684,7 +1684,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lact-client"
|
name = "lact-client"
|
||||||
version = "0.9.0"
|
version = "0.9.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"amdgpu-sysfs",
|
"amdgpu-sysfs",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
@@ -1699,7 +1699,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lact-daemon"
|
name = "lact-daemon"
|
||||||
version = "0.9.0"
|
version = "0.9.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"amdgpu-sysfs",
|
"amdgpu-sysfs",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
@@ -1737,7 +1737,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lact-gui"
|
name = "lact-gui"
|
||||||
version = "0.9.0"
|
version = "0.9.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"amdgpu-sysfs",
|
"amdgpu-sysfs",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
@@ -1769,7 +1769,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lact-schema"
|
name = "lact-schema"
|
||||||
version = "0.9.0"
|
version = "0.9.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"amdgpu-sysfs",
|
"amdgpu-sysfs",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "lact-cli"
|
name = "lact-cli"
|
||||||
version = "0.9.0"
|
version = "0.9.1"
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "lact-client"
|
name = "lact-client"
|
||||||
version = "0.9.0"
|
version = "0.9.1"
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "lact-daemon"
|
name = "lact-daemon"
|
||||||
version = "0.9.0"
|
version = "0.9.1"
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
|
|
||||||
[features]
|
[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> {
|
pub fn get_pid_info(pid: PID) -> std::io::Result<ProfileProcessInfo> {
|
||||||
let cmdline = libcopes::io::cmdline_reader(pid)?;
|
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 exe = libcopes::io::exe_reader(pid).unwrap_or_else(|_| {
|
||||||
let arg0 = cmdline.as_ref().first().cloned().unwrap_or_default();
|
let arg0 = cmdline.as_ref().first().cloned().unwrap_or_default();
|
||||||
arg0.to_str()
|
arg0.to_str()
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "lact-gui"
|
name = "lact-gui"
|
||||||
version = "0.9.0"
|
version = "0.9.1"
|
||||||
authors = ["Ilya Zlobintsev <ilya.zl@protonmail.com>"]
|
authors = ["Ilya Zlobintsev <ilya.zl@protonmail.com>"]
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
|
|
||||||
|
|||||||
@@ -271,7 +271,13 @@ impl relm4::factory::FactoryComponent for ProfileRuleRow {
|
|||||||
|
|
||||||
process_listview.add_filter({
|
process_listview.add_filter({
|
||||||
let process_filter = process_search_filter.clone();
|
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
|
process_listview
|
||||||
.selection_model
|
.selection_model
|
||||||
@@ -303,7 +309,8 @@ impl relm4::factory::FactoryComponent for ProfileRuleRow {
|
|||||||
.extend_from_iter(state.process_list.into_values().map(ProcessListItem).rev());
|
.extend_from_iter(state.process_list.into_values().map(ProcessListItem).rev());
|
||||||
}
|
}
|
||||||
ProfileRuleRowMsg::ProcessFilterChanged(filter) => {
|
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);
|
self.process_listview.set_filter_status(0, false);
|
||||||
if !filter.is_empty() {
|
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
|
// Indexing is not aware of filters, so we have to apply the filter here to find a matching index
|
||||||
(0..self.process_listview.len())
|
(0..self.process_listview.len())
|
||||||
.map(|i| self.process_listview.get(i).unwrap())
|
.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)
|
.nth(index as usize)
|
||||||
};
|
};
|
||||||
if let Some(item) = item {
|
if let Some(item) = item {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "lact-schema"
|
name = "lact-schema"
|
||||||
version = "0.9.0"
|
version = "0.9.1"
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "lact"
|
name = "lact"
|
||||||
version = "0.9.0"
|
version = "0.9.1"
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ metadata:
|
|||||||
description: GPU control utility
|
description: GPU control utility
|
||||||
arch: x86_64
|
arch: x86_64
|
||||||
license: MIT
|
license: MIT
|
||||||
version: 0.9.0
|
version: 0.9.1
|
||||||
maintainer: ilya-zlobintsev
|
maintainer: ilya-zlobintsev
|
||||||
url: https://github.com/ilya-zlobintsev/lact
|
url: https://github.com/ilya-zlobintsev/lact
|
||||||
source:
|
source:
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ metadata:
|
|||||||
description: GPU control utility
|
description: GPU control utility
|
||||||
arch: x86_64
|
arch: x86_64
|
||||||
license: MIT
|
license: MIT
|
||||||
version: 0.9.0
|
version: 0.9.1
|
||||||
maintainer: ilya-zlobintsev
|
maintainer: ilya-zlobintsev
|
||||||
url: https://github.com/ilya-zlobintsev/lact
|
url: https://github.com/ilya-zlobintsev/lact
|
||||||
source:
|
source:
|
||||||
|
|||||||
Reference in New Issue
Block a user