aboutsummaryrefslogtreecommitdiff
path: root/lib/Daffm/Types.hs
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-11-07 11:49:27 +0530
committerAkshay Nair <phenax5@gmail.com>2025-11-07 11:49:27 +0530
commit6c3f7442b92f2fbf2308d93ece448cf3dd759a58 (patch)
treef05287259e7da168355fa3798e80079f6dda1087 /lib/Daffm/Types.hs
parent0e4a7e45357e6024586b6042c1f4c173926a2ace (diff)
downloaddaffm-6c3f7442b92f2fbf2308d93ece448cf3dd759a58.tar.gz
daffm-6c3f7442b92f2fbf2308d93ece448cf3dd759a58.zip
Add custom commands
Diffstat (limited to 'lib/Daffm/Types.hs')
-rw-r--r--lib/Daffm/Types.hs8
1 files changed, 6 insertions, 2 deletions
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