Copyright | (c) Dennis Gosnell 2018 |
---|---|
License | BSD3 |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Termonad.Config
Contents
Description
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.
If you want to see an example configuration file, as well as an explanation for how to use Termonad, see the Termonad README.
Synopsis
- data TMConfig = TMConfig {
- options :: !ConfigOptions
- hooks :: !ConfigHooks
- defaultTMConfig :: TMConfig
- data ConfigOptions = ConfigOptions {}
- defaultConfigOptions :: ConfigOptions
- data ConfigHooks = ConfigHooks {
- createTermHook :: TMState -> Terminal -> IO ()
- defaultConfigHooks :: ConfigHooks
- data FontSize
- defaultFontSize :: FontSize
- data FontConfig = FontConfig {
- fontFamily :: !Text
- fontSize :: !FontSize
- defaultFontConfig :: FontConfig
- data Option a
- data ShowScrollbar
- data ShowTabBar
- data CursorBlinkMode
- tmConfigFromPreferencesFile :: IO TMConfig
Main Config Data Type
The Termonad ConfigOptions
along with the ConfigHooks
.
Constructors
TMConfig | |
Fields
|
defaultTMConfig :: TMConfig Source #
The default TMConfig
.
options
is defaultConfigOptions
and hooks
is defaultConfigHooks
.
data ConfigOptions Source #
Configuration options for Termonad.
See defaultConfigOptions
for the default values.
Constructors
ConfigOptions | |
Fields
|
Instances
Eq ConfigOptions Source # | |
Defined in Termonad.Types Methods (==) :: ConfigOptions -> ConfigOptions -> Bool # (/=) :: ConfigOptions -> ConfigOptions -> Bool # | |
Show ConfigOptions Source # | |
Defined in Termonad.Types Methods showsPrec :: Int -> ConfigOptions -> ShowS # show :: ConfigOptions -> String # showList :: [ConfigOptions] -> ShowS # | |
Generic ConfigOptions Source # | |
Defined in Termonad.Types Associated Types type Rep ConfigOptions :: Type -> Type | |
FromJSON ConfigOptions Source # | |
Defined in Termonad.Types Methods parseJSON :: Value -> Parser ConfigOptions # parseJSONList :: Value -> Parser [ConfigOptions] # | |
ToJSON ConfigOptions Source # | |
Defined in Termonad.Types Methods toJSON :: ConfigOptions -> Value # toEncoding :: ConfigOptions -> Encoding # toJSONList :: [ConfigOptions] -> Value # toEncodingList :: [ConfigOptions] -> Encoding # | |
type Rep ConfigOptions Source # | |
Defined in Termonad.Types type Rep ConfigOptions = D1 ('MetaData "ConfigOptions" "Termonad.Types" "termonad-4.0.0.1-6j4RMn5R6Vs27Ih13k8C8I" 'False) (C1 ('MetaCons "ConfigOptions" 'PrefixI 'True) (((S1 ('MetaSel ('Just "fontConfig") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 FontConfig) :*: S1 ('MetaSel ('Just "showScrollbar") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ShowScrollbar)) :*: (S1 ('MetaSel ('Just "scrollbackLen") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Integer) :*: S1 ('MetaSel ('Just "confirmExit") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool))) :*: ((S1 ('MetaSel ('Just "wordCharExceptions") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "showMenu") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool)) :*: (S1 ('MetaSel ('Just "showTabBar") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ShowTabBar) :*: S1 ('MetaSel ('Just "cursorBlinkMode") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 CursorBlinkMode))))) |
defaultConfigOptions :: ConfigOptions Source #
The default ConfigOptions
.
>>>
:{
let defConfOpt = ConfigOptions { fontConfig = defaultFontConfig , showScrollbar = ShowScrollbarIfNeeded , scrollbackLen = 10000 , confirmExit = True , wordCharExceptions = "-#%&+,./=?@\\_~\183:" , showMenu = True , showTabBar = ShowTabBarIfNeeded , cursorBlinkMode = CursorBlinkModeOn } in defaultConfigOptions == defConfOpt :} True
data ConfigHooks Source #
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.
Constructors
ConfigHooks | |
Fields
|
Instances
Show ConfigHooks Source # | |
Defined in Termonad.Types Methods showsPrec :: Int -> ConfigHooks -> ShowS # show :: ConfigHooks -> String # showList :: [ConfigHooks] -> ShowS # |
defaultConfigHooks :: ConfigHooks Source #
Default values for the ConfigHooks
.
- The default function for
createTermHook
isdefaultCreateTermHook
.
Fonts
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.
Constructors
FontSizePoints Int | 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 |
FontSizeUnits Double | This sets the font size based on "device units". In general, this
can be thought of as one pixel. The function
|
Instances
Eq FontSize Source # | |
Show FontSize Source # | |
Generic FontSize Source # | |
FromJSON FontSize Source # | |
ToJSON FontSize Source # | |
Defined in Termonad.Types Methods toEncoding :: FontSize -> Encoding # toJSONList :: [FontSize] -> Value # toEncodingList :: [FontSize] -> Encoding # | |
type Rep FontSize Source # | |
Defined in Termonad.Types type Rep FontSize = D1 ('MetaData "FontSize" "Termonad.Types" "termonad-4.0.0.1-6j4RMn5R6Vs27Ih13k8C8I" 'False) (C1 ('MetaCons "FontSizePoints" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :+: C1 ('MetaCons "FontSizeUnits" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double))) |
defaultFontSize :: FontSize Source #
The default FontSize
used if not specified.
>>>
defaultFontSize
FontSizePoints 12
data FontConfig Source #
Settings for the font to be used in Termonad.
Constructors
FontConfig | |
Fields
|
Instances
Eq FontConfig Source # | |
Defined in Termonad.Types | |
Show FontConfig Source # | |
Defined in Termonad.Types Methods showsPrec :: Int -> FontConfig -> ShowS # show :: FontConfig -> String # showList :: [FontConfig] -> ShowS # | |
Generic FontConfig Source # | |
Defined in Termonad.Types Associated Types type Rep FontConfig :: Type -> Type | |
FromJSON FontConfig Source # | |
Defined in Termonad.Types | |
ToJSON FontConfig Source # | |
Defined in Termonad.Types Methods toJSON :: FontConfig -> Value # toEncoding :: FontConfig -> Encoding # toJSONList :: [FontConfig] -> Value # toEncodingList :: [FontConfig] -> Encoding # | |
type Rep FontConfig Source # | |
Defined in Termonad.Types type Rep FontConfig = D1 ('MetaData "FontConfig" "Termonad.Types" "termonad-4.0.0.1-6j4RMn5R6Vs27Ih13k8C8I" 'False) (C1 ('MetaCons "FontConfig" 'PrefixI 'True) (S1 ('MetaSel ('Just "fontFamily") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "fontSize") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 FontSize))) |
defaultFontConfig :: FontConfig Source #
The default FontConfig
to use if not specified.
>>>
defaultFontConfig == FontConfig {fontFamily = "Monospace", fontSize = defaultFontSize}
True
Misc
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
.
Instances
Functor Option Source # | |
Foldable Option Source # | |
Defined in Termonad.Types Methods fold :: Monoid m => Option m -> m foldMap :: Monoid m => (a -> m) -> Option a -> m foldMap' :: Monoid m => (a -> m) -> Option a -> m foldr :: (a -> b -> b) -> b -> Option a -> b foldr' :: (a -> b -> b) -> b -> Option a -> b foldl :: (b -> a -> b) -> b -> Option a -> b foldl' :: (b -> a -> b) -> b -> Option a -> b foldr1 :: (a -> a -> a) -> Option a -> a foldl1 :: (a -> a -> a) -> Option a -> a elem :: Eq a => a -> Option a -> Bool maximum :: Ord a => Option a -> a | |
Eq a => Eq (Option a) Source # | |
Ord a => Ord (Option a) Source # | |
Defined in Termonad.Types | |
Read a => Read (Option a) Source # | |
Defined in Termonad.Types | |
Show a => Show (Option a) Source # | |
data ShowScrollbar Source #
Whether or not to show the scroll bar in a terminal.
Constructors
ShowScrollbarNever | 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. |
ShowScrollbarAlways | Always show the scrollbar, even if it is not needed. |
ShowScrollbarIfNeeded | Only show the scrollbar if there are too many lines on the terminal to show all at once. |
Instances
data ShowTabBar Source #
Whether or not to show the tab bar for switching tabs.
Constructors
ShowTabBarNever | Never show the tab bar, even if there are multiple tabs open. This may be confusing if you plan on using multiple tabs. |
ShowTabBarAlways | Always show the tab bar, even if you only have one tab open. |
ShowTabBarIfNeeded | Only show the tab bar if you have multiple tabs open. |
Instances
data CursorBlinkMode Source #
An enumerated type which can be used to indicate the cursor blink mode for the terminal.
Constructors
CursorBlinkModeSystem | Follow GTK+ settings for cursor blinking. |
CursorBlinkModeOn | Cursor blinks. |
CursorBlinkModeOff | Cursor does not blink. |
AnotherCursorBlinkMode Int | Catch-all for unknown values |
Instances
tmConfigFromPreferencesFile :: IO TMConfig Source #
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.