Quite a few things
- License - Bits of code - The flake - A .gitignore file for Cabal output
This commit is contained in:
parent
20304248aa
commit
15dc44c40f
5 changed files with 127 additions and 4 deletions
13
app/Main.hs
13
app/Main.hs
|
@ -1,5 +1,10 @@
|
|||
batteryCapacityFile = "/sys/class/power_supply/BAT0/capacity" :: FilePath
|
||||
batteryStatusFile = "/sys/class/power_supply/BAT0/status" :: FilePath
|
||||
module Main where
|
||||
|
||||
batteryCapacityFile :: String
|
||||
batteryCapacityFile = "/sys/class/power_supply/BAT0/capacity"
|
||||
|
||||
batteryStatusFile :: FilePath
|
||||
batteryStatusFile = "/sys/class/power_supply/BAT0/status"
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
|
@ -12,8 +17,8 @@ formatInfo status capacity = icon ++ " " ++ init capacity ++ "%"
|
|||
where icon
|
||||
| init status == "Full" = "🙂"
|
||||
| init status == "Charging" = "🔋"
|
||||
| init status == "Discharging" = "🙃"
|
||||
| init status == "Not charging" = "♻"
|
||||
| init status == "Unknown" = "Unknown"
|
||||
| read capacity <= 20 = "🪫"
|
||||
| read capacity <= 100 = "🙃"
|
||||
| (read capacity :: Int) <= 20 = "🪫"
|
||||
| otherwise = "Silly"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue