From bdab449be7b214021dcea444a150153be80b8790 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Fri, 8 Jul 2022 19:02:49 -0400 Subject: [PATCH] REF remove useless loglevel at the subfeature level --- bin/xmobar.hs | 4 ++-- bin/xmonad.hs | 2 +- lib/XMonad/Internal/Command/DMenu.hs | 1 - lib/XMonad/Internal/Command/Power.hs | 4 ++-- lib/XMonad/Internal/Concurrent/ACPIEvent.hs | 2 +- lib/XMonad/Internal/Dependency.hs | 21 ++++++++++----------- 6 files changed, 16 insertions(+), 18 deletions(-) diff --git a/bin/xmobar.hs b/bin/xmobar.hs index ed45be2..aee91fe 100644 --- a/bin/xmobar.hs +++ b/bin/xmobar.hs @@ -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 diff --git a/bin/xmonad.hs b/bin/xmonad.hs index 19b3047..4d372b9 100644 --- a/bin/xmonad.hs +++ b/bin/xmonad.hs @@ -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 diff --git a/lib/XMonad/Internal/Command/DMenu.hs b/lib/XMonad/Internal/Command/DMenu.hs index 5c1aa48..2e30f2a 100644 --- a/lib/XMonad/Internal/Command/DMenu.hs +++ b/lib/XMonad/Internal/Command/DMenu.hs @@ -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 () diff --git a/lib/XMonad/Internal/Command/Power.hs b/lib/XMonad/Internal/Command/Power.hs index 643940c..7c2bb8f 100644 --- a/lib/XMonad/Internal/Command/Power.hs +++ b/lib/XMonad/Internal/Command/Power.hs @@ -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) diff --git a/lib/XMonad/Internal/Concurrent/ACPIEvent.hs b/lib/XMonad/Internal/Concurrent/ACPIEvent.hs index 1bccb3e..661e111 100644 --- a/lib/XMonad/Internal/Concurrent/ACPIEvent.hs +++ b/lib/XMonad/Internal/Concurrent/ACPIEvent.hs @@ -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 diff --git a/lib/XMonad/Internal/Dependency.hs b/lib/XMonad/Internal/Dependency.hs index df8a37d..08b8bb7 100644 --- a/lib/XMonad/Internal/Dependency.hs +++ b/lib/XMonad/Internal/Dependency.hs @@ -273,9 +273,8 @@ type Sometimes_ a = [SubfeatureRoot a] -- the 'action' itself to be tested and any auxilary data for describing the -- sub-feature. data Subfeature f = Subfeature - { sfData :: f - , sfName :: String - , sfLevel :: LogLevel + { sfData :: f + , sfName :: String } -- | 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