-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Terminal emulator configurable in Haskell
--   
--   Termonad is a terminal emulator configurable in Haskell. It is
--   extremely customizable and provides hooks to modify the default
--   behavior. It can be thought of as the "XMonad" of terminal emulators.
--   Termonad was featured on an episode of DistroTube. This
--   video gives a short overview of Termonad.
--   
--   Please see README.md for more information.
@package termonad
@version 4.5.0.0

module Termonad.Pcre
pcre2Multiline :: CUInt
inline_c_ffi_6989586621679088752 :: IO CUInt

module Termonad.Prelude

-- | & is a reverse application operator. This provides
--   notational convenience. Its precedence is one higher than that of the
--   forward application operator $, which allows & to be
--   nested in $.
--   
--   This is a version of flip id, where id
--   is specialized from a -> a to (a -> b) -> (a
--   -> b) which by the associativity of (->) is (a
--   -> b) -> a -> b. flipping this yields a -> (a
--   -> b) -> b which is the type signature of &
--   
--   
Examples
--   
--   
--   >>> 5 & (+1) & show
--   "6"
--   
--   
--   
--   >>> sqrt $ [1 / n^2 | n <- [1..1000]] & sum & (*6)
--   3.1406380562059946
--   
(&) :: a -> (a -> b) -> b
infixl 1 &

-- | The parameterizable maybe monad, obtained by composing an arbitrary
--   monad with the Maybe monad.
--   
--   Computations are actions that may produce a value or exit.
--   
--   The return function yields a computation that produces that
--   value, while >>= sequences two subcomputations, exiting
--   if either computation does.
newtype MaybeT (m :: Type -> Type) a
MaybeT :: m (Maybe a) -> MaybeT (m :: Type -> Type) a
[runMaybeT] :: MaybeT (m :: Type -> Type) a -> m (Maybe a)
hPutStrLn :: MonadIO m => Handle -> Text -> m ()
whenJust :: Monoid m => Maybe a -> (a -> m) -> m

-- | This module contains two things:
--   
--   
--   
- Extension functions to libraries like GTK. These functions wrap up
--   some generic GTK functionality. They are not Termonad-specific.
--   
- Wrappers around functionality that is only specific to certain
--   versions of libraries like GTK or VTE.
--   
--   
--   For instance, terminalSetEnableSixelIfExists is a wrapper
--   around terminalSetEnableSixel. Sixel support is only availble
--   in vte >= 0.63, so if a user tries to compile Termonad with a
--   version of vte less than 0.63, this function won't do anything.
module Termonad.Gtk
objFromBuildUnsafe :: GObject o => Builder -> Text -> (ManagedPtr o -> o) -> IO o

-- | Unsafely creates a new Application. This calls fail if
--   it cannot create the Application for some reason.
--   
--   This can fail for different reasons, one of which being that
--   application name does not have a period in it.
appNew :: (HasCallStack, MonadIO m, MonadFail m) => Maybe Text -> [ApplicationFlags] -> m Application

-- | Tests to see if two GTK widgets point to the same thing. This should
--   only happen if they are actually the same thing.
widgetEq :: (MonadIO m, IsWidget a, IsWidget b) => a -> b -> m Bool

-- | Wrapper around terminalSetEnableSixel. The
--   terminalSetEnableSixel function is only available starting
--   with vte-0.63. This function has no effect when compiling against
--   previous versions of vte.
terminalSetEnableSixelIfExists :: (HasCallStack, MonadIO m, IsTerminal t) => t -> Bool -> m ()

module Termonad.Types

-- | A wrapper around a VTE Terminal. This also stores the process
--   ID of the process running on this terminal, as well as a Unique
--   that can be used for comparing terminals.
data TMTerm
TMTerm :: !Terminal -> !Int -> !Unique -> TMTerm

-- | The actual Terminal.
[term] :: TMTerm -> !Terminal

-- | The process ID of the process running in term.
[pid] :: TMTerm -> !Int

-- | A Unique for comparing different TMTerm for uniqueness.
[unique] :: TMTerm -> !Unique

-- | A container that holds everything in a given terminal window. The
--   term in the TMTerm is inside the
--   tmNotebookTabTermContainer ScrolledWindow. The notebook
--   tab Label is also available.
data TMNotebookTab
TMNotebookTab :: !ScrolledWindow -> !TMTerm -> !Label -> TMNotebookTab

-- | The ScrolledWindow holding the VTE Terminal.
[tmNotebookTabTermContainer] :: TMNotebookTab -> !ScrolledWindow

-- | The Terminal insidie the ScrolledWindow.
[tmNotebookTabTerm] :: TMNotebookTab -> !TMTerm

-- | The Label holding the title of the Terminal in the
--   Notebook tab.
[tmNotebookTabLabel] :: TMNotebookTab -> !Label

-- | This holds the GTK Notebook containing multiple tabs of
--   Terminals. We keep a separate list of terminals in
--   tmNotebookTabs.
data TMNotebook
TMNotebook :: !Notebook -> !FocusList TMNotebookTab -> TMNotebook

-- | This is the GTK Notebook that holds multiple tabs of
--   Terminals.
[tmNotebook] :: TMNotebook -> !Notebook

-- | A FocusList containing references to each individual
--   TMNotebookTab.
[tmNotebookTabs] :: TMNotebook -> !FocusList TMNotebookTab
data TMState'
TMState :: !Application -> !ApplicationWindow -> !TMNotebook -> !FontDescription -> !TMConfig -> TMState'
[tmStateApp] :: TMState' -> !Application
[tmStateAppWin] :: TMState' -> !ApplicationWindow
[tmStateNotebook] :: TMState' -> !TMNotebook
[tmStateFontDesc] :: TMState' -> !FontDescription
[tmStateConfig] :: TMState' -> !TMConfig
type TMState = MVar TMState'
createTMTerm :: Terminal -> Int -> Unique -> TMTerm
newTMTerm :: Terminal -> Int -> IO TMTerm
getFocusedTermFromState :: TMState -> IO (Maybe Terminal)
createTMNotebookTab :: Label -> ScrolledWindow -> TMTerm -> TMNotebookTab
createTMNotebook :: Notebook -> FocusList TMNotebookTab -> TMNotebook
createEmptyTMNotebook :: Notebook -> TMNotebook
notebookToList :: Notebook -> IO [Widget]
newTMState :: TMConfig -> Application -> ApplicationWindow -> TMNotebook -> FontDescription -> IO TMState
newEmptyTMState :: TMConfig -> Application -> ApplicationWindow -> Notebook -> FontDescription -> IO TMState
newTMStateSingleTerm :: TMConfig -> Application -> ApplicationWindow -> Notebook -> Label -> ScrolledWindow -> Terminal -> Int -> FontDescription -> IO TMState
traceShowMTMState :: TMState -> IO ()

-- | The font size for the Termonad terminal. There are two ways to set the
--   fontsize, corresponding to the two different ways to set the font size
--   in the Pango font rendering library.
--   
--   If you're not sure which to use, try FontSizePoints first and
--   see how it looks. It should generally correspond to font sizes you are
--   used to from other applications.
data FontSize

-- | This sets the font size based on "points". The conversion between a
--   point and an actual size depends on the system configuration and the
--   output device. The function fontDescriptionSetSize is used to
--   set the font size. See the documentation for that function for more
--   info.
FontSizePoints :: Int -> FontSize

-- | This sets the font size based on "device units". In general, this can
--   be thought of as one pixel. The function
--   fontDescriptionSetAbsoluteSize is used to set the font size.
--   See the documentation for that function for more info.
FontSizeUnits :: Double -> FontSize

-- | The default FontSize used if not specified.
--   
--   
--   >>> defaultFontSize
--   FontSizePoints 12
--   
defaultFontSize :: FontSize

-- | Modify a FontSize by adding some value.
--   
--   
--   >>> modFontSize 1 (FontSizePoints 13)
--   FontSizePoints 14
--   
--   >>> modFontSize 1 (FontSizeUnits 9.0)
--   FontSizeUnits 10.0
--   
--   
--   You can reduce the font size by passing a negative value.
--   
--   
--   >>> modFontSize (-2) (FontSizePoints 13)
--   FontSizePoints 11
--   
--   
--   If you try to create a font size less than 1, then the old font size
--   will be used.
--   
--   
--   >>> modFontSize (-10) (FontSizePoints 5)
--   FontSizePoints 5
--   
--   >>> modFontSize (-1) (FontSizeUnits 1.0)
--   FontSizeUnits 1.0
--   
modFontSize :: Int -> FontSize -> FontSize

-- | Settings for the font to be used in Termonad.
data FontConfig
FontConfig :: !Text -> !FontSize -> FontConfig

-- | The font family to use. Example: "DejaVu Sans Mono" or
--   "Source Code Pro"
[fontFamily] :: FontConfig -> !Text

-- | The font size.
[fontSize] :: FontConfig -> !FontSize

-- | The default FontConfig to use if not specified.
--   
--   
--   >>> defaultFontConfig == FontConfig {fontFamily = "Monospace", fontSize = defaultFontSize}
--   True
--   
defaultFontConfig :: FontConfig

