Skip to main content

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    /// Short label for popover section headers, and the i18n key it is looked
29    /// up by. Sentence case: a UI layer cannot uppercase a *translated* label
30    /// safely — casing rules are per-language, and GPUI has no `text-transform`
31    /// to defer the decision to — so the catalog carries the cased text it
32    /// wants. `DPI` is an acronym, not a shout.
33    #[must_use]
34    pub fn label(self) -> &'static str {
35        match self {
36            Category::Editing => "Editing",
37            Category::Browser => "Browser",
38            Category::Media => "Media",
39            Category::Mouse => "Mouse",
40            Category::Dpi => "DPI",
41            Category::Scroll => "Scroll",
42            Category::Navigation => "Navigation",
43            Category::System => "System",
44        }
45    }
46}