diff options
author | Fabian Kirchner <kirchner@posteo.de> | 2024-08-12 14:04:31 +0200 |
---|---|---|
committer | Fabian Kirchner <kirchner@posteo.de> | 2024-08-12 14:04:31 +0200 |
commit | bb8fc0abf3d55f292601d04517818f74f79c6e30 (patch) | |
tree | 28c06fa821470d0d94b88ca69604327d94d4922a /app | |
parent | b28555a116278861ffbbfc43199a470e438d45f4 (diff) |
feat:adjust snd icon depending on value
Diffstat (limited to 'app')
-rw-r--r-- | app/Main.hs | 4 | ||||
-rw-r--r-- | app/Sensor.hs | 11 |
2 files changed, 11 insertions, 4 deletions
diff --git a/app/Main.hs b/app/Main.hs index caee3fb..0ed59de 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -192,8 +192,8 @@ createWindow args = do [pure (lit (if args.icons then "\xf0a0 " else "disk ")), lit <$> disk], [pure (lit (if args.icons then "\xf1638 " else "io ")), lit <$> io], [pure (lit (if args.icons then "\xf0200 " else "net ")), lit <$> net], - [pure (lit (if args.icons then "\xf028 " else "snd ")), lit <$> Sensor.snd], - [lit <$> bat], + [pure (lit " "), lit <$> Sensor.snd], + [pure (lit " "), lit <$> bat], [pure (lit " "), lit <$> date, pure (lit ", "), lit <$> time], [] ] diff --git a/app/Sensor.hs b/app/Sensor.hs index 2dcf6c0..0c05519 100644 --- a/app/Sensor.hs +++ b/app/Sensor.hs @@ -230,8 +230,15 @@ instance (S.MonadSensor m) => S.Aggregate m Snd Float where where parse = liftIO do (/ 153) . read <$> [sh|pamixer --get-volume|] -snd :: (S.MonadSensor m) => S.Sensor m () Float -snd = S.sensor Snd +snd :: (S.MonadSensor m) => S.Sensor m () String +snd = do + value <- S.sensor Snd + return + ( if + | 0.4 < value -> "\xf028" + | 0.0 < value -> "\xf027" + | otherwise -> "\xf026" + ) data DiskStat = DiskStat deriving (Show) |