Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions benches/omni_search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ fn bench_omni_search(c: &mut Criterion) {
desc: format!("Description {i}"),
action: i.to_string(),
args: None,
preview_text: None,
risk_level: None,
icon: None,
})
.collect();
let index = build_index(&actions);
Expand Down
3 changes: 3 additions & 0 deletions benches/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ fn bench_search(c: &mut Criterion) {
desc: String::new(),
action: format!("{i}"),
args: None,
preview_text: None,
risk_level: None,
icon: None,
})
.collect();
let actions_arc = Arc::new(actions);
Expand Down
15 changes: 15 additions & 0 deletions src/actions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ pub struct Action {
pub action: String, // Path to folder or exe
#[serde(skip_serializing_if = "Option::is_none")]
pub args: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub preview_text: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub risk_level: Option<ActionRiskLevel>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub icon: Option<String>,
}

#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum ActionRiskLevel {
Low,
Medium,
High,
Critical,
}

pub fn load_actions(path: &str) -> anyhow::Result<Vec<Action>> {
Expand Down
6 changes: 6 additions & 0 deletions src/dashboard/widgets/active_timers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ impl Widget for ActiveTimersWidget {
desc: "Timer".into(),
action: format!("timer:pause:{id}"),
args: None,
preview_text: None,
risk_level: None,
icon: None,
},
query_override: Some("timer pause".into()),
});
Expand All @@ -121,6 +124,9 @@ impl Widget for ActiveTimersWidget {
desc: "Timer".into(),
action: format!("timer:cancel:{id}"),
args: None,
preview_text: None,
risk_level: None,
icon: None,
},
query_override: Some("timer cancel".into()),
});
Expand Down
9 changes: 9 additions & 0 deletions src/dashboard/widgets/calendar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ impl CalendarWidget {
desc: "Calendar".into(),
action: format!("calendar:add:{input}"),
args: None,
preview_text: None,
risk_level: None,
icon: None,
},
query_override: Some("cal add".into()),
});
Expand All @@ -283,6 +286,9 @@ impl CalendarWidget {
desc: "Calendar".into(),
action: format!("calendar:open:{view}"),
args: None,
preview_text: None,
risk_level: None,
icon: None,
},
query_override: None,
});
Expand Down Expand Up @@ -376,6 +382,9 @@ impl CalendarWidget {
desc: "Calendar".into(),
action: "calendar:open".into(),
args: None,
preview_text: None,
risk_level: None,
icon: None,
},
query_override: None,
});
Expand Down
3 changes: 3 additions & 0 deletions src/dashboard/widgets/clipboard_recent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ impl Widget for ClipboardRecentWidget {
desc: "Clipboard".into(),
action: format!("clipboard:copy:{idx}"),
args: None,
preview_text: None,
risk_level: None,
icon: None,
},
query_override: Some("cb list".into()),
});
Expand Down
6 changes: 6 additions & 0 deletions src/dashboard/widgets/clipboard_snippets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ impl Widget for ClipboardSnippetsWidget {
desc: "Clipboard".into(),
action: format!("clipboard:copy:{idx}"),
args: None,
preview_text: None,
risk_level: None,
icon: None,
},
query_override: Some("cb list".into()),
});
Expand Down Expand Up @@ -165,6 +168,9 @@ impl Widget for ClipboardSnippetsWidget {
desc: "Snippet".into(),
action: format!("clipboard:{}", snippet.text),
args: None,
preview_text: None,
risk_level: None,
icon: None,
},
query_override: Some(format!("cs {}", snippet.alias)),
});
Expand Down
30 changes: 30 additions & 0 deletions src/dashboard/widgets/command_history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ impl CommandHistoryWidget {
desc: "Fav".into(),
action: fav.action.clone(),
args: fav.args.clone(),
preview_text: None,
risk_level: None,
icon: None,
});
}