-- | This data type represents an option that can either be Set or
--   Unset.
--   
--   This data type is used in situations where leaving an option unset
--   results in a special state that is not representable by setting any
--   specific value.
--   
--   Examples of this include the cursorFgColour and
--   cursorBgColour options supplied by the ColourConfig
--   ConfigExtension. By default, cursorFgColour and
--   cursorBgColour are both Unset. However, when
--   cursorBgColour is Set, cursorFgColour
--   defaults to the color of the text underneath. There is no way to
--   represent this by setting cursorFgColour.
data Option a
Unset :: Option a
Set :: !a -> Option a

-- | Run a function over the value contained in an Option. Return
--   mempty when Option is Unset.
--   
--   
--   >>> whenSet (Set [1,2,3]) (++ [4,5,6]) :: [Int]
--   [1,2,3,4,5,6]
--   
--   >>> whenSet Unset (++ [4,5,6]) :: [Int]
--   []
--   
whenSet :: Monoid m => Option a -> (a -> m) -> m

-- | Whether or not to show the scroll bar in a terminal.
data ShowScrollbar

-- | Never show the scroll bar, even if there are too many lines on the
--   terminal to show all at once. You should still be able to scroll with
--   the mouse wheel.
ShowScrollbarNever :: ShowScrollbar

-- | Always show the scrollbar, even if it is not needed.
ShowScrollbarAlways :: ShowScrollbar

-- | Only show the scrollbar if there are too many lines on the terminal to
--   show all at once.
ShowScrollbarIfNeeded :: ShowScrollbar

-- | Whether or not to show the tab bar for switching tabs.
data ShowTabBar

-- | Never show the tab bar, even if there are multiple tabs open. This may
--   be confusing if you plan on using multiple tabs.
ShowTabBarNever :: ShowTabBar

-- | Always show the tab bar, even if you only have one tab open.
ShowTabBarAlways :: ShowTabBar

-- | Only show the tab bar if you have multiple tabs open.
ShowTabBarIfNeeded :: ShowTabBar

-- | Configuration options for Termonad.
--   
--   See defaultConfigOptions for the default values.
data ConfigOptions
ConfigOptions :: !FontConfig -> !ShowScrollbar -> !Integer -> !Bool -> !Text -> !Bool -> !ShowTabBar -> !CursorBlinkMode -> !Bool -> !Bool -> !Bool -> ConfigOptions

-- | Specific options for fonts.
[fontConfig] :: ConfigOptions -> !FontConfig

-- | When to show the scroll bar.
[showScrollbar] :: ConfigOptions -> !ShowScrollbar

-- | The number of lines to keep in the scroll back history for each
--   terminal.
[scrollbackLen] :: ConfigOptions -> !Integer

-- | Whether or not to ask you for confirmation when closing individual
--   terminals or Termonad itself. It is generally safer to keep this as
--   True.
[confirmExit] :: ConfigOptions -> !Bool

-- | When double-clicking on text in the terminal with the mouse, Termonad
--   will use this value to determine what to highlight. The individual
--   characters in this list will be counted as part of a word.
--   
--   For instance if wordCharExceptions is "", then when
--   you double-click on the text http://, only the http
--   portion will be highlighted. If wordCharExceptions is
--   ":", then the http: portion will be highlighted.
[wordCharExceptions] :: ConfigOptions -> !Text

-- | Whether or not to show the File Edit etc menu.
[showMenu] :: ConfigOptions -> !Bool

-- | When to show the tab bar.
[showTabBar] :: ConfigOptions -> !ShowTabBar

-- | How to handle cursor blink.
[cursorBlinkMode] :: ConfigOptions -> !CursorBlinkMode

-- | This option controls whether or not to force bold text to use colors
--   from the ExtendedPalatte.
--   
--   If True, then colored bold text will always use colors
--   from the ExtendedPalatte. There will be no way to print bold
--   text colored with the BasicPalatte.
--   
--   This often isn't a big problem, since many TUI applications use bold
--   in combination with colors from the ExtendedPalatte. Also, the
--   VTE default blue color can be difficult to read with a dark
--   background, and enabling this can work around the problem. See
--   https://github.com/cdepillabout/termonad/issues/177 for more
--   information.
--   
--   If False, then bold can be applied separately to colors from
--   both the BasicPalatte and ExtendedPalatte.
[boldIsBright] :: ConfigOptions -> !Bool

-- | Enable SIXEL to draw graphics in a terminal.
--   
--   In order for this option to do anything, you need to be using a
--   version of VTE >= 0.63, and compile VTE with SIXEL support.
--   
--   Note that even if you do the above, there may still be some problems
--   with SIXEL support in VTE. Follow
--   https://gitlab.gnome.org/GNOME/vte/-/issues/253 for more
--   information.
[enableSixel] :: ConfigOptions -> !Bool

-- | Allow terminal to use bold text.
--   
--   You may want to disable this, for instance, if you use a font that
--   doesn't look good when bold.
[allowBold] :: ConfigOptions -> !Bool

-- | The default ConfigOptions.
--   
--   
--   >>> :{
--     let defConfOpt =
--           ConfigOptions
--             { fontConfig = defaultFontConfig
--             , showScrollbar = ShowScrollbarIfNeeded
--             , scrollbackLen = 10000
--             , confirmExit = True
--             , wordCharExceptions = "-#%&+,./=?@\\_~\183:"
--             , showMenu = True
--             , showTabBar = ShowTabBarIfNeeded
--             , cursorBlinkMode = CursorBlinkModeOn
--             , boldIsBright = False
--             , enableSixel = False
--             , allowBold = True
--             }
--     in defaultConfigOptions == defConfOpt
--   :}
--   True
--   
defaultConfigOptions :: ConfigOptions

-- | The Termonad ConfigOptions along with the ConfigHooks.
data TMConfig
TMConfig :: !ConfigOptions -> !ConfigHooks -> TMConfig
[options] :: TMConfig -> !ConfigOptions
[hooks] :: TMConfig -> !ConfigHooks

-- | The default TMConfig.
--   
--   options is defaultConfigOptions and hooks is
--   defaultConfigHooks.
defaultTMConfig :: TMConfig

-- | Hooks into certain termonad operations and VTE events. Used to modify
--   termonad's behaviour in order to implement new functionality. Fields
--   should have sane Semigroup and Monoid instances so
--   that config extensions can be combined uniformly and new hooks can be
--   added without incident.
newtype ConfigHooks
ConfigHooks :: (TMState -> Terminal -> IO ()) -> ConfigHooks

-- | Produce an IO action to run on creation of new Terminal,
--   given TMState and the Terminal in question.
[createTermHook] :: ConfigHooks -> TMState -> Terminal -> IO ()

-- | Default values for the ConfigHooks.
--   
--   
--   
- The default function for createTermHook is
--   defaultCreateTermHook.
--   
defaultConfigHooks :: ConfigHooks

-- | Default value for createTermHook. Does nothing.
defaultCreateTermHook :: TMState -> Terminal -> IO ()
data FocusNotSameErr
FocusListFocusExistsButNoNotebookTabWidget :: FocusNotSameErr
NotebookTabWidgetDiffersFromFocusListFocus :: FocusNotSameErr
NotebookTabWidgetExistsButNoFocusListFocus :: FocusNotSameErr
data TabsDoNotMatch

-- | The first Int is the number of tabs in the actual GTK
--   Notebook. The second Int is the number of tabs in the
--   FocusList.
TabLengthsDifferent :: Int -> Int -> TabsDoNotMatch

-- | The tab at index Int is different between the actual GTK
--   Notebook and the FocusList.
TabAtIndexDifferent :: Int -> TabsDoNotMatch
data TMStateInvariantErr
FocusNotSame :: FocusNotSameErr -> Int -> TMStateInvariantErr
TabsDoNotMatch :: TabsDoNotMatch -> TMStateInvariantErr

-- | Gather up the invariants for TMState and return them as a list.
--   
--   If no invariants have been violated, then this function should return
--   an empty list.
invariantTMState' :: TMState' -> IO [TMStateInvariantErr]

