use serde::{Deserialize, Serialize};
use super::super::Action;
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ActionRingIcon {
Pointer,
Mouse,
Copy,
Paste,
Cut,
Search,
Save,
Keyboard,
Applications,
Grid,
Layers,
Monitor,
Lock,
Camera,
Play,
Volume,
Gauge,
Refresh,
ArrowUp,
ArrowDown,
ArrowLeft,
ArrowRight,
Undo,
Redo,
SelectAll,
MouseBack,
MouseForward,
NewTab,
CloseTab,
ReopenTab,
NextTab,
PreviousTab,
Reload,
PreviousDesktop,
NextDesktop,
PreviousTrack,
NextTrack,
VolumeDown,
Mute,
ScrollLeft,
ScrollRight,
Folder,
File,
Globe,
Terminal,
Settings,
Star,
Heart,
Calendar,
Bell,
User,
Palette,
Book,
Ban,
}
impl ActionRingIcon {
pub const ALL: [Self; 54] = [
Self::Pointer,
Self::Mouse,
Self::Copy,
Self::Paste,
Self::Cut,
Self::Search,
Self::Save,
Self::Keyboard,
Self::Applications,
Self::Grid,
Self::Layers,
Self::Monitor,
Self::Lock,
Self::Camera,
Self::Play,
Self::Volume,
Self::Gauge,
Self::Refresh,
Self::ArrowUp,
Self::ArrowDown,
Self::ArrowLeft,
Self::ArrowRight,
Self::Undo,
Self::Redo,
Self::SelectAll,
Self::MouseBack,
Self::MouseForward,
Self::NewTab,
Self::CloseTab,
Self::ReopenTab,
Self::NextTab,
Self::PreviousTab,
Self::Reload,
Self::PreviousDesktop,
Self::NextDesktop,
Self::PreviousTrack,
Self::NextTrack,
Self::VolumeDown,
Self::Mute,
Self::ScrollLeft,
Self::ScrollRight,
Self::Folder,
Self::File,
Self::Globe,
Self::Terminal,
Self::Settings,
Self::Star,
Self::Heart,
Self::Calendar,
Self::Bell,
Self::User,
Self::Palette,
Self::Book,
Self::Ban,
];
#[must_use]
pub fn for_action(action: &Action) -> Self {
match action {
Action::None => Self::Ban,
Action::LeftClick | Action::RightClick => Self::Pointer,
Action::MiddleClick => Self::Mouse,
Action::MouseBack => Self::MouseBack,
Action::MouseForward => Self::MouseForward,
Action::Copy => Self::Copy,
Action::Paste => Self::Paste,
Action::Cut => Self::Cut,
Action::Undo => Self::Undo,
Action::Redo => Self::Redo,
Action::SelectAll => Self::SelectAll,
Action::Find => Self::Search,
Action::Save => Self::Save,
Action::BrowserBack => Self::ArrowLeft,
Action::BrowserForward => Self::ArrowRight,
Action::NewTab => Self::NewTab,
Action::CloseTab => Self::CloseTab,
Action::ReopenTab => Self::ReopenTab,
Action::NextTab => Self::NextTab,
Action::PrevTab => Self::PreviousTab,
Action::ReloadPage => Self::Reload,
Action::MissionControl | Action::ShowActionsRing => Self::Grid,
Action::AppExpose => Self::Layers,
Action::PreviousDesktop => Self::PreviousDesktop,
Action::NextDesktop => Self::NextDesktop,
Action::ShowDesktop | Action::Sleep => Self::Monitor,
Action::LaunchpadShow | Action::OpenApplication(_) => Self::Applications,
Action::LockScreen => Self::Lock,
Action::Screenshot | Action::CaptureRegion => Self::Camera,
Action::PlayPause => Self::Play,
Action::NextTrack => Self::NextTrack,
Action::PrevTrack => Self::PreviousTrack,
Action::VolumeUp => Self::Volume,
Action::VolumeDown => Self::VolumeDown,
Action::MuteVolume => Self::Mute,
Action::CycleDpiPresets | Action::SetDpiPreset(_) => Self::Gauge,
Action::ToggleSmartShift => Self::Refresh,
Action::ScrollUp => Self::ArrowUp,
Action::ScrollDown => Self::ArrowDown,
Action::HorizontalScrollLeft => Self::ScrollLeft,
Action::HorizontalScrollRight => Self::ScrollRight,
Action::CustomShortcut(_) | Action::TypeText(_) | Action::Workflow(_) => Self::Keyboard,
Action::RunAppleScript(_) | Action::RunShellCommand(_) => Self::Terminal,
}
}
#[must_use]
pub fn label(self) -> &'static str {
match self {
Self::Pointer => "Left Click",
Self::Mouse => "Middle Click",
Self::Copy => "Copy",
Self::Paste => "Paste",
Self::Cut => "Cut",
Self::Search => "Find",
Self::Save => "Save",
Self::Keyboard => "Custom shortcut",
Self::Applications => "Open application or folder",
Self::Grid => "Actions Ring",
Self::Layers => "App Exposé",
Self::Monitor => "Show Desktop",
Self::Lock => "Lock Screen",
Self::Camera => "Screenshot",
Self::Play => "Play / Pause",
Self::Volume => "Volume Up",
Self::Gauge => "Cycle DPI Presets",
Self::Refresh => "Toggle SmartShift",
Self::ArrowUp => "Scroll Up",
Self::ArrowDown => "Scroll Down",
Self::ArrowLeft | Self::ScrollLeft => "Scroll Left",
Self::ArrowRight | Self::ScrollRight => "Scroll Right",
Self::Undo => "Undo",
Self::Redo => "Redo",
Self::SelectAll => "Select All",
Self::MouseBack => "Back (Button 4)",
Self::MouseForward => "Forward (Button 5)",
Self::NewTab => "New Tab",
Self::CloseTab => "Close Tab",
Self::ReopenTab => "Reopen Tab",
Self::NextTab => "Next Tab",
Self::PreviousTab => "Previous Tab",
Self::Reload => "Reload Page",
Self::PreviousDesktop => "Previous Desktop",
Self::NextDesktop => "Next Desktop",
Self::PreviousTrack => "Previous Track",
Self::NextTrack => "Next Track",
Self::VolumeDown => "Volume Down",
Self::Mute => "Mute",
Self::Folder => "Folder",
Self::File => "File",
Self::Globe => "Globe",
Self::Terminal => "Terminal",
Self::Settings => "Settings",
Self::Star => "Star",
Self::Heart => "Heart",
Self::Calendar => "Calendar",
Self::Bell => "Bell",
Self::User => "User",
Self::Palette => "Palette",
Self::Book => "Book",
Self::Ban => "Do Nothing",
}
}
}