uds ipc working

This commit is contained in:
2026-03-08 18:57:28 +01:00
parent 9e56322705
commit dcc863c451
5 changed files with 174 additions and 95 deletions

View File

@ -28,8 +28,14 @@ impl App {
let mut list_state = ListState::default();
list_state.select(Some(0));
let items = ipc::fetch_history(100)
.unwrap_or_else(|| vec!["rklipd deamon unaccessible".to_string()]);
let items = ipc::fetch_history(100).unwrap_or_default();
let mut list_state = ListState::default();
if items.is_empty() {
list_state.select(None);
} else {
list_state.select(Some(0));
}
let picker = Picker::from_query_stdio().unwrap_or_else(|_| Picker::halfblocks());
@ -175,6 +181,17 @@ impl App {
}
pub fn get_selected_item(&self) -> Option<&String> {
self.list_state.selected().map(|i| &self.filtered_items[i])
self.list_state
.selected()
.and_then(|i| self.filtered_items.get(i))
}
pub fn sync_with_daemon(&mut self) {
if let Some(new_history) = crate::ipc::fetch_history(100) {
if self.all_items != new_history {
self.all_items = new_history;
self.update_search();
}
}
}
}