-- | Check the invariants for TMState, and call fail if we
--   find that they have been violated.
assertInvariantTMState :: TMState -> IO ()
pPrintTMState :: TMState -> IO ()
instance GHC.Internal.Enum.Enum Termonad.Types.ShowScrollbar
instance GHC.Internal.Enum.Enum Termonad.Types.ShowTabBar
instance GHC.Classes.Eq Termonad.Types.ConfigOptions
instance GHC.Classes.Eq Termonad.Types.FontConfig
instance GHC.Classes.Eq Termonad.Types.FontSize
instance GHC.Classes.Eq a => GHC.Classes.Eq (Termonad.Types.Option a)
instance GHC.Classes.Eq Termonad.Types.ShowScrollbar
instance GHC.Classes.Eq Termonad.Types.ShowTabBar
instance GHC.Classes.Eq Termonad.Types.TMNotebookTab
instance GHC.Classes.Eq Termonad.Types.TMTerm
instance GHC.Internal.Data.Foldable.Foldable Termonad.Types.Option
instance Data.Aeson.Types.FromJSON.FromJSON Termonad.Types.ConfigOptions
instance Data.Aeson.Types.FromJSON.FromJSON GI.Vte.Enums.CursorBlinkMode
instance Data.Aeson.Types.FromJSON.FromJSON Termonad.Types.FontConfig
instance Data.Aeson.Types.FromJSON.FromJSON Termonad.Types.FontSize
instance Data.Aeson.Types.FromJSON.FromJSON Termonad.Types.ShowScrollbar
instance Data.Aeson.Types.FromJSON.FromJSON Termonad.Types.ShowTabBar
instance GHC.Internal.Base.Functor Termonad.Types.Option
instance GHC.Internal.Generics.Generic Termonad.Types.ConfigOptions
instance GHC.Internal.Generics.Generic Termonad.Types.FontConfig
instance GHC.Internal.Generics.Generic Termonad.Types.FontSize
instance GHC.Internal.Generics.Generic Termonad.Types.ShowScrollbar
instance GHC.Internal.Generics.Generic Termonad.Types.ShowTabBar
instance GHC.Classes.Ord a => GHC.Classes.Ord (Termonad.Types.Option a)
instance GHC.Internal.Read.Read a => GHC.Internal.Read.Read (Termonad.Types.Option a)
instance GHC.Internal.Show.Show Termonad.Types.ConfigHooks
instance GHC.Internal.Show.Show Termonad.Types.ConfigOptions
instance GHC.Internal.Show.Show Termonad.Types.FocusNotSameErr
instance GHC.Internal.Show.Show Termonad.Types.FontConfig
instance GHC.Internal.Show.Show Termonad.Types.FontSize
instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Termonad.Types.Option a)
instance GHC.Internal.Show.Show Termonad.Types.ShowScrollbar
instance GHC.Internal.Show.Show Termonad.Types.ShowTabBar
instance GHC.Internal.Show.Show Termonad.Types.TMConfig
instance GHC.Internal.Show.Show Termonad.Types.TMNotebook
instance GHC.Internal.Show.Show Termonad.Types.TMNotebookTab
instance GHC.Internal.Show.Show Termonad.Types.TMState'
instance GHC.Internal.Show.Show Termonad.Types.TMStateInvariantErr
instance GHC.Internal.Show.Show Termonad.Types.TMTerm
instance GHC.Internal.Show.Show Termonad.Types.TabsDoNotMatch
instance Data.Aeson.Types.ToJSON.ToJSON Termonad.Types.ConfigOptions
instance Data.Aeson.Types.ToJSON.ToJSON GI.Vte.Enums.CursorBlinkMode
instance Data.Aeson.Types.ToJSON.ToJSON Termonad.Types.FontConfig
instance Data.Aeson.Types.ToJSON.ToJSON Termonad.Types.FontSize
instance Data.Aeson.Types.ToJSON.ToJSON Termonad.Types.ShowScrollbar
instance Data.Aeson.Types.ToJSON.ToJSON Termonad.Types.ShowTabBar

module Termonad.PreferencesFile

-- | Get the path to the preferences file
--   ~/.config/termonad/termonad.yaml.
getPreferencesFile :: IO FilePath

-- | Read the configuration for the preferences file
--   ~/.config/termonad/termonad.yaml. This file stores only the
--   options of TMConfig so hooks are initialized with
--   defaultConfigHooks. If the file doesn't exist, create it with
--   the default values.
--   
--   Any options that do not exist will get initialized with values from
--   defaultConfigOptions.
tmConfigFromPreferencesFile :: IO TMConfig

-- | Read the ConfigOptions out of a configuration file.
--   
--   Merge the raw ConfigOptions with defaultConfigOptions.
--   This makes sure that old versions of the configuration file will still
--   be able to be read even if new options are added to
--   ConfigOptions in new versions of Termonad.
readFileWithDefaults :: FilePath -> IO (Either Text ConfigOptions)

-- | Merge Values recursively.
--   
--   This merges Values recursively in Object values, taking
--   values that have been explicitly over the defaults. The defaults are
--   only used if there is no value that has been explicitly set.
--   
--   For Array, String, Number, Bool, and
--   Null, take the first Value (the one that has been
--   explicitly set in the user's config file):
--   
--   
--   >>> mergeObjVals (Array [Number 1, Number 2]) (Array [String "hello"])
--   Array [Number 1.0,Number 2.0]
--   
--   >>> mergeObjVals (String "hello") (String "bye")
--   String "hello"
--   
--   >>> mergeObjVals (Number 1) (Number 2)
--   Number 1.0
--   
--   >>> mergeObjVals (Bool True) (Bool False)
--   Bool True
--   
--   >>> mergeObjVals Null Null
--   Null
--   
--   
--   Note that Values in Arrays are not recursed into:
--   
--   
--   >>> let obj1 = object ["hello" .= Number 2]
--   
--   >>> let obj2 = object ["hello" .= String "bye"]
--   
--   >>> mergeObjVals (Array [obj1]) (Array [obj2])
--   Array [Object (fromList [("hello",Number 2.0)])]
--   
--   
--   Objects are recursed into. Unique keys from both Maps will be
--   used. Keys that are in both Maps will be merged according to the rules
--   above:
--   
--   
--   >>> let object1 = object ["hello" .= Number 1, "bye" .= Number 100]
--   
--   >>> let object2 = object ["hello" .= Number 2, "goat" .= String "chicken"]
--   
--   >>> mergeObjVals object1 object2
--   Object (fromList [("bye",Number 100.0),("goat",String "chicken"),("hello",Number 1.0)])
--   
--   
--   Values of different types will use the second Value:
--   
--   
--   >>> mergeObjVals Null (String "bye")
--   String "bye"
--   
--   >>> mergeObjVals (Bool True) (Number 2)
--   Number 2.0
--   
--   >>> mergeObjVals (Object mempty) (Bool False)
--   Bool False
--   
mergeObjVals :: Value -> Value -> Value
writePreferencesFile :: FilePath -> ConfigOptions -> IO ()

-- | Save the configuration to the preferences file
--   ~/.config/termonad/termonad.yaml
saveToPreferencesFile :: TMConfig -> IO ()

module Termonad.Lenses
lensPid :: Lens' TMTerm Int
lensTerm :: Lens' TMTerm Terminal
lensUnique :: Lens' TMTerm Unique
lensTMNotebookTabLabel :: Lens' TMNotebookTab Label
lensTMNotebookTabTerm :: Lens' TMNotebookTab TMTerm
lensTMNotebookTabTermContainer :: Lens' TMNotebookTab ScrolledWindow
lensTMNotebook :: Lens' TMNotebook Notebook
lensTMNotebookTabs :: Lens' TMNotebook (FocusList TMNotebookTab)
lensTMStateApp :: Lens' TMState' Application
lensTMStateAppWin :: Lens' TMState' ApplicationWindow
lensTMStateConfig :: Lens' TMState' TMConfig
lensTMStateFontDesc :: Lens' TMState' FontDescription
lensTMStateNotebook :: Lens' TMState' TMNotebook
_FontSizePoints :: Prism' FontSize Int
_FontSizeUnits :: Prism' FontSize Double
lensFontFamily :: Lens' FontConfig Text
lensFontSize :: Lens' FontConfig FontSize
lensAllowBold :: Lens' ConfigOptions Bool
lensBoldIsBright :: Lens' ConfigOptions Bool
lensConfirmExit :: Lens' ConfigOptions Bool
lensCursorBlinkMode :: Lens' ConfigOptions CursorBlinkMode
lensEnableSixel :: Lens' ConfigOptions Bool
lensFontConfig :: Lens' ConfigOptions FontConfig
lensScrollbackLen :: Lens' ConfigOptions Integer
lensShowMenu :: Lens' ConfigOptions Bool
lensShowScrollbar :: Lens' ConfigOptions ShowScrollbar
lensShowTabBar :: Lens' ConfigOptions ShowTabBar
lensWordCharExceptions :: Lens' ConfigOptions Text
lensCreateTermHook :: Iso' ConfigHooks (TMState -> Terminal -> IO ())
lensHooks :: Lens' TMConfig ConfigHooks
lensOptions :: Lens' TMConfig ConfigOptions

module Termonad.Term
focusTerm :: Int -> TMState -> IO ()
altNumSwitchTerm :: Int -> TMState -> IO ()
termNextPage :: TMState -> IO ()
termPrevPage :: TMState -> IO ()
termExitFocused :: TMState -> IO ()
termClose :: TMNotebookTab -> TMState -> IO ()
termExitWithConfirmation :: TMNotebookTab -> TMState -> IO ()
termExit :: TMNotebookTab -> TMState -> IO ()
relabelTabs :: TMState -> IO ()

-- | Compute the text for a Label for a GTK Notebook tab.
--   
--   
--   >>> computeTabLabel 0 (Just "me@machine:~")
--   "1. me@machine:~"
--   
--   
--   
--   >>> computeTabLabel 5 (Just "bash process")
--   "6. bash process"
--   
--   
--   
--   >>> computeTabLabel 2 Nothing
--   "3. shell"
--   
computeTabLabel :: Int -> Maybe Text -> Text

-- | Update the given Label for a GTK Notebook tab.
--   
--   The new text for the label is determined by the computeTabLabel
--   function.
relabelTab :: Notebook -> Label -> ScrolledWindow -> Terminal -> IO ()
showScrollbarToPolicy :: ShowScrollbar -> PolicyType
createScrolledWin :: TMState -> IO ScrolledWindow
createNotebookTabLabel :: IO (Box, Label, Button)
setShowTabs :: TMConfig -> Notebook -> IO ()
toRGBA :: Colour Double -> IO RGBA

-- | TODO: This should probably be implemented in an external package,
--   since it is a generally useful utility.
--   
--   It should also be implemented for windows and osx.
cwdOfPid :: Int -> IO (Maybe Text)

-- | Get the current working directory from the shell in the focused tab of
--   a notebook.
--   
--   Returns Nothing if there is no focused tab of the notebook, or
--   the current working directory could not be detected for the shell.
getCWDFromFocusedTab :: TMNotebook -> IO (Maybe Text)

-- | Create the VTE Terminal, set the fonts and options
createAndInitVteTerm :: FontDescription -> ConfigOptions -> IO Terminal

-- | Starts a shell in a terminal and return a new TMTerm
launchShell :: Terminal -> Maybe Text -> IO Int

-- | Add a page to the notebook and switch to it.
addPage :: TMState -> TMNotebookTab -> Box -> IO ()

-- | Set the keyboard focus on a vte terminal
setFocusOn :: ApplicationWindow -> Terminal -> IO ()

-- | Create a new TMTerm, setting it up and adding it to the
--   GTKNotebook.
createTerm :: (TMState -> EventKey -> IO Bool) -> TMState -> IO TMTerm

-- | Popup the context menu on right click
handleMousePress :: ApplicationWindow -> Terminal -> EventButton -> IO Bool
eventButtonToEvent :: EventButton -> Event

module Termonad.Keys
showKeys :: EventKey -> IO Bool
data Key
Key :: Word32 -> Set ModifierType -> Key
[keyVal] :: Key -> Word32
[keyMods] :: Key -> Set ModifierType
toKey :: Word32 -> Set ModifierType -> Key
keyMap :: Map Key (TMState -> IO Bool)
stopProp :: (TMState -> IO a) -> TMState -> IO Bool
removeStrangeModifiers :: Key -> Key
handleKeyPress :: TMState -> EventKey -> IO Bool
instance GHC.Classes.Eq Termonad.Keys.Key
instance GHC.Classes.Ord Termonad.Keys.Key
instance GHC.Internal.Show.Show Termonad.Keys.Key

-- | To use this config extension in your
--   ~/.config/termonad/termonad.hs, first import this module.
--   Create a new ColourExtension with the
--   createColourExtension function. Then add the
--   ColourExtension to your TMConfig with the
--   addColourExtension function.
--   
--   See this code for a simple example.
--   
--   When setting colors, you may find it convenient to use the
--   print-console-colors package, which provides an executable
--   called print-console-colors that prints all of the colors for
--   your terminal.
module Termonad.Config.Colour

-- | The configuration for the colors used by Termonad.
--   
--   foregroundColour and backgroundColour allow you to set
--   the color of the foreground text and background of the terminal.
--   
--   highlightFgColour and highlightBgColour allow you to set
--   the color of the foreground and background of the highlighted text.
--   
--   palette allows you to set the full color palette used by the
--   terminal. See Palette for more information.
--   
--   If you don't set foregroundColour, backgroundColour,
--   highlightFgColour, highlightBgColour, or palette,
--   the defaults from VTE are used.
--   
--   If you want to use a terminal with a white (or light) background and a
--   black foreground, it may be a good idea to change some of the colors
--   in the Palette as well.
--   
--   VTE works as follows: if you don't explicitly set a background or
--   foreground color, it takes the 0th colour from the palette to
--   be the background color, and the 7th colour from the palette to
--   be the foreground color. If you notice oddities with colouring in
--   certain applications, it may be helpful to make sure that these
--   palette colours match up with the backgroundColour and
--   foregroundColour you have set.)
--   
--   cursorFgColour and cursorBgColour allow you to set the
--   foreground color of the text under the cursor, as well as the color of
--   the cursor itself.
--   
--   Termonad will behave differently depending on the combination
--   cursorFgColour and cursorBgColour being Set vs.
--   Unset. Here is the summary of the different possibilities:
--   
--   
--   
- cursorFgColour is Set and cursorBgColour is
--   SetThe foreground and background colors of the cursor are as
--   you have set.
--   
- cursorFgColour is Set and cursorBgColour is
--   UnsetThe cursor background color turns completely black so that
--   it is not visible. The foreground color of the cursor is the color
--   that you have Set. This ends up being mostly unusable, so you
--   are recommended to always Set cursorBgColour when you
--   have Set cursorFgColour.
--   
- cursorFgColour is Unset and cursorBgColour is
--   SetThe cursor background color becomes the color you
--   Set, while the cursor foreground color doesn't change from the
--   letter it is over. For instance, imagine there is a letter on the
--   screen with a black background and a green foreground. If you bring
--   the cursor overtop of it, the cursor background will be the color you
--   have Set, while the cursor foreground will be green.This is
--   completely usable, but is slightly annoying if you place the cursor
--   over a letter with the same foreground color as the cursor's
--   background color, because the letter will not be readable. For
--   instance, imagine you have set your cursor background color to red,
--   and somewhere on the screen there is a letter with a black background
--   and a red foreground. If you move your cursor over the letter, the
--   background of the cursor will be red (as you have set), and the cursor
--   foreground will be red (to match the original foreground color of the
--   letter). This will make it so you can't actually read the letter,
--   because the foreground and background are both red.
--   
- cursorFgColour is Unset and cursorBgColour is
--   UnsetThis combination makes the cursor inverse of whatever text
--   it is over. If your cursor is over red text with a black background,
--   the cursor background will be red and the cursor foreground will be
--   black.This is the default.
--   
--   
--   cursorFgColour is not supported in vte-2.91 versions
--   older than 0.44. (This is somewhat confusing. Note that
--   vte-2.91 is the name of the system library, and 0.44
--   is its version number.)
--   
--   See defaultColourConfig for the defaults for
--   ColourConfig used in Termonad.
data ColourConfig c
ColourConfig :: !Option c -> !Option c -> !Option c -> !Option c -> !Option c -> !Option c -> !Palette c -> ColourConfig c

