matthunz / shmonad

A shell prompt with infinite customization
Apache License 2.0
35 stars 0 forks source link

ShMonad

Demo

A shell prompt with infinite customization.

Features

Installation

By default the CLI will follow the XDG specification and use $XDG_CONFIG_HOME for configuration files.

If the path does not yet exist you can start by creating a shmonad directory in your configuration path. For example:

mkdir -p ~/.config/shmonad
cd ~/.config/shmonad

You can then create a new config.hs file, which will be the entrypoint of your configuration.

import ShMonad

main = do
  shmonad $
    path $
      segment Dull Magenta userModule
        <> ( currentDirectoryModule
               >>= \dir -> segment Dull Blue $ textModule $ " \xf07b " ++ dir
           )
        <> ( gitBranchModule
               >>= \branch -> segment Dull Cyan $ textModule $ " \xe725 " ++ branch
           )

Cloning from source

In your shmonad configuration directory, you can now clone the latest source code.

git clone https://github.com/matthunz/shmonad

Building

First create a new stack project in the same configuration directory.

stack init

Then edit your stack.yml to include the shmonad source code.

resolver:
  url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/25.yaml

packages:
  - shmonad

Finally, you can install the CLI with:

stack install

Adding ShMonad to your shell

In your .zshrc add

eval "$(shmonad init)"

Usage

You can recompile your configuration by running:

shmonad recompile

Inspiration

Huge thanks to other shell prompts that inspired this project!

The idea to use Haskell as a configuration language comes from xmonad (which pairs great with this project).