Skip to content
Merged
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
54 changes: 52 additions & 2 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::collections::HashMap;

use crate::app::apps::{App, AppCommand, ICNS_ICON};
use crate::commands::Function;
use crate::config::{Config, MainPage, Shelly};
use crate::config::{Config, MainPage, Shelly, ThemeMode};
use crate::debounce::DebouncePolicy;
use crate::platform::macos::launching::Shortcut;
use crate::utils::icns_data_to_handle;
Expand Down Expand Up @@ -41,6 +41,51 @@ pub enum Page {
Settings,
}

/// The settings panel tabs
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum SettingsTab {
General,
Appearance,
Commands,
}

/// Actions that open a native file dialog
#[derive(Debug, Clone)]
pub enum FileDialogAction {
PickModeFile(String),
EditSearchDir(String),
AddSearchDir,
}

/// Config fields that can be individually reset to default
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum ResetField {
ToggleHotkey,
ClipboardHotkey,
Placeholder,
SearchUrl,
DebounceDelay,
StartAtLogin,
AutoUpdate,
HapticFeedback,
ShowMenubarIcon,
ClipboardHistory,
MainPage,
ShowScrollbar,
ClearOnHide,
ClearOnEnter,
ShowIcons,
Font,
EventDuration,
TextColor,
BackgroundColor,
ThemeMode,
Aliases,
Modes,
SearchDirs,
ShellCommands,
}

impl std::fmt::Display for Page {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(match self.to_owned() {
Expand Down Expand Up @@ -98,8 +143,11 @@ pub enum Message {
RunFunction(Function),
OpenFocused,
SetConfig(SetConfigFields),
OpenFileDialogue(String),
OpenFileDialog(FileDialogAction),
FileDialogResult(Option<Box<Message>>),
ReturnFocus,
SwitchSettingsTab(SettingsTab),
ResetField(ResetField),
EscKeyPressed(Id),
UpdateEvents,
ClearSearchResults,
Expand All @@ -119,6 +167,7 @@ pub enum Message {
SetFileSearchSender(tokio::sync::watch::Sender<(String, Vec<String>)>),
DebouncedSearch(Id),
CheckEventTap,
ThemeModeChanged(bool),
}

#[derive(Debug, Clone)]
Expand Down Expand Up @@ -151,6 +200,7 @@ pub enum SetConfigThemeFields {
BackgroundColor(f32, f32, f32),
ShowIcons(bool),
Font(String),
ThemeMode(ThemeMode),
}

#[derive(Debug, Clone)]
Expand Down
Loading
Loading