-- | Foreground color of the cursor. This is the color of the text that the
--   cursor is over. This is not supported on older versions of VTE.
[cursorFgColour] :: ColourConfig c -> !Option c

-- | Background color of the cursor. This is the color of the cursor
--   itself.
[cursorBgColour] :: ColourConfig c -> !Option c

-- | Color of the default foreground text in the terminal.
[foregroundColour] :: ColourConfig c -> !Option c

-- | Background color for the terminal
[backgroundColour] :: ColourConfig c -> !Option c

-- | Foreground color for the highlighted text.
[highlightFgColour] :: ColourConfig c -> !Option c

-- | Background color for the highlighted text.
[highlightBgColour] :: ColourConfig c -> !Option c

-- | Color palette for the terminal. See Palette.
[palette] :: ColourConfig c -> !Palette c

-- | Default setting for a ColourConfig. The cursor colors, font
--   foreground color, background color, highlighted text color, and color
--   palette are all left at the defaults set by VTE.
--   
--   
--   >>> defaultColourConfig
--   ColourConfig {cursorFgColour = Unset, cursorBgColour = Unset, foregroundColour = Unset, backgroundColour = Unset, highlightFgColour = Unset, highlightBgColour = Unset, palette = NoPalette}
--   
defaultColourConfig :: ColourConfig (AlphaColour Double)

-- | This newtype is for length 8 lists. Construct it with mkList8
--   or unsafeMkList8
data List8 a

-- | This newtype is for length 6 lists. Construct it with mkList6
--   or unsafeMkList6
data List6 a

-- | This newtype is for length 24 lists. Construct it with mkList24
--   or unsafeMkList24
data List24 a

-- | This newtype is for 6x6x6 matrices.. Construct it with mkMatrix
--   or unsafeMkMatrix
data Matrix a

-- | Typesafe smart constructor for length 8 lists.
mkList8 :: [a] -> Maybe (List8 a)

-- | Unsafe smart constructor for length 8 lists.
unsafeMkList8 :: [a] -> List8 a

-- | Set a given value in a List8.
--   
--   Internally uses setAt. See documentation on setAt for
--   some examples.
setAtList8 :: Int -> a -> List8 a -> List8 a

-- | Set a given value in a List8.
--   
--   Internally uses overAt. See documentation on overAt for
--   some examples.
overAtList8 :: Int -> (a -> a) -> List8 a -> List8 a

-- | Typesafe smart constructor for length 6 lists.
mkList6 :: [a] -> Maybe (List6 a)

-- | Unsafe smart constructor for length 6 lists.
unsafeMkList6 :: [a] -> List6 a

-- | Set a given value in a List6.
--   
--   Internally uses setAt. See documentation on setAt for
--   some examples.
setAtList6 :: Int -> a -> List6 a -> List6 a

-- | Set a given value in a List6.
--   
--   Internally uses overAt. See documentation on overAt for
--   some examples.
overAtList6 :: Int -> (a -> a) -> List6 a -> List6 a

-- | Typesafe smart constructor for length 24 lists.
mkList24 :: [a] -> Maybe (List24 a)

-- | Unsafe smart constructor for length 24 lists.
unsafeMkList24 :: [a] -> List24 a

-- | Set a given value in a List24.
--   
--   Internally uses setAt. See documentation on setAt for
--   some examples.
setAtList24 :: Int -> a -> List24 a -> List24 a

-- | Set a given value in a List24.
--   
--   Internally uses overAt. See documentation on overAt for
--   some examples.
overAtList24 :: Int -> (a -> a) -> List24 a -> List24 a

-- | Unsafe smart constructor for 6x6x6 Matrices.
mkMatrix :: [[[a]]] -> Maybe (Matrix a)

-- | Unsafe smart constructor for 6x6x6 Matrices.
unsafeMkMatrix :: [[[a]]] -> Matrix a

