Skip to content

Instantly share code, notes, and snippets.

@jonsterling
Created July 29, 2012 20:00
Show Gist options
  • Select an option

  • Save jonsterling/3201536 to your computer and use it in GitHub Desktop.

Select an option

Save jonsterling/3201536 to your computer and use it in GitHub Desktop.
A quick & dirty script to toggle Solarized theme variants
module Main where
import System.FilePath
import System.Process
import System.Exit
import System.Environment
import Control.Applicative
import Control.Monad.Identity
data ThemeVariant = Dark | Light deriving Read
data Theme = Theme (ThemeVariant -> FilePath) (FilePath -> FilePath)
main = do
variant <- read . head <$> getArgs
applyTheme variant `mapM_` [ mutt, vim ]
mutt = Theme (\v -> "mutt-colors-solarized" </> muttTheme v) muttPath
where muttTheme Light = "mutt-colors-solarized-light-16"
muttTheme Dark = "mutt-colors-solarized-dark-16"
muttPath f = rootDir </> "mutt" </> f <.> "muttrc"
vim = Theme vimTheme vimPath
where vimTheme Light = "solarized-light"
vimTheme Dark = "solarized-dark"
vimPath f = rootDir </> "vim" </> f <.> "vimrc"
applyTheme var (Theme t path) = link (path $ t var) (path "current-theme")
rootDir = "/Users/jon/.etc"
link source dest = rawSystem "ln" ["-sf", source, dest]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment