-
Notifications
You must be signed in to change notification settings - Fork 2
/
Byzanz.hs
28 lines (23 loc) · 854 Bytes
/
Byzanz.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
-- | Prompt for running byzanz
module Byzanz where
import Data.Time
import XMonad.Prompt
import Imports
import Prompt
data ByzanzPrompt = ByzanzPrompt
instance XPrompt ByzanzPrompt where
showXPrompt ByzanzPrompt = "Byzanz arguments: "
byzanzPrompt :: XX ()
byzanzPrompt = do
xpConfig <- getXpConfig
env <- ask
toXX $ mkXPrompt ByzanzPrompt xpConfig (const $ return []) $ \args -> do
let args' = if null args then "10" else args
withEnv env $ forkXio $ do
now <- liftIO (utcToLocalZonedTime =<< getCurrentTime)
homeDir <- view envHomeDir
let name = formatTime defaultTimeLocale "%F_%T.gif" now
output = homeDir </> "pics/screencaps" </> name
removeFile output `catchAny` \_ -> return ()
syncSpawn (homeDir </> "env/scripts/byzanz-record-region.sh") [args', output]
spawn browser [output]