-- | Set a given value in a Matrix.
--   
--   Internally uses setAt. See documentation on setAt for
--   some examples.
setAtMatrix :: Int -> Int -> Int -> a -> Matrix a -> Matrix a

-- | Set a given value in a Matrix.
--   
--   Internally uses overAt. See documentation on overAt for
--   some examples.
overAtMatrix :: Int -> Int -> Int -> (a -> a) -> Matrix a -> Matrix a
lensCursorFgColour :: forall c f. Functor f => (Option c -> f (Option c)) -> ColourConfig c -> f (ColourConfig c)
lensCursorBgColour :: forall c f. Functor f => (Option c -> f (Option c)) -> ColourConfig c -> f (ColourConfig c)
lensForegroundColour :: forall c f. Functor f => (Option c -> f (Option c)) -> ColourConfig c -> f (ColourConfig c)
lensBackgroundColour :: forall c f. Functor f => (Option c -> f (Option c)) -> ColourConfig c -> f (ColourConfig c)
lensHighlightFgColour :: forall c f. Functor f => (Option c -> f (Option c)) -> ColourConfig c -> f (ColourConfig c)
lensHighlightBgColour :: forall c f. Functor f => (Option c -> f (Option c)) -> ColourConfig c -> f (ColourConfig c)
lensPalette :: forall c f. Functor f => (Palette c -> f (Palette c)) -> ColourConfig c -> f (ColourConfig c)

-- | Extension that allows setting colors for terminals in Termonad.
data ColourExtension
ColourExtension :: MVar (ColourConfig (AlphaColour Double)) -> (TMState -> Terminal -> IO ()) -> ColourExtension

-- | MVar holding the current ColourConfig. This could
--   potentially be passed to other extensions or user code. This would
--   allow changing the colors for new terminals in realtime.
[colourExtConf] :: ColourExtension -> MVar (ColourConfig (AlphaColour Double))

-- | The createTermHook used by the ColourExtension. This
--   sets the colors for a new terminal based on the ColourConfig in
--   colourExtConf.
[colourExtCreateTermHook] :: ColourExtension -> TMState -> Terminal -> IO ()

-- | Create a ColourExtension based on a given ColourConfig.
--   
--   Most users will want to use this.
createColourExtension :: ColourConfig (AlphaColour Double) -> IO ColourExtension

-- | Create a ColourExtension based on defaultColourConfig.
--   
--   Note that this is not needed if you just want to use the default
--   colors for Termonad. However, if you want to pass around the
--   MVar ColourConfig for extensions to use, then you may
--   need this function.
createDefColourExtension :: IO ColourExtension

-- | This is similar to addColourConfig, but can be used on a
--   ColourExtension created with createColourExtension.
addColourExtension :: TMConfig -> ColourExtension -> TMConfig

-- | Add a given ColourConfig to a TMConfig. This adds
--   colourHook to the createTermHook in TMConfig.
addColourConfig :: TMConfig -> ColourConfig (AlphaColour Double) -> IO TMConfig

-- | The default createTermHook for
--   colourExtCreateTermHook. Set the colors for a terminal based on
--   the given ColourConfig.
colourHook :: MVar (ColourConfig (AlphaColour Double)) -> TMState -> Terminal -> IO ()

-- | This function shows how to combine createTermHooks.
--   
--   This first runs the old hook, followed by the new hook.
--   
--   This is used internally by addColourConfig and
--   addColourExtension.
addColourHook :: (TMState -> Terminal -> IO ()) -> (TMState -> Terminal -> IO ()) -> TMState -> Terminal -> IO ()

-- | This is the color palette to use for the terminal. Each data
--   constructor lets you set progressively more colors. These colors are
--   used by the terminal to render ANSI escape color codes.
--   
--   There are 256 total terminal colors. BasicPalette lets you set
--   the first 8, ExtendedPalette lets you set the first 16,
--   ColourCubePalette lets you set the first 232, and
--   FullPalette lets you set all 256.
--   
--   The first 8 colors codes are the standard colors. The next 8 are the
--   extended (light) colors. The next 216 are a full color cube. The last
--   24 are a grey scale.
--   
--   The following image gives an idea of what each individual color looks
--   like:
--   
--   
--   This picture does not exactly match up with Termonad's default colors,
--   but it gives an idea of what each block of colors represents.
--   
--   You can use defaultStandardColours, defaultLightColours,
--   defaultColourCube, and defaultGreyscale as a starting
--   point to customize the colors. The only time you'd need to use a
--   constructor other than NoPalette is when you want to customize
--   the default colors. That is to say, using FullPalette with all
--   the defaults should give you the same result as using
--   NoPalette.
data Palette c

-- | Don't set any colors and just use the default from VTE. This is a
--   black background with light grey text.
NoPalette :: Palette c

-- | Set the colors from the standard colors.
BasicPalette :: !List8 c -> Palette c

-- | Set the colors from the extended (light) colors (as well as standard
--   colors).
ExtendedPalette :: !List8 c -> !List8 c -> Palette c

-- | Set the colors from the color cube (as well as the standard colors and
--   extended colors).
ColourCubePalette :: !List8 c -> !List8 c -> !Matrix c -> Palette c

-- | Set the colors from the grey scale (as well as the standard colors,
--   extended colors, and color cube).
FullPalette :: !List8 c -> !List8 c -> !Matrix c -> !List24 c -> Palette c

-- | A Vec of standard colors. Default value for
--   BasicPalette.
--   
--   
--   >>> showColourVec defaultStandardColours
--   ["#000000ff","#c00000ff","#00c000ff","#c0c000ff","#0000c0ff","#c000c0ff","#00c0c0ff","#c0c0c0ff"]
--   
defaultStandardColours :: (Ord b, Floating b) => List8 (AlphaColour b)

-- | A Vec of extended (light) colors. Default value for
--   ExtendedPalette.
--   
--   
--   >>> showColourVec defaultLightColours
--   ["#3f3f3fff","#ff3f3fff","#3fff3fff","#ffff3fff","#3f3fffff","#ff3fffff","#3fffffff","#ffffffff"]
--   
defaultLightColours :: (Ord b, Floating b) => List8 (AlphaColour b)

-- | A matrix of a 6 x 6 x 6 color cube. Default value for
--   ColourCubePalette.
--   
--   
--   >>> putStrLn $ pack $ showColourCube defaultColourCube
--   [ [ #000000ff, #00005fff, #000087ff, #0000afff, #0000d7ff, #0000ffff
--     , #005f00ff, #005f5fff, #005f87ff, #005fafff, #005fd7ff, #005fffff
--     , #008700ff, #00875fff, #008787ff, #0087afff, #0087d7ff, #0087ffff
--     , #00af00ff, #00af5fff, #00af87ff, #00afafff, #00afd7ff, #00afffff
--     , #00d700ff, #00d75fff, #00d787ff, #00d7afff, #00d7d7ff, #00d7ffff
--     , #00ff00ff, #00ff5fff, #00ff87ff, #00ffafff, #00ffd7ff, #00ffffff
--     ]
--   , [ #5f0000ff, #5f005fff, #5f0087ff, #5f00afff, #5f00d7ff, #5f00ffff
--     , #5f5f00ff, #5f5f5fff, #5f5f87ff, #5f5fafff, #5f5fd7ff, #5f5fffff
--     , #5f8700ff, #5f875fff, #5f8787ff, #5f87afff, #5f87d7ff, #5f87ffff
--     , #5faf00ff, #5faf5fff, #5faf87ff, #5fafafff, #5fafd7ff, #5fafffff
--     , #5fd700ff, #5fd75fff, #5fd787ff, #5fd7afff, #5fd7d7ff, #5fd7ffff
--     , #5fff00ff, #5fff5fff, #5fff87ff, #5fffafff, #5fffd7ff, #5fffffff
--     ]
--   , [ #870000ff, #87005fff, #870087ff, #8700afff, #8700d7ff, #8700ffff
--     , #875f00ff, #875f5fff, #875f87ff, #875fafff, #875fd7ff, #875fffff
--     , #878700ff, #87875fff, #878787ff, #8787afff, #8787d7ff, #8787ffff
--     , #87af00ff, #87af5fff, #87af87ff, #87afafff, #87afd7ff, #87afffff
--     , #87d700ff, #87d75fff, #87d787ff, #87d7afff, #87d7d7ff, #87d7ffff
--     , #87ff00ff, #87ff5fff, #87ff87ff, #87ffafff, #87ffd7ff, #87ffffff
--     ]
--   , [ #af0000ff, #af005fff, #af0087ff, #af00afff, #af00d7ff, #af00ffff
--     , #af5f00ff, #af5f5fff, #af5f87ff, #af5fafff, #af5fd7ff, #af5fffff
--     , #af8700ff, #af875fff, #af8787ff, #af87afff, #af87d7ff, #af87ffff
--     , #afaf00ff, #afaf5fff, #afaf87ff, #afafafff, #afafd7ff, #afafffff
--     , #afd700ff, #afd75fff, #afd787ff, #afd7afff, #afd7d7ff, #afd7ffff
--     , #afff00ff, #afff5fff, #afff87ff, #afffafff, #afffd7ff, #afffffff
--     ]
--   , [ #d70000ff, #d7005fff, #d70087ff, #d700afff, #d700d7ff, #d700ffff
--     , #d75f00ff, #d75f5fff, #d75f87ff, #d75fafff, #d75fd7ff, #d75fffff
--     , #d78700ff, #d7875fff, #d78787ff, #d787afff, #d787d7ff, #d787ffff
--     , #d7af00ff, #d7af5fff, #d7af87ff, #d7afafff, #d7afd7ff, #d7afffff
--     , #d7d700ff, #d7d75fff, #d7d787ff, #d7d7afff, #d7d7d7ff, #d7d7ffff
--     , #d7ff00ff, #d7ff5fff, #d7ff87ff, #d7ffafff, #d7ffd7ff, #d7ffffff
--     ]
--   , [ #ff0000ff, #ff005fff, #ff0087ff, #ff00afff, #ff00d7ff, #ff00ffff
--     , #ff5f00ff, #ff5f5fff, #ff5f87ff, #ff5fafff, #ff5fd7ff, #ff5fffff
--     , #ff8700ff, #ff875fff, #ff8787ff, #ff87afff, #ff87d7ff, #ff87ffff
--     , #ffaf00ff, #ffaf5fff, #ffaf87ff, #ffafafff, #ffafd7ff, #ffafffff
--     , #ffd700ff, #ffd75fff, #ffd787ff, #ffd7afff, #ffd7d7ff, #ffd7ffff
--     , #ffff00ff, #ffff5fff, #ffff87ff, #ffffafff, #ffffd7ff, #ffffffff
--     ]
--   ]
--   
defaultColourCube :: (Ord b, Floating b) => Matrix (AlphaColour b)

