Safe Haskell | None |
---|---|
Language | Haskell2010 |
Purebred
Description
To customise purebred configuration, create
~/.config/purebred/purebred.hs
and change the default config to
your liking. For example, the following configuration adds some
custom keybindings:
import Data.Semigroup ((<>)) import Purebred scrollKeybindings :: (Scrollable
w) => [Keybinding
v w] scrollKeybindings = [Keybinding
(EvKey (KCharj
) []) (scrollDown
`chain
`continue
) , Keybinding (EvKey (KChark
) []) (scrollUp
`chain` continue) , Keybinding (EvKey (KChard
) []) (scrollPageDown
`chain` continue) , Keybinding (EvKey (KCharu
) []) (scrollPageUp
`chain` continue) ] mailViewKeybindings = [ Keybinding (EvKey (KCharJ
) []) (listDown
`chain'
`displayMail
`chain` continue) , Keybinding (EvKey (KCharK
) []) (listUp
`chain'` displayMail `chain` continue) , Keybinding (EvKey (KCharG
) []) (listJumpToEnd
`chain` continue) , Keybinding (EvKey (KCharg
) []) (listJumpToStart
`chain` continue) ] <> scrollKeybindings main =purebred
$ tweakdefaultConfig
where tweak = over (confMailView
.mvKeybindings
) (mailViewKeybindings <>) . over (confHelpView
.hvKeybindings
) (scrollKeybindings <>)
The invoke the program, just run purebred
:
But if recompilation is needed and you used stack
to build and install the
program, it will not be able to find the libraries:
ftweedal% purebred Configuration '/home/ftweedal/.config/purebred/purebred.hs' changed. Recompiling. Error occurred while loading configuration file. Launching custom binary /home/ftweedal/.cache/purebred/purebred-linux-x86_64 purebred-linux-x86_64: /home/ftweedal/.config/purebred/purebred.hs:4:1: error: Could not find module ‘Purebred’ Use -v to see a list of the files searched for. | 4 | import Purebred | ^^^^^^^^^^^^^^^ CallStack (from HasCallStack): error, called at src/Purebred.hs:205:32 in purebred-0.1.0.0-8yyFpK6IBghCAYUvNAhJRk:Purebred
To avoid this, don't use stack. But if you insist, you can run
stack exec purebred
from the source tree.
If you want to override the configuration file location, use the
PUREBRED_CONFIG_DIR
environment variable. The configuration file,
located in this directory, must always be name purebred.hs
.
The binary is normally cached in ~/.cache/purebred/
. If you
override the configuration directory, the configuration directory is
also used as the cache directory, to avoid clobbering the cached
binary for the other configurations.
- module Types
- module UI.Actions
- module UI.Index.Keybindings
- module UI.Mail.Keybindings
- data Event :: *
- = EvKey Key [Modifier]
- | EvMouseDown Int Int Button [Modifier]
- | EvMouseUp Int Int (Maybe Button)
- | EvResize Int Int
- | EvPaste ByteString
- | EvLostFocus
- | EvGainedFocus
- data Key :: *
- data Modifier :: *
- data List n e :: * -> * -> *
- data Next a :: * -> *
- getDatabasePath :: IO FilePath
- defaultConfig :: UserConfiguration
- solarizedDark :: Theme
- solarizedLight :: Theme
- (</>) :: FilePath -> FilePath -> FilePath
- genBoundary :: RandomGen g => g -> String
- data Mailbox :: * = Mailbox (Maybe Text) AddrSpec
- data AddrSpec :: * = AddrSpec ByteString Domain
- data Domain :: *
- purebred :: UserConfiguration -> IO ()
Documentation
module Types
module UI.Actions
module UI.Index.Keybindings
module UI.Mail.Keybindings
Events.
Constructors
EvKey Key [Modifier] | A keyboard key was pressed with the specified modifiers. |
EvMouseDown Int Int Button [Modifier] | A mouse button was pressed at the specified column and row. Any modifiers available in the event are also provided. |
EvMouseUp Int Int (Maybe Button) | A mouse button was released at the specified column and row. Some terminals report only that a button was released without specifying which one; in that case, Nothing is provided. Otherwise Just the button released is included in the event. |
EvResize Int Int | If read from |
EvPaste ByteString | A paste event occurs when a bracketed paste input sequence is received. For terminals that support bracketed paste mode, these events will be triggered on a paste event. Terminals that do not support bracketed pastes will send the paste contents as ordinary input (which is probably bad, so beware!) Note that the data is provided in raw form and you'll have to decode (e.g. as UTF-8) if that's what your application expects. |
EvLostFocus | The terminal running the application lost input focus. |
EvGainedFocus | The terminal running the application gained input focus. |
Representations of non-modifier keys.
- KFun is indexed from 0 to 63. Range of supported FKeys varies by terminal and keyboard.
- KUpLeft, KUpRight, KDownLeft, KDownRight, KCenter support varies by terminal and keyboard.
- Actually, support for most of these but KEsc, KChar, KBS, and KEnter vary by terminal and keyboard.
Modifier keys. Key codes are interpreted such that users are more
likely to have Meta than Alt; for instance on the PC Linux console,
MMeta
will generally correspond to the physical Alt key.
data List n e :: * -> * -> * #
List state. Lists have an element type e
that is the data stored
by the list. Lists handle the following events by default:
- Up/down arrow keys: move cursor of selected item
- Page up / page down keys: move cursor of selected item by one page at a time (based on the number of items shown)
- Home/end keys: move cursor of selected item to beginning or end of list
Instances
Functor (List n) | |
Foldable (List n) | |
Traversable (List n) | |
(Show n, Show e) => Show (List n e) | |
Generic (List n e) | |
WithContext (List Name (Bool, FileSystemEntry)) Source # | |
WithContext (List Name MIMEMessage) Source # | |
WithContext (List Name NotmuchThread) Source # | |
WithContext (List Name NotmuchMail) Source # | |
Named (List n e) n | |
type Rep (List n e) | |
The type of actions to take upon completion of an event handler.
(</>) :: FilePath -> FilePath -> FilePath infixr 5 #
Combine two paths with a path separator.
If the second path starts with a path separator or a drive letter, then it returns the second.
The intention is that readFile (dir
will access the same file as
</>
file)setCurrentDirectory dir; readFile file
.
Posix: "/directory" </> "file.ext" == "/directory/file.ext" Windows: "/directory" </> "file.ext" == "/directory\\file.ext" "directory" </> "/file.ext" == "/file.ext" Valid x => (takeDirectory x </> takeFileName x) `equalFilePath` x
Combined:
Posix: "/" </> "test" == "/test" Posix: "home" </> "bob" == "home/bob" Posix: "x:" </> "foo" == "x:/foo" Windows: "C:\\foo" </> "bar" == "C:\\foo\\bar" Windows: "home" </> "bob" == "home\\bob"
Not combined:
Posix: "home" </> "/bob" == "/bob" Windows: "home" </> "C:\\bob" == "C:\\bob"
Not combined (tricky):
On Windows, if a filepath starts with a single slash, it is relative to the
root of the current drive. In [1], this is (confusingly) referred to as an
absolute path.
The current behavior of </>
is to never combine these forms.
Windows: "home" </> "/bob" == "/bob" Windows: "home" </> "\\bob" == "\\bob" Windows: "C:\\home" </> "\\bob" == "\\bob"
On Windows, from [1]: "If a file name begins with only a disk designator
but not the backslash after the colon, it is interpreted as a relative path
to the current directory on the drive with the specified letter."
The current behavior of </>
is to never combine these forms.
Windows: "D:\\foo" </> "C:bar" == "C:bar" Windows: "C:\\foo" </> "C:bar" == "C:bar"
genBoundary :: RandomGen g => g -> String Source #
Constructors
AddrSpec ByteString Domain |
Constructors
DomainDotAtom (NonEmpty ByteString) | |
DomainLiteral ByteString |
purebred :: UserConfiguration -> IO () Source #