openlogi_core/binding/category.rs
1//! Popover section categories for the action catalog.
2
3/// Grouping for popover section headers.
4///
5/// Used by [`Action::category`](crate::binding::Action::category) and rendered
6/// as a small muted label above each group in the action picker.
7#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
8pub enum Category {
9 /// Cut, copy, paste, undo, redo, select-all, find, save.
10 Editing,
11 /// Browser navigation: tabs, page reload, back/forward.
12 Browser,
13 /// Playback and volume controls.
14 Media,
15 /// Physical mouse clicks.
16 Mouse,
17 /// DPI cycle and SmartShift.
18 Dpi,
19 /// Scroll direction shortcuts.
20 Scroll,
21 /// Window/app navigation: Mission Control, Launchpad, etc.
22 Navigation,
23 /// Lock screen, show desktop, system-level actions.
24 System,
25}
26
27impl Category {
28 /// Human-readable English label for logs and non-localized contexts.
29 #[must_use]
30 pub fn label(self) -> &'static str {
31 match self {
32 Category::Editing => "Editing",
33 Category::Browser => "Browser",
34 Category::Media => "Media",
35 Category::Mouse => "Mouse",
36 Category::Dpi => "DPI",
37 Category::Scroll => "Scroll",
38 Category::Navigation => "Navigation",
39 Category::System => "System",
40 }
41 }
42
43 /// Stable catalog key for the localized popover section header.
44 #[must_use]
45 pub fn translation_key(self) -> &'static str {
46 match self {
47 Category::Editing => "actions.editing",
48 Category::Browser => "actions.browser",
49 Category::Media => "actions.media",
50 Category::Mouse => "device.mouse",
51 Category::Dpi => "pointer.dpi",
52 Category::Scroll => "pointer.scroll",
53 Category::Navigation => "actions.navigation",
54 Category::System => "actions.system",
55 }
56 }
57}