Expand All @@ -163,6 +166,9 @@ impl CommandHistoryWidget {
desc: "Note".into(),
action: action_id.to_string(),
args: None,
preview_text: None,
risk_level: None,
icon: None,
});
}
}
Expand All @@ -177,6 +183,9 @@ impl CommandHistoryWidget {
desc: "Clipboard".into(),
action: action_id.to_string(),
args: None,
preview_text: None,
risk_level: None,
icon: None,
});
}
}
Expand All @@ -191,6 +200,9 @@ impl CommandHistoryWidget {
desc: "Todo".into(),
action: action_id.to_string(),
args: None,
preview_text: None,
risk_level: None,
icon: None,
});
}
}
Expand All @@ -205,6 +217,9 @@ impl CommandHistoryWidget {
desc: "Todo".into(),
action: action_id.to_string(),
args: None,
preview_text: None,
risk_level: None,
icon: None,
});
}
}
Expand All @@ -219,6 +234,9 @@ impl CommandHistoryWidget {
desc: "Todo".into(),
action: action_id.to_string(),
args: None,
preview_text: None,
risk_level: None,
icon: None,
});
}
}
Expand All @@ -230,6 +248,9 @@ impl CommandHistoryWidget {
desc: "Snippet".into(),
action: action_id.to_string(),
args: None,
preview_text: None,
risk_level: None,
icon: None,
});
}
}
Expand All @@ -241,6 +262,9 @@ impl CommandHistoryWidget {
desc: "Snippet".into(),
action: action_id.to_string(),
args: None,
preview_text: None,
risk_level: None,
icon: None,
});
}
}
Expand All @@ -252,6 +276,9 @@ impl CommandHistoryWidget {
desc: "Snippet".into(),
action: action_id.to_string(),
args: None,
preview_text: None,
risk_level: None,
icon: None,
});
}
}
Expand Down Expand Up @@ -279,6 +306,9 @@ impl CommandHistoryWidget {
desc: pin.desc.clone(),
action: pin.action_id.clone(),
args: pin.args.clone(),
preview_text: None,
risk_level: None,
icon: None,
};
let resolved = Self::resolve_action(ctx, &pin.action_id, pin.args.as_deref());
let action = resolved.clone().unwrap_or(fallback);
Expand Down
3 changes: 3 additions & 0 deletions src/dashboard/widgets/frequent_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ impl FrequentCommandsWidget {
desc: "Command".into(),
action: key.to_string(),
args: None,
preview_text: None,
risk_level: None,
icon: None,
})
})
}
Expand Down
3 changes: 3 additions & 0 deletions src/dashboard/widgets/gesture_health.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ impl GestureHealthWidget {
desc: "Mouse gestures".into(),
action: action.into(),
args: None,
preview_text: None,
risk_level: None,
icon: None,
},
query_override: None,
}
Expand Down
3 changes: 3 additions & 0 deletions src/dashboard/widgets/layouts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,9 @@ impl LayoutsWidget {
desc: "Layout".into(),
action,
args: None,
preview_text: None,
risk_level: None,
icon: None,
},
query_override: None,
}
Expand Down
6 changes: 6 additions & 0 deletions src/dashboard/widgets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,9 @@ pub(crate) fn gesture_focus_action(
desc: "Mouse gestures".into(),
action: "mg:dialog:focus".into(),
args: serde_json::to_string(&args).ok(),
preview_text: None,
risk_level: None,
icon: None,
},
query_override: None,
}
Expand All @@ -597,6 +600,9 @@ pub(crate) fn gesture_toggle_action(
desc: "Mouse gestures".into(),
action: "mg:toggle".into(),
args: serde_json::to_string(&args).ok(),
preview_text: None,
risk_level: None,
icon: None,
},
query_override: None,
}
Expand Down
3 changes: 3 additions & 0 deletions src/dashboard/widgets/notes_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ impl Widget for NotesGraphWidget {
desc: "Note".into(),
action: format!("note:open:{slug}"),
args: None,
preview_text: None,
risk_level: None,
icon: None,
},
query_override: Some(format!("note open {slug}")),
});
Expand Down
3 changes: 3 additions & 0 deletions src/dashboard/widgets/notes_recent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ impl Widget for NotesRecentWidget {
desc: "Note".into(),
action: format!("note:open:{}", note.slug),
args: None,
preview_text: None,
risk_level: None,
icon: None,
},
query_override: Some(format!("note open {}", note.slug)),
});
Expand Down
3 changes: 3 additions & 0 deletions src/dashboard/widgets/notes_tags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ impl Widget for NotesTagsWidget {
desc: "Note".into(),
action: format!("query:note list #{tag}"),
args: None,
preview_text: None,
risk_level: None,
icon: None,
},
query_override: Some(format!("note list #{tag}")),
});
Expand Down
3 changes: 3 additions & 0 deletions src/dashboard/widgets/now_playing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ impl NowPlayingWidget {
desc: "Media".into(),
action: action.into(),
args: None,
preview_text: None,
risk_level: None,
icon: None,
},
query_override: Some(query.into()),
}
Expand Down
9 changes: 9 additions & 0 deletions src/dashboard/widgets/pinned_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ impl PinnedCommandsWidget {
desc: "Fav".into(),
action: f.action.clone(),
args: f.args.clone(),
preview_text: None,
risk_level: None,
icon: None,
});
}
}
Expand All @@ -140,6 +143,9 @@ impl PinnedCommandsWidget {
desc: "Fav".into(),
action: fav.action.clone(),
args: fav.args.clone(),
preview_text: None,
risk_level: None,
icon: None,
})
})
}
Expand Down Expand Up @@ -272,6 +278,9 @@ mod tests {
desc: "desc".into(),
action: id.into(),
args: None,
preview_text: None,
risk_level: None,
icon: None,
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/dashboard/widgets/pinned_query_results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,9 @@ impl PinnedQueryResultsWidget {
desc: action.desc.clone(),
action: format!("query:{}", action.label),
args: None,
preview_text: None,
risk_level: None,
icon: None,
},
},
}
Expand Down
3 changes: 3 additions & 0 deletions src/dashboard/widgets/quick_tools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ impl QuickToolsWidget {
desc: "Tool".into(),
action: format!("query:{query}"),
args: None,
preview_text: None,
risk_level: None,
icon: None,
},
query_override: Some(query.to_string()),
}
Expand Down
9 changes: 9 additions & 0 deletions src/dashboard/widgets/recent_notes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ impl RecentNotesWidget {
desc: "Note".into(),
action: format!("note:open:{}", note.slug),
args: None,
preview_text: None,
risk_level: None,
icon: None,
},
None,
),
Expand All @@ -149,6 +152,9 @@ impl RecentNotesWidget {
desc: "Note".into(),
action: "note:dialog".into(),
args: None,
preview_text: None,
risk_level: None,
icon: None,
},
Some(format!("note open {}", note.slug)),
),
Expand All @@ -158,6 +164,9 @@ impl RecentNotesWidget {
desc: "Note".into(),
action: "query:note open ".into(),
args: None,
preview_text: None,
risk_level: None,
icon: None,
},
Some(format!(
"note open {}",
Expand Down
Loading