diff --git a/bin/xmobar.hs b/bin/xmobar.hs index d3793c9..c25989f 100644 --- a/bin/xmobar.hs +++ b/bin/xmobar.hs @@ -314,6 +314,7 @@ getBattery :: BarFeature getBattery = Feature { ftrAction = batteryCmd , ftrSilent = False + , ftrDefault = Nothing , ftrChildren = [Dependency { depRequired = True, depData = IOTest hasBattery }] } @@ -323,6 +324,7 @@ getVPN :: BarFeature getVPN = Feature { ftrAction = vpnCmd , ftrSilent = False + , ftrDefault = Nothing , ftrChildren = [d, v] } where @@ -333,6 +335,7 @@ getBt :: BarFeature getBt = Feature { ftrAction = btCmd , ftrSilent = False + , ftrDefault = Nothing , ftrChildren = [dep] } where @@ -341,6 +344,7 @@ getBt = Feature getAlsa :: BarFeature getAlsa = Feature { ftrAction = alsaCmd + , ftrDefault = Nothing , ftrSilent = False , ftrChildren = [exe "alsactl"] } @@ -348,6 +352,7 @@ getAlsa = Feature getBl :: BarFeature getBl = Feature { ftrAction = blCmd + , ftrDefault = Nothing , ftrSilent = False , ftrChildren = [curFileDep, maxFileDep] } @@ -355,6 +360,7 @@ getBl = Feature getSs :: BarFeature getSs = Feature { ftrAction = ssCmd + , ftrDefault = Nothing , ftrSilent = False , ftrChildren = [ssDep] } diff --git a/lib/XMonad/Internal/Command/Desktop.hs b/lib/XMonad/Internal/Command/Desktop.hs index 6ff52f5..df2a55d 100644 --- a/lib/XMonad/Internal/Command/Desktop.hs +++ b/lib/XMonad/Internal/Command/Desktop.hs @@ -96,6 +96,7 @@ runTMux :: IO MaybeX runTMux = evalFeature $ Feature { ftrAction = cmd , ftrSilent = False + , ftrDefault = Nothing , ftrChildren = [exe myTerm, exe "tmux", exe "bash"] } where diff --git a/lib/XMonad/Internal/DBus/Brightness/Common.hs b/lib/XMonad/Internal/DBus/Brightness/Common.hs index 769f78d..35adade 100644 --- a/lib/XMonad/Internal/DBus/Brightness/Common.hs +++ b/lib/XMonad/Internal/DBus/Brightness/Common.hs @@ -102,6 +102,7 @@ brightnessExporter :: RealFrac b => [Dependency (IO ())] -> BrightnessConfig a b -> Client -> Feature (IO ()) (IO ()) brightnessExporter deps bc client = Feature { ftrAction = exportBrightnessControls' bc client + , ftrDefault = Nothing , ftrSilent = False , ftrChildren = deps } @@ -137,6 +138,7 @@ callBacklight :: BrightnessConfig a b -> Feature (IO ()) (IO ()) -> MemberName callBacklight BrightnessConfig { bcPath = p, bcInterface = i } exporter mem = Feature { ftrAction = void $ callMethod $ methodCall p i mem + , ftrDefault = Nothing , ftrSilent = False , ftrChildren = [SubFeature exporter] } diff --git a/lib/XMonad/Internal/DBus/Screensaver.hs b/lib/XMonad/Internal/DBus/Screensaver.hs index 431c589..f471133 100644 --- a/lib/XMonad/Internal/DBus/Screensaver.hs +++ b/lib/XMonad/Internal/DBus/Screensaver.hs @@ -109,6 +109,7 @@ exportScreensaver client = initControls client exportScreensaver' controls exportScreensaver' :: Client -> Feature (IO ()) (IO ()) exportScreensaver' client = Feature { ftrAction = cmd + , ftrDefault = Nothing , ftrSilent = False , ftrChildren = [ssDep] } @@ -124,6 +125,7 @@ exportScreensaver' client = Feature callToggle :: Feature (IO ()) (IO ()) -> Feature (IO ()) (IO ()) callToggle exporter = Feature { ftrAction = cmd + , ftrDefault = Nothing , ftrSilent = False , ftrChildren = [SubFeature exporter] } diff --git a/lib/XMonad/Internal/Dependency.hs b/lib/XMonad/Internal/Dependency.hs index 1babb77..135c06e 100644 --- a/lib/XMonad/Internal/Dependency.hs +++ b/lib/XMonad/Internal/Dependency.hs @@ -91,9 +91,8 @@ data Dependency a = SubFeature (Feature a a) data Feature a b = Feature { ftrAction :: a - -- TODO add a 'default' action that will proceed in case of failure + , ftrDefault :: Maybe a , ftrSilent :: Bool - -- TODO this should be a semigroup , ftrChildren :: [Dependency b] } | ConstFeature a @@ -250,6 +249,7 @@ runIfInstalled :: [Dependency a] -> b -> IO (MaybeExe b) runIfInstalled ds x = evalFeature $ Feature { ftrAction = x + , ftrDefault = Nothing , ftrSilent = False , ftrChildren = ds }