Created
July 29, 2012 20:00
-
-
Save jonsterling/3201536 to your computer and use it in GitHub Desktop.
A quick & dirty script to toggle Solarized theme variants
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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