-- | A List of a grey scale. Default value for FullPalette.
--   
--   
--   >>> fmap sRGB32show defaultGreyscale
--   List24 {getList24 = ["#080808ff","#121212ff","#1c1c1cff","#262626ff","#303030ff","#3a3a3aff","#444444ff","#4e4e4eff","#585858ff","#626262ff","#6c6c6cff","#767676ff","#808080ff","#8a8a8aff","#949494ff","#9e9e9eff","#a8a8a8ff","#b2b2b2ff","#bcbcbcff","#c6c6c6ff","#d0d0d0ff","#dadadaff","#e4e4e4ff","#eeeeeeff"]}
--   
defaultGreyscale :: (Ord b, Floating b) => List24 (AlphaColour b)

-- | This type represents a Colour that may be semi-transparent.
--   
--   The Monoid instance allows you to composite colours.
--   
--   
--   x `mappend` y == x `over` y
--   
--   
--   To get the (pre-multiplied) colour channel of an AlphaColour
--   c, simply composite c over black.
--   
--   
--   c `over` black
--   
data AlphaColour a

-- | Create an AlphaColour that is fully opaque.
--   
--   
--   >>> sRGB32show $ createColour 64 96 128
--   "#406080ff"
--   
--   >>> sRGB32show $ createColour 0 0 0
--   "#000000ff"
--   
--   
--   Similar to sRGB24 but for AlphaColour.
createColour :: Word8 -> Word8 -> Word8 -> AlphaColour Double

-- | Create an AlphaColour from a four Word8s.
--   
--   
--   >>> sRGB32show $ sRGB32 64 96 128 255
--   "#406080ff"
--   
--   >>> sRGB32show $ sRGB32 0x08 0x10 0x20 0x01
--   "#08102001"
--   
--   
--   Note that if you specify the alpha as 0 (which means completely
--   translucent), all the color channels will be set to 0 as well.
--   
--   
--   >>> sRGB32show $ sRGB32 100 150 200 0
--   "#00000000"
--   
--   
--   Similar to sRGB24 but also includes an alpha channel. Most
--   users will probably want to use createColour instead.
sRGB32 :: Word8 -> Word8 -> Word8 -> Word8 -> AlphaColour Double

-- | Show an AlphaColour in hex.
--   
--   
--   >>> sRGB32show (opaque red)
--   "#ff0000ff"
--   
--   
--   Similar to sRGB24show.
sRGB32show :: AlphaColour Double -> String

-- | Creates an opaque AlphaColour from a Colour.
opaque :: Num a => Colour a -> AlphaColour a

-- | This AlphaColour is entirely transparent and has no associated
--   colour channel.
transparent :: Num a => AlphaColour a

-- | A helper function for showing all the colors in Vec of
--   colors.
showColourVec :: List8 (AlphaColour Double) -> [String]

-- | Helper function for showing all the colors in a color cube. This is
--   used for debugging.
showColourCube :: Matrix (AlphaColour Double) -> String

-- | Convert a Palette to a list of colors. This is helpful for
--   debugging.
paletteToList :: Palette c -> [c]

-- | Create a vector of colors based on input bits.
--   
--   This is used to derive defaultStandardColours and
--   defaultLightColours.
--   
--   
--   >>> coloursFromBits 192 0 == defaultStandardColours
--   True
--   
--   
--   
--   >>> coloursFromBits 192 63 == defaultLightColours
--   True
--   
--   
--   In general, as an end-user, you shouldn't need to use this.
coloursFromBits :: (Ord b, Floating b) => Word8 -> Word8 -> List8 (AlphaColour b)

-- | Specify a colour cube with one colour vector for its displacement and
--   three colour vectors for its edges. Produces a uniform 6x6x6 grid
--   bounded by and orthognal to the faces.
cube :: Fractional b => AlphaColour b -> AlphaColour b -> AlphaColour b -> AlphaColour b -> Matrix (AlphaColour b)

-- | Set a given value in a list.
--   
--   
--   >>> setAt 2 "hello" ["a","b","c","d"]
--   ["a","b","hello","d"]
--   
--   
--   You can set the first and last values in the list as well:
--   
--   
--   >>> setAt 0 "hello" ["a","b","c","d"]
--   ["hello","b","c","d"]
--   
--   >>> setAt 3 "hello" ["a","b","c","d"]
--   ["a","b","c","hello"]
--   
--   
--   If you try to set a value outside of the list, you'll get back the
--   same list:
--   
--   
--   >>> setAt (-10) "hello" ["a","b","c","d"]
--   ["a","b","c","d"]
--   
--   >>> setAt 100 "hello" ["a","b","c","d"]
--   ["a","b","c","d"]
--   
setAt :: Int -> a -> [a] -> [a]

-- | Update a given value in a list.
--   
--   
--   >>> overAt 2 (\x -> x ++ x) ["a","b","c","d"]
--   ["a","b","cc","d"]
--   
--   
--   You can update the first and last values in the list as well:
--   
--   
--   >>> overAt 0 (\x -> "bye") ["a","b","c","d"]
--   ["bye","b","c","d"]
--   
--   >>> overAt 3 (\x -> "") ["a","b","c","d"]
--   ["a","b","c",""]
--   
--   
--   If you try to set a value outside of the list, you'll get back the
--   same list:
--   
--   
--   >>> overAt (-10) (\_ -> "foobar") ["a","b","c","d"]
--   ["a","b","c","d"]
--   
--   >>> overAt 100 (\_ -> "baz") ["a","b","c","d"]
--   ["a","b","c","d"]
--   
overAt :: Int -> (a -> a) -> [a] -> [a]
instance GHC.Classes.Eq c => GHC.Classes.Eq (Termonad.Config.Colour.ColourConfig c)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Termonad.Config.Colour.List24 a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Termonad.Config.Colour.List6 a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Termonad.Config.Colour.List8 a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Termonad.Config.Colour.Matrix a)
instance GHC.Classes.Eq c => GHC.Classes.Eq (Termonad.Config.Colour.Palette c)
instance GHC.Internal.Data.Foldable.Foldable Termonad.Config.Colour.List24
instance GHC.Internal.Data.Foldable.Foldable Termonad.Config.Colour.List6
instance GHC.Internal.Data.Foldable.Foldable Termonad.Config.Colour.List8
instance GHC.Internal.Data.Foldable.Foldable Termonad.Config.Colour.Matrix
instance GHC.Internal.Data.Foldable.Foldable Termonad.Config.Colour.Palette
instance GHC.Internal.Base.Functor Termonad.Config.Colour.ColourConfig
instance GHC.Internal.Base.Functor Termonad.Config.Colour.List24
instance GHC.Internal.Base.Functor Termonad.Config.Colour.List6
instance GHC.Internal.Base.Functor Termonad.Config.Colour.List8
instance GHC.Internal.Base.Functor Termonad.Config.Colour.Matrix
instance GHC.Internal.Base.Functor Termonad.Config.Colour.Palette
instance GHC.Internal.Show.Show c => GHC.Internal.Show.Show (Termonad.Config.Colour.ColourConfig c)
instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Termonad.Config.Colour.List24 a)
instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Termonad.Config.Colour.List6 a)
instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Termonad.Config.Colour.List8 a)
instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Termonad.Config.Colour.Matrix a)
instance GHC.Internal.Show.Show c => GHC.Internal.Show.Show (Termonad.Config.Colour.Palette c)

-- | This module exposes termonad's basic configuration options. To set
--   these options in your config, first ensure you've imported
--   Termonad.
--   
--   Then for your main, apply start or defaultMain to a
--   TMConfig value. We suggest you build such values by performing
--   record updates on the defaultTMConfig rather than using the
--   TMConfig constructor, as the latter is much more likely to
--   break when there are changes to the TMConfig type.
--   
--   E.g.
--   
--   
--   -- Re-exports this module.
--   import Termonad
--   
--   main :: IO ()
--   main = start $ defaultTMConfig
--     { showScrollbar = ShowScrollbarNever
--     , confirmExit = False
--     , showMenu = False
--     , cursorBlinkMode = CursorBlinkModeOff
--     }
--   
--   
--   Additional options can be found in the following modules.
--   
--   
--   
- Termonad.Config.Colour
--   
--   
--   If you want to see an example configuration file, as well as an
--   explanation for how to use Termonad, see the Termonad README.
module Termonad.Config

