28 lines
801 B
Haskell
28 lines
801 B
Haskell
module Main where
|
|
|
|
import Text.Printf
|
|
import System.Environment
|
|
|
|
import Monitors.Battery (queryBattery)
|
|
import Monitors.Date (queryDate)
|
|
import Monitors.Net (queryNet)
|
|
import Monitors.Volume (queryVolume)
|
|
|
|
usage :: IO String
|
|
usage = printf "%s bat (acpi_command) | vol (pamixer_command) | net (nmcli_command) | date" <$> getProgName
|
|
|
|
main :: IO ()
|
|
main = do
|
|
args <- getArgs
|
|
output <- case args of
|
|
[ "bat", cmd ] -> queryBattery cmd
|
|
[ "bat" ] -> queryBattery "acpi"
|
|
[ "vol", cmd ] -> queryVolume cmd
|
|
[ "vol" ] -> queryVolume "pamixer"
|
|
[ "net", cmd ] -> queryNet cmd
|
|
[ "net" ] -> queryNet "nmcli"
|
|
[ "date" ] -> queryDate True
|
|
[ "date-min" ] -> queryDate False
|
|
_ -> usage
|
|
putStrLn output
|