[taffybar] New styling, use new network monitor widgets

This commit is contained in:
Ivan Malison 2018-05-03 22:42:39 -07:00
parent f00cf29a48
commit 0b4c39ed81
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8
3 changed files with 61 additions and 21 deletions

@ -1 +1 @@
Subproject commit 25f5c507598fdcb1b1c490ac9ec993e443422d9d
Subproject commit ca3aa9e528e92a1eb248f8632b4e5db0b640b947

View File

@ -9,7 +9,7 @@
transition: border-color .5s;
border-radius: 5px;
border-style: solid;
border-width: 1;
border-width: 1px;
border-color: rgba(1.0, 1.0, 1.0, 0.0);
}
@ -31,7 +31,7 @@
transition: border-color .5s;
border-radius: 0px;
border-bottom: solid;
border-width: 1;
border-width: 1px;
border-color: rgba(1.0, 1.0, 1.0, 0.0);
}
@ -77,7 +77,7 @@
.TaffyBox {
border-bottom: solid;
border-width: 1;
border-width: 1px;
border-color: #FFFFFF;
background-color: rgba(0.0, 0.0, 0.0, 0.3);
}
@ -88,7 +88,20 @@
color: @font-color;
}
.menubar * {
background-color: rgba(1.0, 1.0, 1.0, 0.0);
color: #000000;
.Menu * {
color: #FFFFFF;
background-color: rgba(1.0, 1.0, 1.0, 1.0);
}
.OuterPad * {
background-color: rgba(1.0, 0.0, 0.0, 0.0);
}
.OuterPad:focus {
background-color: rgba(0.0, 0.0, 0.0, 0.3);
box-shadow: inset 0 -3px #0c7cd5;
}
.OuterPad *:hover {
box-shadow: inset 0 -3px #0c7cd5;
}

View File

@ -33,8 +33,10 @@ import System.Log.Logger
import System.Process
import System.Taffybar
import System.Taffybar.Auth
import System.Taffybar.Compat.GtkLibs
import System.Taffybar.DBus
import System.Taffybar.DBus.Toggle
import System.Taffybar.Hooks
import System.Taffybar.IconImages
import System.Taffybar.Information.CPU
import System.Taffybar.Information.EWMHDesktopInfo
@ -48,6 +50,15 @@ import Text.Printf
import Text.Read hiding (lift)
import Unsafe.Coerce
buildPadBoxNoShrink orig = liftIO $ do
widget <- buildPadBox orig
-- toGIWidget widget >>= widgetPreventShrink
return widget
setMinWidth width widget = liftIO $ do
Gtk.widgetSetSizeRequest widget width (-1)
return widget
makeContents waction klass = do
widget <- waction
liftIO $ do
@ -57,11 +68,25 @@ makeContents waction klass = do
Gtk.widgetShowAll b
return $ Gtk.toWidget b
mkRGBA (r, g, b, a) = (r/256, g/256, b/256, a/256)
blue = mkRGBA (42, 99, 140, 256)
yellow1 = mkRGBA (242, 163, 54, 256)
yellow2 = mkRGBA (254, 204, 83, 256)
yellow3 = mkRGBA (227, 134, 18, 256)
red = mkRGBA (210, 77, 37, 256)
myGraphConfig =
defaultGraphConfig
{ graphPadding = 0
, graphBorderWidth = 0
, graphWidth = 75
, graphBackgroundColor = (1.0, 1.0, 1.0, 0.0)
}
netCfg =
myGraphConfig
{ graphDataColors = [yellow1, yellow2]
, graphLabel = Just "net"
}
memCfg =
@ -175,12 +200,15 @@ main = do
cpuCfg =
myGraphConfig
{ graphDataColors = [(0, 1, 0, 1), (1, 0, 1, 0.5)]
, graphBackgroundColor = (1.0, 1.0, 1.0, 0.0)
, graphLabel = Just "cpu"
}
clock = textClockNew Nothing "%a %b %_d %r" 1
mpris = mpris2New
cpu = pollingGraphNew cpuCfg 0.5 cpuCallback
mem = pollingGraphNew memCfg 1 memCallback
battery = batteryBarNewWithFormat defaultBatteryConfig
"$percentage$% ($time$) - $status$" 1.0
myWorkspacesConfig =
defaultWorkspacesConfig
{ underlineHeight = 3
@ -194,24 +222,23 @@ main = do
, updateRateLimitMicroseconds = 100000
, labelSetter = workspaceNamesLabelSetter
}
netMonitor = netMonitorMultiNew 1.5 interfaceNames
baseConfig = defaultSimpleTaffyConfig
{ startWidgets =
[ workspaces
, makeContents los "Layout"
, makeContents wnd "Windows"
, los >>= buildPadBox
, wnd >>= buildPadBox
]
, endWidgets =
[ batteryBarNewWithFormat defaultBatteryConfig "$percentage$% ($time$) - $status$" 1.0
, makeContents sniTrayNew "Cpu"
, makeContents clock "Cpu"
, github >>= buildPadBox
, makeContents cpu "Cpu"
, makeContents mem "Cpu"
, makeContents netMonitor "Cpu"
-- TODO: make support all devices
, makeContents (fsMonitorNew 60 ["/dev/sdd2"]) "Cpu"
, mpris >>= buildPadBox
, endWidgets = map (>>= buildPadBoxNoShrink)
[ clock >>= setMinWidth 200
, sniTrayNew
, github
, battery
, cpu
, mem
, netMonitorGraphNew netCfg Nothing
, networkMonitorNew defaultNetFormat Nothing >>= setMinWidth 200
, fsMonitorNew 60 ["/dev/sdd2"]
, mpris
]
, barPosition = Top
, barPadding = 0