-- | The Termonad ConfigOptions along with the ConfigHooks.
data TMConfig
TMConfig :: !ConfigOptions -> !ConfigHooks -> TMConfig
[options] :: TMConfig -> !ConfigOptions
[hooks] :: TMConfig -> !ConfigHooks

-- | The default TMConfig.
--   
--   options is defaultConfigOptions and hooks is
--   defaultConfigHooks.
defaultTMConfig :: TMConfig

-- | Configuration options for Termonad.
--   
--   See defaultConfigOptions for the default values.
data ConfigOptions
ConfigOptions :: !FontConfig -> !ShowScrollbar -> !Integer -> !Bool -> !Text -> !Bool -> !ShowTabBar -> !CursorBlinkMode -> !Bool -> !Bool -> !Bool -> ConfigOptions

-- | Specific options for fonts.
[fontConfig] :: ConfigOptions -> !FontConfig

-- | When to show the scroll bar.
[showScrollbar] :: ConfigOptions -> !ShowScrollbar

-- | The number of lines to keep in the scroll back history for each
--   terminal.
[scrollbackLen] :: ConfigOptions -> !Integer

-- | Whether or not to ask you for confirmation when closing individual
--   terminals or Termonad itself. It is generally safer to keep this as
--   True.
[confirmExit] :: ConfigOptions -> !Bool

-- | When double-clicking on text in the terminal with the mouse, Termonad
--   will use this value to determine what to highlight. The individual
--   characters in this list will be counted as part of a word.
--   
--   For instance if wordCharExceptions is "", then when
--   you double-click on the text http://, only the http
--   portion will be highlighted. If wordCharExceptions is
--   ":", then the http: portion will be highlighted.
[wordCharExceptions] :: ConfigOptions -> !Text

-- | Whether or not to show the File Edit etc menu.
[showMenu] :: ConfigOptions -> !Bool

-- | When to show the tab bar.
[showTabBar] :: ConfigOptions -> !ShowTabBar

-- | How to handle cursor blink.
[cursorBlinkMode] :: ConfigOptions -> !CursorBlinkMode

-- | This option controls whether or not to force bold text to use colors
--   from the ExtendedPalatte.
--   
--   If True, then colored bold text will always use colors
--   from the ExtendedPalatte. There will be no way to print bold
--   text colored with the BasicPalatte.
--   
--   This often isn't a big problem, since many TUI applications use bold
--   in combination with colors from the ExtendedPalatte. Also, the
--   VTE default blue color can be difficult to read with a dark
--   background, and enabling this can work around the problem. See
--   https://github.com/cdepillabout/termonad/issues/177 for more
--   information.
--   
--   If False, then bold can be applied separately to colors from
--   both the BasicPalatte and ExtendedPalatte.
[boldIsBright] :: ConfigOptions -> !Bool

-- | Enable SIXEL to draw graphics in a terminal.
--   
--   In order for this option to do anything, you need to be using a
--   version of VTE >= 0.63, and compile VTE with SIXEL support.
--   
--   Note that even if you do the above, there may still be some problems
--   with SIXEL support in VTE. Follow
--   https://gitlab.gnome.org/GNOME/vte/-/issues/253 for more
--   information.
[enableSixel] :: ConfigOptions -> !Bool

-- | Allow terminal to use bold text.
--   
--   You may want to disable this, for instance, if you use a font that
--   doesn't look good when bold.
[allowBold] :: ConfigOptions -> !Bool

-- | The default ConfigOptions.
--   
--   
--   >>> :{
--     let defConfOpt =
--           ConfigOptions
--             { fontConfig = defaultFontConfig
--             , showScrollbar = ShowScrollbarIfNeeded
--             , scrollbackLen = 10000
--             , confirmExit = True
--             , wordCharExceptions = "-#%&+,./=?@\\_~\183:"
--             , showMenu = True
--             , showTabBar = ShowTabBarIfNeeded
--             , cursorBlinkMode = CursorBlinkModeOn
--             , boldIsBright = False
--             , enableSixel = False
--             , allowBold = True
--             }
--     in defaultConfigOptions == defConfOpt
--   :}
--   True
--   
defaultConfigOptions :: ConfigOptions

-- | Hooks into certain termonad operations and VTE events. Used to modify
--   termonad's behaviour in order to implement new functionality. Fields
--   should have sane Semigroup and Monoid instances so
--   that config extensions can be combined uniformly and new hooks can be
--   added without incident.
newtype ConfigHooks
ConfigHooks :: (TMState -> Terminal -> IO ()) -> ConfigHooks

-- | Produce an IO action to run on creation of new Terminal,
--   given TMState and the Terminal in question.
[createTermHook] :: ConfigHooks -> TMState -> Terminal -> IO ()

-- | Default values for the ConfigHooks.
--   
--   
--   
- The default function for createTermHook is
--   defaultCreateTermHook.
--   
defaultConfigHooks :: ConfigHooks

-- | The font size for the Termonad terminal. There are two ways to set the
--   fontsize, corresponding to the two different ways to set the font size
--   in the Pango font rendering library.
--   
--   If you're not sure which to use, try FontSizePoints first and
--   see how it looks. It should generally correspond to font sizes you are
--   used to from other applications.
data FontSize

-- | This sets the font size based on "points". The conversion between a
--   point and an actual size depends on the system configuration and the
--   output device. The function fontDescriptionSetSize is used to
--   set the font size. See the documentation for that function for more
--   info.
FontSizePoints :: Int -> FontSize

-- | This sets the font size based on "device units". In general, this can
--   be thought of as one pixel. The function
--   fontDescriptionSetAbsoluteSize is used to set the font size.
--   See the documentation for that function for more info.
FontSizeUnits :: Double -> FontSize

-- | The default FontSize used if not specified.
--   
--   
--   >>> defaultFontSize
--   FontSizePoints 12
--   
defaultFontSize :: FontSize

-- | Settings for the font to be used in Termonad.
data FontConfig
FontConfig :: !Text -> !FontSize -> FontConfig

-- | The font family to use. Example: "DejaVu Sans Mono" or
--   "Source Code Pro"
[fontFamily] :: FontConfig -> !Text

-- | The font size.
[fontSize] :: FontConfig -> !FontSize

-- | The default FontConfig to use if not specified.
--   
--   
--   >>> defaultFontConfig == FontConfig {fontFamily = "Monospace", fontSize = defaultFontSize}
--   True
--   
defaultFontConfig :: FontConfig

-- | This data type represents an option that can either be Set or
--   Unset.
--   
--   This data type is used in situations where leaving an option unset
--   results in a special state that is not representable by setting any
--   specific value.
--   
--   Examples of this include the cursorFgColour and
--   cursorBgColour options supplied by the ColourConfig
--   ConfigExtension. By default, cursorFgColour and
--   cursorBgColour are both Unset. However, when
--   cursorBgColour is Set, cursorFgColour
--   defaults to the color of the text underneath. There is no way to
--   represent this by setting cursorFgColour.
data Option a
Unset :: Option a
Set :: !a -> Option a

-- | Whether or not to show the scroll bar in a terminal.
data ShowScrollbar

-- | Never show the scroll bar, even if there are too many lines on the
--   terminal to show all at once. You should still be able to scroll with
--   the mouse wheel.
ShowScrollbarNever :: ShowScrollbar

-- | Always show the scrollbar, even if it is not needed.
ShowScrollbarAlways :: ShowScrollbar

-- | Only show the scrollbar if there are too many lines on the terminal to
--   show all at once.
ShowScrollbarIfNeeded :: ShowScrollbar

-- | Whether or not to show the tab bar for switching tabs.
data ShowTabBar

-- | Never show the tab bar, even if there are multiple tabs open. This may
--   be confusing if you plan on using multiple tabs.
ShowTabBarNever :: ShowTabBar

-- | Always show the tab bar, even if you only have one tab open.
ShowTabBarAlways :: ShowTabBar

-- | Only show the tab bar if you have multiple tabs open.
ShowTabBarIfNeeded :: ShowTabBar

-- | An enumerated type which can be used to indicate the cursor blink mode
--   for the terminal.
data CursorBlinkMode

-- | Follow GTK+ settings for cursor blinking.
CursorBlinkModeSystem :: CursorBlinkMode

-- | Cursor blinks.
CursorBlinkModeOn :: CursorBlinkMode

-- | Cursor does not blink.
CursorBlinkModeOff :: CursorBlinkMode

-- | Catch-all for unknown values
AnotherCursorBlinkMode :: Int -> CursorBlinkMode

-- | Read the configuration for the preferences file
--   ~/.config/termonad/termonad.yaml. This file stores only the
--   options of TMConfig so hooks are initialized with
--   defaultConfigHooks. If the file doesn't exist, create it with
--   the default values.
--   
--   Any options that do not exist will get initialized with values from
--   defaultConfigOptions.
tmConfigFromPreferencesFile :: IO TMConfig

module Termonad.XML
interfaceDoc :: Document
interfaceText :: Text
menuDoc :: Document
menuText :: Text
aboutDoc :: Document
aboutText :: Text
closeTabDoc :: Document
closeTabText :: Text
preferencesText :: Text

