feat(command-palette): add action bar to command palette

This commit introduces functionality to manage hidden items in the frecency store, including fetching hidden item IDs, hiding items, and deleting frecency entries. Additionally, the apps store is updated to filter out hidden applications based on the new frecency store logic.
This commit is contained in:
ByteAtATime 2025-06-28 14:44:05 -07:00
parent 7c14ea6c15
commit 398ed86c40
No known key found for this signature in database
7 changed files with 247 additions and 10 deletions

View file

@ -15,7 +15,6 @@ mod quicklinks;
mod snippets;
mod system;
use crate::ai::{ai_ask_stream, AskOptions};
use crate::snippets::input_manager::{EvdevInputManager, InputManager};
use crate::{app::App, cache::AppCache};
use ai::AiUsageManager;
@ -119,6 +118,27 @@ fn get_frecency_data(app: tauri::AppHandle) -> Result<Vec<frecency::FrecencyData
.map_err(|e| e.to_string())
}
#[tauri::command]
fn delete_frecency_entry(app: tauri::AppHandle, item_id: String) -> Result<(), String> {
app.state::<FrecencyManager>()
.delete_frecency_entry(item_id)
.map_err(|e| e.to_string())
}
#[tauri::command]
fn hide_item(app: tauri::AppHandle, item_id: String) -> Result<(), String> {
app.state::<FrecencyManager>()
.hide_item(item_id)
.map_err(|e| e.to_string())
}
#[tauri::command]
fn get_hidden_item_ids(app: tauri::AppHandle) -> Result<Vec<String>, String> {
app.state::<FrecencyManager>()
.get_hidden_item_ids()
.map_err(|e| e.to_string())
}
fn setup_background_refresh() {
thread::spawn(|| {
thread::sleep(Duration::from_secs(60));
@ -243,6 +263,9 @@ pub fn run() {
system::trash,
record_usage,
get_frecency_data,
delete_frecency_entry,
hide_item,
get_hidden_item_ids,
snippets::create_snippet,
snippets::list_snippets,
snippets::update_snippet,