From 6c3f7442b92f2fbf2308d93ece448cf3dd759a58 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Fri, 7 Nov 2025 11:49:27 +0530 Subject: Add custom commands --- lib/Daffm/Types.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/Daffm/Types.hs') diff --git a/lib/Daffm/Types.hs b/lib/Daffm/Types.hs index d9dd977..15c284b 100644 --- a/lib/Daffm/Types.hs +++ b/lib/Daffm/Types.hs @@ -40,6 +40,7 @@ data FocusTarget = FocusCmdline | FocusMain deriving (Show, Eq, Ord) data AppState = AppState { stateCmdlineEditor :: CmdlineEditor, stateCwd :: FilePathText, + stateCustomCommands :: Map.Map Text.Text Command, stateFileSelections :: Set.Set FilePathText, stateFiles :: L.List FocusTarget FileInfo, stateFocusTarget :: FocusTarget, @@ -53,6 +54,8 @@ data AppState = AppState } deriving (Show) +type CustomArgs = Text.Text + type AppEvent = EventM FocusTarget AppState type CmdlineEditor = Editor.Editor Text.Text FocusTarget @@ -81,6 +84,7 @@ data Command | CmdSearchNext Int | CmdKeymapSet [Key] Command | CmdMove MoveInc + | CmdCustom Text.Text CustomArgs | CmdNoop deriving (Show, Eq) @@ -94,7 +98,7 @@ data Configuration = Configuration { configKeymap :: !Keymap, configOpener :: !(Maybe Text.Text), configExtend :: !(Maybe Text.Text), - configTheme :: !(Map.Map Text.Text Text.Text) + configCommands :: !(Map.Map Text.Text Command) } deriving (Show) @@ -103,7 +107,7 @@ instance Semigroup Configuration where a { configKeymap = configKeymap a <> configKeymap b, configOpener = configOpener a <|> configOpener b, - configTheme = configTheme a <> configTheme b + configCommands = configCommands a <> configCommands b } data Args = Args -- cgit v1.3.1