This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################# | |
# CORE SETTINGS # | |
################# | |
# | |
# Zim settings | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- dev is the device that shall be read (Like "BAT0") | |
-- attr are the attributes that are going to be read ("status" for charging status, "capacity" for charged capacity, and so on) | |
acpi_power :: String -> [String] -> Logger | |
acpi_power dev attr = io $ do | |
attrOut <- mapM (\x -> liftIO $ readFile $ sysFsPath ++ x) attr | |
return $ Just $ filter (/= '\n') (intercalate " " attrOut) | |
where | |
sysFsPath = "/sys/class/power_supply/" ++ dev ++ "/" |
NewerOlder