2020-11-04 17:12:03 +01:00
|
|
|
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
|
2021-08-05 09:44:53 +02:00
|
|
|
usage = printf "%s bat (acpi_command) | vol (pamixer_command) | net (nmcli_command) | date" <$> getProgName
|
2020-11-04 17:12:03 +01:00
|
|
|
|
|
|
|
main :: IO ()
|
|
|
|
main = do
|
|
|
|
args <- getArgs
|
|
|
|
output <- case args of
|
2021-08-04 20:56:11 +02:00
|
|
|
[ "bat", cmd ] -> queryBattery cmd
|
2021-08-05 09:44:53 +02:00
|
|
|
[ "bat" ] -> queryBattery "acpi"
|
2021-08-04 20:56:11 +02:00
|
|
|
[ "vol", cmd ] -> queryVolume cmd
|
2021-08-05 09:44:53 +02:00
|
|
|
[ "vol" ] -> queryVolume "pamixer"
|
2021-08-04 20:56:11 +02:00
|
|
|
[ "net", cmd ] -> queryNet cmd
|
2021-08-05 09:44:53 +02:00
|
|
|
[ "net" ] -> queryNet "nmcli"
|
2020-11-04 17:12:03 +01:00
|
|
|
[ "date" ] -> queryDate True
|
|
|
|
[ "date-min" ] -> queryDate False
|
|
|
|
_ -> usage
|
|
|
|
putStrLn output
|