[taffybar] Use separate config for each machine

This commit is contained in:
Ivan Malison 2019-02-13 10:10:40 -08:00
parent 06758ccff7
commit 32f99a2744
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8
5 changed files with 135 additions and 11 deletions

View File

@ -27,11 +27,13 @@ executable imalison-taffybar
, gtk-sni-tray , gtk-sni-tray
, gtk-strut , gtk-strut
, haskell-gi-base , haskell-gi-base
, hostname
, hslogger , hslogger
, process , process
, split , split
, taffybar , taffybar
, transformers , transformers
, xdg-basedir
, xmonad-contrib>=0.13 , xmonad-contrib>=0.13
, xmonad>=0.13 , xmonad>=0.13
default-language: Haskell2010 default-language: Haskell2010

View File

@ -21,14 +21,14 @@ extra-deps:
- X11-1.8 - X11-1.8
- X11-xft-0.3.1 - X11-xft-0.3.1
- containers-0.5.11.0 - containers-0.5.11.0
- dbus-1.0.1 - dbus-1.2.1
- dbus-hslogger-0.1.0.1 - dbus-hslogger-0.1.0.1
- gi-cairo-connector-0.0.1 - gi-cairo-connector-0.0.1
- gi-cairo-render-0.0.1 - gi-cairo-render-0.0.1
- gi-dbusmenu-0.4.1 - gi-dbusmenu-0.4.1
- gi-dbusmenugtk3-0.4.1 - gi-dbusmenugtk3-0.4.1
- gi-gdk-3.0.15 - gi-gdk-3.0.15
- gi-gdkpixbuf-2.0.16 - gi-gdkpixbuf-2.0.18
- gi-gdkx11-3.0.4 - gi-gdkx11-3.0.4
- gi-gio-2.0.16 - gi-gio-2.0.16
- gi-glib-2.0.17 - gi-glib-2.0.17
@ -44,7 +44,7 @@ extra-deps:
- libxml-sax-0.7.5 - libxml-sax-0.7.5
- rate-limit-1.4.1 - rate-limit-1.4.1
- spool-0.1 - spool-0.1
- status-notifier-item-0.3.0.0 - status-notifier-item-0.3.0.1
- stm-2.5.0.0 - stm-2.5.0.0
- time-units-1.0.0 - time-units-1.0.0
- xml-helpers-1.0.0 - xml-helpers-1.0.0

@ -1 +1 @@
Subproject commit cc815a70cacd22203e0cc1e1f0484be388ae6ccb Subproject commit 03833af2040a83b0d57eceb4cced0f61e92461a0

View File

