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 iconSometimes' :: (t -> t_ -> t) -> (IODependency_ -> t_) -> String
-> (Fontifier -> t -> Root CmdSpec) -> t -> BarFeature -> (Fontifier -> t -> Root CmdSpec) -> t -> BarFeature
iconSometimes' c d n r t = Sometimes n (const True) iconSometimes' c d n r t = Sometimes n (const True)
[ Subfeature icon "icon indicator" Error [ Subfeature icon "icon indicator"
, Subfeature text "text indicator" Error , Subfeature text "text indicator"
] ]
where where
icon = r fontifyIcon $ c t $ d iconDependency icon = r fontifyIcon $ c t $ d iconDependency

View File

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

View File

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

View File

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

View File

@ -273,9 +273,8 @@ type Sometimes_ a = [SubfeatureRoot a]
-- the 'action' itself to be tested and any auxilary data for describing the -- the 'action' itself to be tested and any auxilary data for describing the
-- sub-feature. -- sub-feature.
data Subfeature f = Subfeature data Subfeature f = Subfeature
{ sfData :: f { sfData :: f
, sfName :: String , sfName :: String
, sfLevel :: LogLevel
} }
-- | Loglevel at which feature testing should be reported -- | Loglevel at which feature testing should be reported
@ -933,19 +932,19 @@ ioRoot (DBusRoot_ a t cl) = DBusRoot_ (io . a) t cl
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- | Feature constructors -- | Feature constructors
sometimes1_ :: (XPFeatures -> Bool) -> LogLevel -> String -> String -> Root a -> Sometimes a sometimes1_ :: (XPFeatures -> Bool) -> String -> String -> Root a -> Sometimes a
sometimes1_ x l fn n t = Sometimes fn x sometimes1_ x fn n t = Sometimes fn x
[Subfeature{ sfData = t, sfName = n, sfLevel = l }] [Subfeature{ sfData = t, sfName = n }]
always1_ :: LogLevel -> String -> String -> Root a -> a -> Always a always1_ :: String -> String -> Root a -> a -> Always a
always1_ l fn n t x = Always fn always1_ fn n t x = Always fn
$ Option (Subfeature{ sfData = t, sfName = n, sfLevel = l }) (Always_ $ FallbackAlone x) $ Option (Subfeature{ sfData = t, sfName = n }) (Always_ $ FallbackAlone x)
sometimes1 :: String -> String -> Root a -> Sometimes a 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 :: String -> String -> Root a -> a -> Always a
always1 = always1_ Error always1 = always1_
sometimesIO_ :: String -> String -> IOTree_ -> a -> Sometimes a sometimesIO_ :: String -> String -> IOTree_ -> a -> Sometimes a
sometimesIO_ fn n t x = sometimes1 fn n $ IORoot_ x t sometimesIO_ fn n t x = sometimes1 fn n $ IORoot_ x t