REF remove useless loglevel at the subfeature level

This commit is contained in:
Nathan Dwarshuis 2022-07-08 19:02:49 -04:00
parent 60a386ea73
commit bdab449be7
6 changed files with 16 additions and 18 deletions

View File

@ -245,8 +245,8 @@ iconDBus_ = iconSometimes' And_ $ Only_ . DBusIO
iconSometimes' :: (t -> t_ -> t) -> (IODependency_ -> t_) -> String
-> (Fontifier -> t -> Root CmdSpec) -> t -> BarFeature
iconSometimes' c d n r t = Sometimes n (const True)
[ Subfeature icon "icon indicator" Error
, Subfeature text "text indicator" Error
[ Subfeature icon "icon indicator"
, Subfeature text "text indicator"
]
where
icon = r fontifyIcon $ c t $ d iconDependency

View File

@ -103,7 +103,7 @@ data FeatureSet = FeatureSet
tabbedFeature :: Always Theme
tabbedFeature = Always "theme for tabbed windows" $ Option sf fallback
where
sf = Subfeature niceTheme "theme with nice font" Error
sf = Subfeature niceTheme "theme with nice font"
niceTheme = IORoot T.tabbedTheme $ fontTree T.defFontFamily
fallback = Always_ $ FallbackAlone $ T.tabbedTheme T.fallbackFont

View File

@ -165,7 +165,6 @@ showKeysDMenu :: SubfeatureRoot ([((KeyMask, KeySym), NamedAction)] -> X ())
showKeysDMenu = Subfeature
{ sfName = "keyboard shortcut menu"
, sfData = IORoot_ showKeys $ Only_ $ sysExe myDmenuCmd
, sfLevel = Warn
}
showKeys :: [((KeyMask, KeySym), NamedAction)] -> X ()

View File

@ -138,7 +138,7 @@ runOptimusPrompt' fb = do
runOptimusPrompt :: SometimesX
runOptimusPrompt = Sometimes "graphics switcher" xpfOptimus [s]
where
s = Subfeature { sfData = r, sfName = "optimus manager", sfLevel = Error }
s = Subfeature { sfData = r, sfName = "optimus manager" }
r = IORoot runOptimusPrompt' t
t = And1 (fontTreeAlt T.defFontFamily)
$ listToAnds (socketExists "optimus-manager" socketName) $ sysExe
@ -174,7 +174,7 @@ instance XPrompt PowerPrompt where
runPowerPrompt :: SometimesX
runPowerPrompt = Sometimes "power prompt" (const True) [sf]
where
sf = Subfeature withLock "prompt with lock" Error
sf = Subfeature withLock "prompt with lock"
withLock = IORoot (uncurry powerPrompt) tree
tree = And12 (,) lockTree (fontTreeAlt T.defFontFamily)
lockTree = Or (Only $ IOSometimes runScreenLock id) (Only $ IOConst skip)

View File

@ -121,7 +121,7 @@ runPowermon = sometimesIO_ "ACPI event monitor" "acpid" socketDep listenACPI
runHandleACPI :: Always (String -> X ())
runHandleACPI = Always "ACPI event handler" $ Option sf fallback
where
sf = Subfeature withLock "acpid prompt" Error
sf = Subfeature withLock "acpid prompt"
withLock = IORoot (uncurry handleACPI)
$ And12 (,) (fontTreeAlt defFontFamily) $ Only
$ IOSometimes runScreenLock id

View File

@ -275,7 +275,6 @@ type Sometimes_ a = [SubfeatureRoot a]
data Subfeature f = Subfeature
{ sfData :: f
, sfName :: String
, sfLevel :: LogLevel
}
-- | Loglevel at which feature testing should be reported
@ -933,19 +932,19 @@ ioRoot (DBusRoot_ a t cl) = DBusRoot_ (io . a) t cl
--------------------------------------------------------------------------------
-- | Feature constructors
sometimes1_ :: (XPFeatures -> Bool) -> LogLevel -> String -> String -> Root a -> Sometimes a
sometimes1_ x l fn n t = Sometimes fn x
[Subfeature{ sfData = t, sfName = n, sfLevel = l }]
sometimes1_ :: (XPFeatures -> Bool) -> String -> String -> Root a -> Sometimes a
sometimes1_ x fn n t = Sometimes fn x
[Subfeature{ sfData = t, sfName = n }]
always1_ :: LogLevel -> String -> String -> Root a -> a -> Always a
always1_ l fn n t x = Always fn
$ Option (Subfeature{ sfData = t, sfName = n, sfLevel = l }) (Always_ $ FallbackAlone x)
always1_ :: String -> String -> Root a -> a -> Always a
always1_ fn n t x = Always fn
$ Option (Subfeature{ sfData = t, sfName = n }) (Always_ $ FallbackAlone x)
sometimes1 :: String -> String -> Root a -> Sometimes a
sometimes1 = sometimes1_ (const True) Error
sometimes1 = sometimes1_ (const True)
always1 :: String -> String -> Root a -> a -> Always a
always1 = always1_ Error
always1 = always1_
sometimesIO_ :: String -> String -> IOTree_ -> a -> Sometimes a
sometimesIO_ fn n t x = sometimes1 fn n $ IORoot_ x t