@ -11,7 +11,7 @@ import Data.List
import Data.List.Split import Data.List.Split
import qualified Data.Map as M import qualified Data.Map as M
import Data.Maybe import Data.Maybe
import qualified GitHub.Auth as Auth import Network.HostName
import StatusNotifier.Tray import StatusNotifier.Tray
import System.Directory import System.Directory
import System.Environment import System.Environment
@ -30,6 +30,7 @@ import System.Taffybar.Information.CPU
import System.Taffybar.Information.EWMHDesktopInfo import System.Taffybar.Information.EWMHDesktopInfo
import System.Taffybar.Information.Memory import System.Taffybar.Information.Memory
import System.Taffybar.Information.X11DesktopInfo import System.Taffybar.Information.X11DesktopInfo
import System.Environment.XDG.BaseDir
import System.Taffybar.SimpleConfig import System.Taffybar.SimpleConfig
import System.Taffybar.Util import System.Taffybar.Util
import System.Taffybar.Widget import System.Taffybar.Widget
@ -99,8 +100,16 @@ logDebug = do
workspacesLogger <- getLogger "System.Taffybar.Widget.Workspaces" workspacesLogger <- getLogger "System.Taffybar.Widget.Workspaces"
saveGlobalLogger $ setLevel WARNING workspacesLogger saveGlobalLogger $ setLevel WARNING workspacesLogger
cssFileByHostname =
[ ("uber-loaner", "uber-loaner.css")
, ("imalison-home", "taffybar.css")
]
main = do main = do
hostName <- getHostName
homeDirectory <- getHomeDirectory homeDirectory <- getHomeDirectory
let cssFileName = lookup hostName cssFileByHostname
cssFilePath <- traverse (getUserConfigFile "taffybar") cssFileName
-- logDebug -- logDebug
-- logM "What" WARNING "Why" -- logM "What" WARNING "Why"
-- enableLogger "System.Taffybar.Widget.Util" DEBUG -- enableLogger "System.Taffybar.Widget.Util" DEBUG
@ -153,7 +162,8 @@ main = do
] ]
, barPosition = Top , barPosition = Top
, barPadding = 0 , barPadding = 0
, barHeight = 45 , barHeight = 30
, cssPath = cssFilePath
} }
simpleTaffyConfig = baseConfig simpleTaffyConfig = baseConfig
{ centerWidgets = map (>>= buildContentsBox) [] { centerWidgets = map (>>= buildContentsBox) []
@ -163,11 +173,6 @@ main = do
startTaffybar $ startTaffybar $
appendHook notifySystemD $ appendHook notifySystemD $
appendHook (void $ getHost False) $ appendHook (void $ getHost False) $
withBatteryRefresh $
withLogServer $ withLogServer $
withToggleServer $ withToggleServer $
toTaffyConfig simpleTaffyConfig toTaffyConfig simpleTaffyConfig
-- Local Variables:
-- flycheck-ghc-args: ("-Wno-missing-signatures")
-- End:

View File

@ -0,0 +1,117 @@
@define-color transparent rgba(0.0, 0.0, 0.0, 0.0);
@define-color white #FFFFFF;
@define-color black #000000;
@define-color taffy-blue #0c7cd5;
@define-color active-window-color @white;
@define-color urgent-window-color @taffy-blue;
@define-color font-color @black;
@define-color menu-background-color @white;
@define-color menu-font-color @black;
/* Top level styling */
.taffy-window * {
font-family: "Noto Sans", sans-serif;
font-size: 10pt;
color: @font-color;
}
.taffy-box {
border-color: @white;
border-style: solid;
border-radius: 0px;
}
.inner-pad {
padding: 1px;
}
.contents {
padding: 1px;
transition: background-color .5s;
border-radius: 6px;
}
/* Workspaces styling */
.workspace-label {
padding-right: 3px;
padding-left: 2px;
font-size: 10pt;
}
.active .contents {
background-color: rgba(0.0, 0.0, 0.0, 0.2);
}
.visible .contents {
background-color: rgba(0.0, 0.0, 0.0, 0.2);
}
.window-icon-container {
transition: opacity .5s, box-shadow .5s;
opacity: 1;
border-radius: 5px;
transition: background-color 1s;
}
/* This gives space for the box-shadow (they look like underlines) that follow.
This will actually affect all widgets, (not just the workspace icons), but
that is what we want since we want the icons to look the same. */
.auto-size-image, .sni-tray {
padding: 1px;
}
.window-icon-container.active {
background-color: rgba(255.0, 255.0, 255.0, 0.3);
}
.window-icon-container.urgent {
}
.window-icon-container.inactive .window-icon {
padding: 0px;
}
.window-icon-container.minimized .window-icon {
opacity: .3;
}
.window-icon {
opacity: 1;
transition: opacity .5s;
}
/* Button styling */
button {
all: initial;
background-color: @transparent;
border-width: 0px;
border-radius: 0px;
}
button:checked, button:hover .Contents:hover {
box-shadow: inset 0 -3px @taffy-blue;
}
/* Menu styling */
/* The ".taffy-window" prefixed selectors are needed because if they aren't present,
the top level .Taffybar selector takes precedence */
.taffy-window menuitem *, menuitem * {
color: @menu-font-color;
}
.taffy-window menuitem, menuitem {
background-color: @menu-background-color;
}
.taffy-window menuitem:hover, menuitem:hover {
background-color: @taffy-blue;
}
.taffy-window menuitem:hover > label, menuitem:hover > label {
color: @white;
}