[taffybar] Separate configuration for each machine
This commit is contained in:
parent
88ed7bcc2e
commit
936dd4e063
@ -1 +1 @@
|
|||||||
Subproject commit a4e87a50f5263fc2f6a5fe8eaf08c1688071bdad
|
Subproject commit e58efd030328aea6dc808749edcd5a3fabfee3e3
|
@ -99,6 +99,12 @@ logDebug = do
|
|||||||
saveGlobalLogger $ setLevel DEBUG logger2
|
saveGlobalLogger $ setLevel DEBUG logger2
|
||||||
workspacesLogger <- getLogger "System.Taffybar.Widget.Workspaces"
|
workspacesLogger <- getLogger "System.Taffybar.Widget.Workspaces"
|
||||||
saveGlobalLogger $ setLevel WARNING workspacesLogger
|
saveGlobalLogger $ setLevel WARNING workspacesLogger
|
||||||
|
-- logDebug
|
||||||
|
-- logM "What" WARNING "Why"
|
||||||
|
-- enableLogger "System.Taffybar.Widget.Util" DEBUG
|
||||||
|
-- enableLogger "System.Taffybar.Information.XDG.DesktopEntry" DEBUG
|
||||||
|
-- enableLogger "System.Taffybar.WindowIcon" DEBUG
|
||||||
|
-- enableLogger "System.Taffybar.Widget.Generic.PollingLabel" DEBUG
|
||||||
|
|
||||||
cssFileByHostname =
|
cssFileByHostname =
|
||||||
[ ("uber-loaner", "uber-loaner.css")
|
[ ("uber-loaner", "uber-loaner.css")
|
||||||
@ -108,24 +114,14 @@ cssFileByHostname =
|
|||||||
main = do
|
main = do
|
||||||
hostName <- getHostName
|
hostName <- getHostName
|
||||||
homeDirectory <- getHomeDirectory
|
homeDirectory <- getHomeDirectory
|
||||||
let cssFileName = lookup hostName cssFileByHostname
|
cssFilePath <-
|
||||||
cssFilePath <- traverse (getUserConfigFile "taffybar") cssFileName
|
traverse (getUserConfigFile "taffybar") $ lookup hostName cssFileByHostname
|
||||||
-- logDebug
|
let cpuGraph = pollingGraphNew cpuCfg 5 cpuCallback
|
||||||
-- logM "What" WARNING "Why"
|
memoryGraph = pollingGraphNew memCfg 5 memCallback
|
||||||
-- enableLogger "System.Taffybar.Widget.Util" DEBUG
|
|
||||||
-- enableLogger "System.Taffybar.Information.XDG.DesktopEntry" DEBUG
|
|
||||||
-- enableLogger "System.Taffybar.WindowIcon" DEBUG
|
|
||||||
let resourcesDirectory = homeDirectory </> ".lib" </> "resources"
|
|
||||||
inResourcesDirectory file = resourcesDirectory </> file
|
|
||||||
highContrastDirectory =
|
|
||||||
"/" </> "usr" </> "share" </> "icons" </> "HighContrast" </> "256x256"
|
|
||||||
inHighContrastDirectory file = highContrastDirectory </> file
|
|
||||||
myIcons = scaledWindowIconPixbufGetter $
|
myIcons = scaledWindowIconPixbufGetter $
|
||||||
getWindowIconPixbufFromChrome <|||>
|
getWindowIconPixbufFromChrome <|||>
|
||||||
unscaledDefaultGetWindowIconPixbuf <|||>
|
unscaledDefaultGetWindowIconPixbuf <|||>
|
||||||
(\size _ -> lift $ loadPixbufByName size "application-default-icon")
|
(\size _ -> lift $ loadPixbufByName size "application-default-icon")
|
||||||
cpu = pollingGraphNew cpuCfg 0.5 cpuCallback
|
|
||||||
mem = pollingGraphNew memCfg 1 memCallback
|
|
||||||
layout = layoutNew defaultLayoutConfig
|
layout = layoutNew defaultLayoutConfig
|
||||||
windows = windowsNew defaultWindowsConfig
|
windows = windowsNew defaultWindowsConfig
|
||||||
notifySystemD = void $ runCommandFromPath ["systemd-notify", "--ready"]
|
notifySystemD = void $ runCommandFromPath ["systemd-notify", "--ready"]
|
||||||
@ -135,40 +131,50 @@ main = do
|
|||||||
, underlinePadding = 2
|
, underlinePadding = 2
|
||||||
, minIcons = 1
|
, minIcons = 1
|
||||||
, getWindowIconPixbuf = myIcons
|
, getWindowIconPixbuf = myIcons
|
||||||
-- , windowIconSize = 31
|
|
||||||
, widgetGap = 0
|
, widgetGap = 0
|
||||||
, showWorkspaceFn = hideEmpty
|
, showWorkspaceFn = hideEmpty
|
||||||
, updateRateLimitMicroseconds = 100000
|
, updateRateLimitMicroseconds = 100000
|
||||||
, labelSetter = workspaceNamesLabelSetter
|
, labelSetter = workspaceNamesLabelSetter
|
||||||
}
|
}
|
||||||
workspaces = workspacesNew myWorkspacesConfig
|
workspaces = workspacesNew myWorkspacesConfig
|
||||||
baseConfig =
|
fullEndWidgets =
|
||||||
defaultSimpleTaffyConfig
|
map (>>= buildContentsBox)
|
||||||
{ startWidgets =
|
|
||||||
workspaces : map (>>= buildContentsBox) [layout, windows]
|
|
||||||
, endWidgets =
|
|
||||||
map
|
|
||||||
(>>= buildContentsBox)
|
|
||||||
[ textBatteryNew "$percentage$%"
|
[ textBatteryNew "$percentage$%"
|
||||||
, batteryIconNew
|
, batteryIconNew
|
||||||
, textClockNew Nothing "%a %b %_d %r" 1
|
, textClockNewWith defaultClockConfig
|
||||||
, sniTrayNew
|
, sniTrayNew
|
||||||
, cpu
|
, cpuGraph
|
||||||
, mem
|
, memoryGraph
|
||||||
, networkGraphNew netCfg Nothing
|
, networkGraphNew netCfg Nothing
|
||||||
-- , networkMonitorNew defaultNetFormat Nothing >>= setMinWidth 200
|
-- , networkMonitorNew defaultNetFormat Nothing >>= setMinWidth 200
|
||||||
-- , fsMonitorNew 60 ["/dev/sdd2"]
|
-- , fsMonitorNew 60 ["/dev/sdd2"]
|
||||||
, mpris2New
|
, mpris2New
|
||||||
]
|
]
|
||||||
|
shortLaptopEndWidgets =
|
||||||
|
map (>>= buildContentsBox)
|
||||||
|
[ batteryIconNew
|
||||||
|
, textBatteryNew "$percentage$%"
|
||||||
|
, textClockNewWith defaultClockConfig
|
||||||
|
, sniTrayNew
|
||||||
|
]
|
||||||
|
baseConfig =
|
||||||
|
defaultSimpleTaffyConfig
|
||||||
|
{ startWidgets =
|
||||||
|
workspaces : map (>>= buildContentsBox) [layout, windows]
|
||||||
|
, endWidgets = fullEndWidgets
|
||||||
, barPosition = Top
|
, barPosition = Top
|
||||||
, barPadding = 0
|
, barPadding = 0
|
||||||
, barHeight = 30
|
, barHeight = 30
|
||||||
, cssPath = cssFilePath
|
, cssPath = cssFilePath
|
||||||
}
|
}
|
||||||
|
selectedConfig = fromMaybe baseConfig $
|
||||||
|
lookup hostName
|
||||||
|
[ ("uber-loaner", baseConfig { endWidgets = shortLaptopEndWidgets } )
|
||||||
|
, ("imalison-home", baseConfig { endWidgets = fullEndWidgets } )
|
||||||
|
]
|
||||||
simpleTaffyConfig = baseConfig
|
simpleTaffyConfig = baseConfig
|
||||||
{ centerWidgets = map (>>= buildContentsBox) []
|
{ centerWidgets = map (>>= buildContentsBox) []
|
||||||
-- , endWidgets = map (>>= buildContentsBox) [ sniTrayNew, mpris2New ]
|
-- , endWidgets = []
|
||||||
-- , startWidgets = [flip widgetSetClass "Workspaces" =<< workspaces]
|
|
||||||
}
|
}
|
||||||
startTaffybar $
|
startTaffybar $
|
||||||
appendHook notifySystemD $
|
appendHook notifySystemD $
|
||||||
|
Loading…
Reference in New Issue
Block a user