taffybar-4.0.2: A desktop bar similar to xmobar, but with more GUI

Copyright | (c) José A. Romero L.
License | BSD3-style (see LICENSE)
Maintainer | José A. Romero L. <escherdragon@gmail.com>
Stability | unstable
Portability | unportable
Safe Haskell | Safe-Inferred
Language | Haskell2010

System.Taffybar.Information.Network

Description

Provides information about network traffic over selected interfaces, obtained from parsing the `/proc/net/dev` file using some of the facilities provided by the System.Taffybar.Information.StreamInfo module.

Synopsis

- networkInfoFile :: FilePath
- getNetInfo :: String -> IO (Maybe [Int])
- parseDevNet' :: String -> [(String, [Int])]
- parseDevNet :: String -> [(String, (Int, Int))]
- getDeviceUpDown :: [String] -> Maybe (String, (Int, Int))
- isInterfaceUp :: String -> MaybeT IO ()
- handleFailure :: IO a -> MaybeT IO a
- getDeviceSamples :: IO (Maybe [TxSample])
- data TxSample = TxSample {
  - sampleUp :: Int
  - sampleDown :: Int
  - sampleTime :: SystemTime
  - sampleDevice :: String
  }
- monitorNetworkInterfaces :: RealFrac a1 => a1 -> ([(String, (Rational, Rational))] -> IO ()) -> IO ()
- updateSamples :: [(String, (TxSample, TxSample))] -> IO [(String, (TxSample, TxSample))]
- getSpeed :: TxSample -> TxSample -> (Rational, Rational)
- sumSpeeds :: [(Rational, Rational)] -> (Rational, Rational)

# Documentation

networkInfoFile :: FilePath Source #

getNetInfo :: String -> IO (Maybe [Int]) Source #

Returns a two-element list containing the current number of bytes received and transmitted via the given network interface (e.g. "wlan0"), according to the contents of the `/proc/dev/net` file.

parseDevNet' :: String -> [(String, [Int])] Source #

parseDevNet :: String -> [(String, (Int, Int))] Source #

getDeviceUpDown :: [String] -> Maybe (String, (Int, Int)) Source #

isInterfaceUp :: String -> MaybeT IO () Source #

handleFailure :: IO a -> MaybeT IO a Source #

getDeviceSamples :: IO (Maybe [TxSample]) Source #

data TxSample Source #

Constructors

TxSample |

Fields

- sampleUp :: Int
- sampleDown :: Int
- sampleTime :: SystemTime
- sampleDevice :: String

#### Instances

Instances details

Show TxSample Source # |
Instance details Defined in System.Taffybar.Information.Network Methods showsPrec :: Int -> TxSample -> ShowS Source # show :: TxSample -> String Source # showList :: [TxSample] -> ShowS Source #
Eq TxSample Source # |
Instance details Defined in System.Taffybar.Information.Network Methods (==) :: TxSample -> TxSample -> Bool Source # (/=) :: TxSample -> TxSample -> Bool Source #

monitorNetworkInterfaces :: RealFrac a1 => a1 -> ([(String, (Rational, Rational))] -> IO ()) -> IO () Source #

updateSamples :: [(String, (TxSample, TxSample))] -> IO [(String, (TxSample, TxSample))] Source #

getSpeed :: TxSample -> TxSample -> (Rational, Rational) Source #

sumSpeeds :: [(Rational, Rational)] -> (Rational, Rational) Source #