02-testoutput.hs 1.29 KB
Newer Older
epsi sayidina's avatar
epsi sayidina committed
1 2 3 4 5 6
-- This is a modularized config for herbstluftwm tags in lemonbar

import System.Environment
import System.Process
import System.IO
import GHC.IO.Handle
epsi sayidina's avatar
epsi sayidina committed
7 8

import MyHelper
epsi sayidina's avatar
epsi sayidina committed
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
import MyOutput

-- initialize

panelHeight = 24

-- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
-- process handler

testLemon :: Int -> [String] -> IO ()
testLemon monitor parameters = do
    let command_out = "lemonbar"

    (Just pipe_in, _, _, ph)  <- 
        createProcess (proc command_out (parameters ++ ["-p"]) )
        { std_in = CreatePipe }

    -- initialize statusbar before loop
    setTagValue monitor 
    setWindowtitle "test"
    
    text <- getStatusbarText monitor

    hPutStrLn pipe_in text
    hFlush pipe_in
    
    hClose pipe_in

-- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
-- main

main = do
    -- initialize
    
    args <- getArgs
    let monitor = getMonitor args

    geometry <- getGeometry monitor
    let lemonParameters = getLemonParameters panelHeight geometry

    -- test
epsi sayidina's avatar
epsi sayidina committed
50 51 52 53
    
    -- do `man herbsluftclient`, and type \pad to search what it means
    system $ "herbstclient pad " ++ show(monitor) ++ " "
        ++ show(panelHeight) ++ " 0 " ++ show(panelHeight) ++ " 0"
epsi sayidina's avatar
epsi sayidina committed
54 55 56 57 58 59

    -- run process
    testLemon monitor lemonParameters

    -- end of IO
    return ()