-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvement in BatteryBar and CPUTemperature #157
Conversation
| let template = ST.newSTMP fmt | ||
| let template' = ST.setManyAttrib [ ("user", userLoad'), | ||
| ("system", systemLoad'), | ||
| ("total", totalLoad') ] template | ||
| ("total", totalLoad'), | ||
| ("temp",cpuTemp')] template |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
documentation string needs to be updated in the usage. otherwise: nice job, i've been looking for something like this.
taffybar.cabal
Outdated
| @@ -53,7 +53,8 @@ library | |||
| safe >= 0.3 && < 1, | |||
| split >= 0.1.4.2, | |||
| process >= 1.0.1.1, | |||
| enclosed-exceptions >= 1.0.0.1 | |||
| enclosed-exceptions >= 1.0.0.1, | |||
| gtk2hs-buildtools >= 0.13.0.0 | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this necessary?
|
@vanjo9800 there was a new major release, so you'll need to reroll your changes to fix the conflicts here. |
|
@anarcat any interest in taking this over? |
|
i'm not sure i'm the right person to do this. all my Haskell experiments are cargo-culting and voodoo experiments... after much pain, i have arrived at this nasty piece of business: tempZoneWidget :: Int -> IO Widget
tempZoneWidget zone = do
label <- pollingLabelNew "N/A C" 1.0 $ callback
widgetShowAll label
return label
where
path = "/sys/devices/virtual/thermal/thermal_zone" ++ show zone ++ "/temp"
callback = do
temp <- readFile $ path
let tempn = (read temp) :: Int
let tempd = (fromIntegral tempn) / 1000
fmt :: Double -> String
fmt celc = printf "zone%d: %f°C" zone celc
return (fmt tempd)... which is used, clunkily, as: main = do
let
temp0 = tempZoneWidget 0
temp3 = tempZoneWidget 3
defaultTaffybar defaultTaffybarConfig { startWidgets = [ pager ], endWidgets = [ temp0, temp3 ] }surely there is a better way, particularly to get autodiscovery of the available temperatures, but I really got tired of this and stopped there... suggestions? |
|
@anarcat @vanjo9800 see changes that were recently pushed to master as part of integrating #119 |
|
i guess the problem i had with getCPUTemp is i had trouble turning it into a working widget... any suggestions? |
|
@anarcat If you just want a text widget it should be really easy |
|
Something like getAverageTemp = fromMaybe "Error" . fmap (show . snd) <$> getMTuple
where getMTuple = lookup "temp1_input" <$> getCPUTemperatures
cpuTemp = pollingLabelNew "" 15.0 getAverageTempprobably won't compile, but you can figure out the details. |
|
@anarcat You can ping me on https://gitter.im/taffybar/Lobby if you have any more questions |
|
@IvanMalison yes, a text widget. assume I have no clue what i'm doing and the above is just something i cargo-culted and bruteforced until it worked. :p |
|
@anarcat did you try what I posted? You'll need to import Data.Maybe |
|
oops, sorry - i hadn't see the previous comment showing how to actually build the widget! :) i need to deploy the latest source, i still haven't managed to do that just yet... sorry for the delay and confusion! it looks like the code snippet you provided shows temperature for probe 1, is there a way to show all available probes? |
|
I believe that temp1 is the aggregated temperature. If you REALLY want all of the temperatures, something like: that will just make the label be a comma separated list of the temperatures. Not sure if that is what you want. |
I have designed a convenient way to see the remaining time of the battery when still seeing the icon. I have also made it easier to access the CPU temperature directly from the configuration using$temp$ .