module Termonad.App
setupScreenStyle :: IO ()
createFontDescFromConfig :: TMConfig -> IO FontDescription
createFontDesc :: FontSize -> Text -> IO FontDescription
setFontDescSize :: FontDescription -> FontSize -> IO ()
adjustFontDescSize :: (FontSize -> FontSize) -> FontDescription -> IO ()
modifyFontSizeForAllTerms :: (FontSize -> FontSize) -> TMState -> IO ()
fontSizeFromFontDescription :: FontDescription -> IO FontSize
fontConfigFromFontDescription :: FontDescription -> IO (Maybe FontConfig)
compareScrolledWinAndTab :: ScrolledWindow -> TMNotebookTab -> Bool
updateFLTabPos :: TMState -> Int -> Int -> IO ()

-- | Try to figure out whether Termonad should exit. This also used to
--   figure out if Termonad should close a given terminal.
--   
--   This reads the confirmExit setting from ConfigOptions to
--   check whether the user wants to be notified when either Termonad or a
--   given terminal is about to be closed.
--   
--   If confirmExit is True, then a dialog is presented to
--   the user asking them if they really want to exit or close the
--   terminal. Their response is sent back as a ResponseType.
--   
--   If confirmExit is False, then this function always
--   returns ResponseTypeYes.
askShouldExit :: TMState -> IO ResponseType

-- | Force Termonad to exit without asking the user whether or not to do
--   so.
forceQuit :: TMState -> IO ()
setupTermonad :: TMConfig -> Application -> ApplicationWindow -> Builder -> IO ()
appActivate :: TMConfig -> Application -> IO ()
showAboutDialog :: Application -> IO ()
showFindDialog :: Application -> IO (Maybe Text)
doFind :: TMState -> IO ()
findAbove :: TMState -> IO ()
findBelow :: TMState -> IO ()
setShowMenuBar :: Application -> Bool -> IO ()

-- | Fill a combo box with ids and labels
--   
--   The ids are stored in the combobox as Text, so their type
--   should be an instance of the Show type class.
comboBoxFill :: Show a => ComboBoxText -> [(a, Text)] -> IO ()

-- | Set the current active item in a combobox given an input id.
comboBoxSetActive :: Show a => ComboBoxText -> a -> IO ()

-- | Get the current active item in a combobox
--   
--   The list of values to be searched in the combobox must be given as a
--   parameter. These values are converted to Text then compared to the
--   current id.
comboBoxGetActive :: (Show a, Enum a) => ComboBoxText -> [a] -> IO (Maybe a)
applyNewPreferences :: TMState -> IO ()
applyNewPreferencesToTab :: TMState -> TMNotebookTab -> IO ()

-- | Show the preferences dialog.
--   
--   When the user clicks on the Ok button, it copies the new settings to
--   TMState. Then apply them to the current terminals.
showPreferencesDialog :: TMState -> IO ()
appStartup :: Application -> IO ()

-- | Run Termonad with the given TMConfig.
--   
--   Do not perform any of the recompilation operations that the
--   defaultMain function does.
start :: TMConfig -> IO ()

-- | Run Termonad with the given TMConfig.
--   
--   This function will check if there is a
--   ~/.config/termonad/termonad.hs file and a
--   ~/.cache/termonad/termonad-linux-x86_64 binary. Termonad will
--   perform different actions based on whether or not these two files
--   exist.
--   
--   Here are the four different possible actions based on the existence of
--   these two files.
--   
--   
--   
- ~/.config/termonad/termonad.hs exists,
--   ~/.cache/termonad/termonad-linux-x86_64 existsThe timestamps
--   of these two files are checked. If the
--   ~/.config/termonad/termonad.hs file has been modified after
--   the ~/.cache/termonad/termonad-linux-x86_64 binary, then
--   Termonad will use GHC to recompile the
--   ~/.config/termonad/termonad.hs file, producing a new binary
--   at ~/.cache/termonad/termonad-linux-x86_64. This new binary
--   will be re-executed. The TMConfig passed to this
--   defaultMain will be effectively thrown away.If GHC fails to
--   recompile the ~/.config/termonad/termonad.hs file, then
--   Termonad will just execute start with the TMConfig
--   passed in.If the ~/.cache/termonad/termonad-linux-x86_64
--   binary has been modified after the
--   ~/.config/termonad/termonad.hs file, then Termonad will
--   re-exec the ~/.cache/termonad/termonad-linux-x86_64 binary.
--   The TMConfig passed to this defaultMain will be
--   effectively thrown away.
--   
- ~/.config/termonad/termonad.hs exists,
--   ~/.cache/termonad/termonad-linux-x86_64 does not
--   existTermonad will use GHC to recompile the
--   ~/.config/termonad/termonad.hs file, producing a new binary
--   at ~/.cache/termonad/termonad-linux-x86_64. This new binary
--   will be re-executed. The TMConfig passed to this
--   defaultMain will be effectively thrown away.If GHC fails to
--   recompile the ~/.config/termonad/termonad.hs file, then
--   Termonad will just execute start with the TMConfig
--   passed in.
--   
- ~/.config/termonad/termonad.hs does not exist,
--   ~/.cache/termonad/termonad-linux-x86_64 existsTermonad will
--   ignore the ~/.cache/termonad/termonad-linux-x86_64 binary and
--   just run start with the TMConfig passed to this
--   function.
--   
- ~/.config/termonad/termonad.hs does not exist,
--   ~/.cache/termonad/termonad-linux-x86_64 does not
--   existTermonad will run start with the TMConfig passed to
--   this function.
--   
--   
--   Other notes:
--   
--   
--   
- That the locations of ~/.config/termonad/termonad.hs and
--   ~/.cache/termonad/termonad-linux-x86_64 may differ depending
--   on your system.
--   
- In your own ~/.config/termonad/termonad.hs file, you can
--   use either defaultMain or start. As long as you always
--   execute the system-wide termonad binary (instead of the
--   binary produced as ~/.cache/termonad/termonad-linux-x86_64),
--   the effect should be the same.
--   
defaultMain :: TMConfig -> IO ()

-- | This module exposes termonad's basic configuration options, as well as
--   defaultMain.
--   
--   If you want to configure Termonad, please take a look at
--   Termonad.Config.
module Termonad

-- | Run Termonad with the given TMConfig.
--   
--   This function will check if there is a
--   ~/.config/termonad/termonad.hs file and a
--   ~/.cache/termonad/termonad-linux-x86_64 binary. Termonad will
--   perform different actions based on whether or not these two files
--   exist.
--   
--   Here are the four different possible actions based on the existence of
--   these two files.
--   
--   
--   
- ~/.config/termonad/termonad.hs exists,
--   ~/.cache/termonad/termonad-linux-x86_64 existsThe timestamps
--   of these two files are checked. If the
--   ~/.config/termonad/termonad.hs file has been modified after
--   the ~/.cache/termonad/termonad-linux-x86_64 binary, then
--   Termonad will use GHC to recompile the
--   ~/.config/termonad/termonad.hs file, producing a new binary
--   at ~/.cache/termonad/termonad-linux-x86_64. This new binary
--   will be re-executed. The TMConfig passed to this
--   defaultMain will be effectively thrown away.If GHC fails to
--   recompile the ~/.config/termonad/termonad.hs file, then
--   Termonad will just execute start with the TMConfig
--   passed in.If the ~/.cache/termonad/termonad-linux-x86_64
--   binary has been modified after the
--   ~/.config/termonad/termonad.hs file, then Termonad will
--   re-exec the ~/.cache/termonad/termonad-linux-x86_64 binary.
--   The TMConfig passed to this defaultMain will be
--   effectively thrown away.
--   
- ~/.config/termonad/termonad.hs exists,
--   ~/.cache/termonad/termonad-linux-x86_64 does not
--   existTermonad will use GHC to recompile the
--   ~/.config/termonad/termonad.hs file, producing a new binary
--   at ~/.cache/termonad/termonad-linux-x86_64. This new binary
--   will be re-executed. The TMConfig passed to this
--   defaultMain will be effectively thrown away.If GHC fails to
--   recompile the ~/.config/termonad/termonad.hs file, then
--   Termonad will just execute start with the TMConfig
--   passed in.
--   
- ~/.config/termonad/termonad.hs does not exist,
--   ~/.cache/termonad/termonad-linux-x86_64 existsTermonad will
--   ignore the ~/.cache/termonad/termonad-linux-x86_64 binary and
--   just run start with the TMConfig passed to this
--   function.
--   
- ~/.config/termonad/termonad.hs does not exist,
--   ~/.cache/termonad/termonad-linux-x86_64 does not
--   existTermonad will run start with the TMConfig passed to
--   this function.
--   
--   
--   Other notes:
--   
--   
--   
- That the locations of ~/.config/termonad/termonad.hs and
--   ~/.cache/termonad/termonad-linux-x86_64 may differ depending
--   on your system.
--   
- In your own ~/.config/termonad/termonad.hs file, you can
--   use either defaultMain or start. As long as you always
--   execute the system-wide termonad binary (instead of the
--   binary produced as ~/.cache/termonad/termonad-linux-x86_64),
--   the effect should be the same.
--   
defaultMain :: TMConfig -> IO ()

-- | Run Termonad with the given TMConfig.
--   
--   Do not perform any of the recompilation operations that the
--   defaultMain function does.
start :: TMConfig -> IO ()
