[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; transition: border-color .5s;
border-radius: 5px; border-radius: 5px;
border-style: solid; border-style: solid;
border-width: 1; border-width: 1px;
border-color: rgba(1.0, 1.0, 1.0, 0.0); border-color: rgba(1.0, 1.0, 1.0, 0.0);
} }
@ -31,7 +31,7 @@
transition: border-color .5s; transition: border-color .5s;
border-radius: 0px; border-radius: 0px;
border-bottom: solid; border-bottom: solid;
border-width: 1; border-width: 1px;
border-color: rgba(1.0, 1.0, 1.0, 0.0); border-color: rgba(1.0, 1.0, 1.0, 0.0);
} }
@ -77,7 +77,7 @@
.TaffyBox { .TaffyBox {
border-bottom: solid; border-bottom: solid;
border-width: 1; border-width: 1px;
border-color: #FFFFFF; border-color: #FFFFFF;
background-color: rgba(0.0, 0.0, 0.0, 0.3); background-color: rgba(0.0, 0.0, 0.0, 0.3);
} }
@ -88,7 +88,20 @@
color: @font-color; color: @font-color;
} }
.menubar * { .Menu * {
background-color: rgba(1.0, 1.0, 1.0, 0.0); color: #FFFFFF;
color: #000000; 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.Process
import System.Taffybar import System.Taffybar
import System.Taffybar.Auth import System.Taffybar.Auth
import System.Taffybar.Compat.GtkLibs
import System.Taffybar.DBus import System.Taffybar.DBus
import System.Taffybar.DBus.Toggle import System.Taffybar.DBus.Toggle
import System.Taffybar.Hooks
import System.Taffybar.IconImages import System.Taffybar.IconImages
import System.Taffybar.Information.CPU import System.Taffybar.Information.CPU
import System.Taffybar.Information.EWMHDesktopInfo import System.Taffybar.Information.EWMHDesktopInfo
@ -48,6 +50,15 @@ import Text.Printf
import Text.Read hiding (lift) import Text.Read hiding (lift)
import Unsafe.Coerce 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 makeContents waction klass = do
widget <- waction widget <- waction
liftIO $ do liftIO $ do
@ -57,11 +68,25 @@ makeContents waction klass = do
Gtk.widgetShowAll b Gtk.widgetShowAll b
return $ Gtk.toWidget 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 = myGraphConfig =
defaultGraphConfig defaultGraphConfig
{ graphPadding = 0 { graphPadding = 0
, graphBorderWidth = 0 , graphBorderWidth = 0
, graphWidth = 75 , graphWidth = 75
, graphBackgroundColor = (1.0, 1.0, 1.0, 0.0)
}
netCfg =
myGraphConfig
{ graphDataColors = [yellow1, yellow2]
, graphLabel = Just "net"
} }
memCfg = memCfg =
@ -175,12 +200,15 @@ main = do
cpuCfg = cpuCfg =
myGraphConfig myGraphConfig
{ graphDataColors = [(0, 1, 0, 1), (1, 0, 1, 0.5)] { graphDataColors = [(0, 1, 0, 1), (1, 0, 1, 0.5)]
, graphBackgroundColor = (1.0, 1.0, 1.0, 0.0)
, graphLabel = Just "cpu" , graphLabel = Just "cpu"
} }
clock = textClockNew Nothing "%a %b %_d %r" 1 clock = textClockNew Nothing "%a %b %_d %r" 1
mpris = mpris2New mpris = mpris2New
cpu = pollingGraphNew cpuCfg 0.5 cpuCallback cpu = pollingGraphNew cpuCfg 0.5 cpuCallback
mem = pollingGraphNew memCfg 1 memCallback mem = pollingGraphNew memCfg 1 memCallback
battery = batteryBarNewWithFormat defaultBatteryConfig
"$percentage$% ($time$) - $status$" 1.0
myWorkspacesConfig = myWorkspacesConfig =
defaultWorkspacesConfig defaultWorkspacesConfig
{ underlineHeight = 3 { underlineHeight = 3
@ -194,24 +222,23 @@ main = do
, updateRateLimitMicroseconds = 100000 , updateRateLimitMicroseconds = 100000
, labelSetter = workspaceNamesLabelSetter , labelSetter = workspaceNamesLabelSetter
} }
netMonitor = netMonitorMultiNew 1.5 interfaceNames
baseConfig = defaultSimpleTaffyConfig baseConfig = defaultSimpleTaffyConfig
{ startWidgets = { startWidgets =
[ workspaces [ workspaces
, makeContents los "Layout" , los >>= buildPadBox
, makeContents wnd "Windows" , wnd >>= buildPadBox
] ]
, endWidgets = , endWidgets = map (>>= buildPadBoxNoShrink)
[ batteryBarNewWithFormat defaultBatteryConfig "$percentage$% ($time$) - $status$" 1.0 [ clock >>= setMinWidth 200
, makeContents sniTrayNew "Cpu" , sniTrayNew
, makeContents clock "Cpu" , github
, github >>= buildPadBox , battery
, makeContents cpu "Cpu" , cpu
, makeContents mem "Cpu" , mem
, makeContents netMonitor "Cpu" , netMonitorGraphNew netCfg Nothing
-- TODO: make support all devices , networkMonitorNew defaultNetFormat Nothing >>= setMinWidth 200
, makeContents (fsMonitorNew 60 ["/dev/sdd2"]) "Cpu" , fsMonitorNew 60 ["/dev/sdd2"]
, mpris >>= buildPadBox , mpris
] ]
, barPosition = Top , barPosition = Top
, barPadding = 0 , barPadding = 0