Skip to content
Snippets Groups Projects
Commit 2a2cd827 authored by Jens Nolte's avatar Jens Nolte
Browse files

Move blocks that require external scripts from default- to legacy config

parent 0ae35d02
No related branches found
No related tags found
No related merge requests found
......@@ -67,7 +67,14 @@ barConfigurationParser = do
l -> sequence_ l
blockParser :: Parser (BarIO ())
blockParser = hsubparser (
command "default" (info (pure defaultBarConfig) (progDesc "Load default set of blocks.")) <>
blockParser = subparser (
commandGroup "Available blocks:" <>
command "date" (info (pure $ addBlock dateBlock) (progDesc "Load the date and time block."))
)
<|>
subparser (
hidden <>
commandGroup "Available presets:" <>
command "default" (info (pure defaultBarConfig) (progDesc "Load default set of blocks.")) <>
command "legacy" (info (pure legacyBarConfig) (progDesc "Load the legacy configuration. Requires some custom block scripts."))
)
......@@ -8,13 +8,26 @@ import Pipes
import Control.Lens
blockLocation :: String -> FilePath
blockLocation name = "~/.config/qbar/blocks/" <> name
defaultBarConfig :: BarIO ()
defaultBarConfig = do
systemInfoInterval <- sharedInterval 10
let battery = systemInfoInterval $ batteryBlock >-> modify (blockName ?~ "battery")
let cpuUsage = systemInfoInterval $ cpuUsageBlock 1 >-> modify ((blockName ?~ "cpuUsage") . addIcon "💻\xFE0E")
-- TODO: commented-out blocks should be added as soon as they are implemented in qbar
addBlock dateBlock
addBlock battery
--addBlock volumeBlock
addBlock cpuUsage
--addBlock ramUsageBlock
--addBlock cpuTemperatureBlock
--addBlock networkBlock
legacyBarConfig :: BarIO ()
legacyBarConfig = do
systemInfoInterval <- sharedInterval 10
let todo = systemInfoInterval (blockScript $ blockLocation "todo")
let wifi = systemInfoInterval $ (blockScript $ blockLocation "wifi2") >-> modify (addIcon "📡\xFE0E")
let networkEnvironment = systemInfoInterval (blockScript $ blockLocation "network-environment")
......@@ -33,3 +46,6 @@ defaultBarConfig = do
addBlock networkEnvironment
addBlock wifi
addBlock todo
where
blockLocation :: String -> FilePath
blockLocation name = "~/.config/qbar/blocks/" <> name
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment