ADD default command to features
This commit is contained in:
parent
052937867b
commit
0caefb336f
|
@ -314,6 +314,7 @@ getBattery :: BarFeature
|
||||||
getBattery = Feature
|
getBattery = Feature
|
||||||
{ ftrAction = batteryCmd
|
{ ftrAction = batteryCmd
|
||||||
, ftrSilent = False
|
, ftrSilent = False
|
||||||
|
, ftrDefault = Nothing
|
||||||
, ftrChildren = [Dependency { depRequired = True, depData = IOTest hasBattery }]
|
, ftrChildren = [Dependency { depRequired = True, depData = IOTest hasBattery }]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,6 +324,7 @@ getVPN :: BarFeature
|
||||||
getVPN = Feature
|
getVPN = Feature
|
||||||
{ ftrAction = vpnCmd
|
{ ftrAction = vpnCmd
|
||||||
, ftrSilent = False
|
, ftrSilent = False
|
||||||
|
, ftrDefault = Nothing
|
||||||
, ftrChildren = [d, v]
|
, ftrChildren = [d, v]
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
|
@ -333,6 +335,7 @@ getBt :: BarFeature
|
||||||
getBt = Feature
|
getBt = Feature
|
||||||
{ ftrAction = btCmd
|
{ ftrAction = btCmd
|
||||||
, ftrSilent = False
|
, ftrSilent = False
|
||||||
|
, ftrDefault = Nothing
|
||||||
, ftrChildren = [dep]
|
, ftrChildren = [dep]
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
|
@ -341,6 +344,7 @@ getBt = Feature
|
||||||
getAlsa :: BarFeature
|
getAlsa :: BarFeature
|
||||||
getAlsa = Feature
|
getAlsa = Feature
|
||||||
{ ftrAction = alsaCmd
|
{ ftrAction = alsaCmd
|
||||||
|
, ftrDefault = Nothing
|
||||||
, ftrSilent = False
|
, ftrSilent = False
|
||||||
, ftrChildren = [exe "alsactl"]
|
, ftrChildren = [exe "alsactl"]
|
||||||
}
|
}
|
||||||
|
@ -348,6 +352,7 @@ getAlsa = Feature
|
||||||
getBl :: BarFeature
|
getBl :: BarFeature
|
||||||
getBl = Feature
|
getBl = Feature
|
||||||
{ ftrAction = blCmd
|
{ ftrAction = blCmd
|
||||||
|
, ftrDefault = Nothing
|
||||||
, ftrSilent = False
|
, ftrSilent = False
|
||||||
, ftrChildren = [curFileDep, maxFileDep]
|
, ftrChildren = [curFileDep, maxFileDep]
|
||||||
}
|
}
|
||||||
|
@ -355,6 +360,7 @@ getBl = Feature
|
||||||
getSs :: BarFeature
|
getSs :: BarFeature
|
||||||
getSs = Feature
|
getSs = Feature
|
||||||
{ ftrAction = ssCmd
|
{ ftrAction = ssCmd
|
||||||
|
, ftrDefault = Nothing
|
||||||
, ftrSilent = False
|
, ftrSilent = False
|
||||||
, ftrChildren = [ssDep]
|
, ftrChildren = [ssDep]
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,6 +96,7 @@ runTMux :: IO MaybeX
|
||||||
runTMux = evalFeature $ Feature
|
runTMux = evalFeature $ Feature
|
||||||
{ ftrAction = cmd
|
{ ftrAction = cmd
|
||||||
, ftrSilent = False
|
, ftrSilent = False
|
||||||
|
, ftrDefault = Nothing
|
||||||
, ftrChildren = [exe myTerm, exe "tmux", exe "bash"]
|
, ftrChildren = [exe myTerm, exe "tmux", exe "bash"]
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
|
|
|
@ -102,6 +102,7 @@ brightnessExporter :: RealFrac b => [Dependency (IO ())]
|
||||||
-> BrightnessConfig a b -> Client -> Feature (IO ()) (IO ())
|
-> BrightnessConfig a b -> Client -> Feature (IO ()) (IO ())
|
||||||
brightnessExporter deps bc client = Feature
|
brightnessExporter deps bc client = Feature
|
||||||
{ ftrAction = exportBrightnessControls' bc client
|
{ ftrAction = exportBrightnessControls' bc client
|
||||||
|
, ftrDefault = Nothing
|
||||||
, ftrSilent = False
|
, ftrSilent = False
|
||||||
, ftrChildren = deps
|
, ftrChildren = deps
|
||||||
}
|
}
|
||||||
|
@ -137,6 +138,7 @@ callBacklight :: BrightnessConfig a b -> Feature (IO ()) (IO ()) -> MemberName
|
||||||
callBacklight BrightnessConfig { bcPath = p, bcInterface = i } exporter mem =
|
callBacklight BrightnessConfig { bcPath = p, bcInterface = i } exporter mem =
|
||||||
Feature
|
Feature
|
||||||
{ ftrAction = void $ callMethod $ methodCall p i mem
|
{ ftrAction = void $ callMethod $ methodCall p i mem
|
||||||
|
, ftrDefault = Nothing
|
||||||
, ftrSilent = False
|
, ftrSilent = False
|
||||||
, ftrChildren = [SubFeature exporter]
|
, ftrChildren = [SubFeature exporter]
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,6 +109,7 @@ exportScreensaver client = initControls client exportScreensaver' controls
|
||||||
exportScreensaver' :: Client -> Feature (IO ()) (IO ())
|
exportScreensaver' :: Client -> Feature (IO ()) (IO ())
|
||||||
exportScreensaver' client = Feature
|
exportScreensaver' client = Feature
|
||||||
{ ftrAction = cmd
|
{ ftrAction = cmd
|
||||||
|
, ftrDefault = Nothing
|
||||||
, ftrSilent = False
|
, ftrSilent = False
|
||||||
, ftrChildren = [ssDep]
|
, ftrChildren = [ssDep]
|
||||||
}
|
}
|
||||||
|
@ -124,6 +125,7 @@ exportScreensaver' client = Feature
|
||||||
callToggle :: Feature (IO ()) (IO ()) -> Feature (IO ()) (IO ())
|
callToggle :: Feature (IO ()) (IO ()) -> Feature (IO ()) (IO ())
|
||||||
callToggle exporter = Feature
|
callToggle exporter = Feature
|
||||||
{ ftrAction = cmd
|
{ ftrAction = cmd
|
||||||
|
, ftrDefault = Nothing
|
||||||
, ftrSilent = False
|
, ftrSilent = False
|
||||||
, ftrChildren = [SubFeature exporter]
|
, ftrChildren = [SubFeature exporter]
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,9 +91,8 @@ data Dependency a = SubFeature (Feature a a)
|
||||||
|
|
||||||
data Feature a b = Feature
|
data Feature a b = Feature
|
||||||
{ ftrAction :: a
|
{ ftrAction :: a
|
||||||
-- TODO add a 'default' action that will proceed in case of failure
|
, ftrDefault :: Maybe a
|
||||||
, ftrSilent :: Bool
|
, ftrSilent :: Bool
|
||||||
-- TODO this should be a semigroup
|
|
||||||
, ftrChildren :: [Dependency b]
|
, ftrChildren :: [Dependency b]
|
||||||
} | ConstFeature a
|
} | ConstFeature a
|
||||||
|
|
||||||
|
@ -250,6 +249,7 @@ runIfInstalled :: [Dependency a] -> b -> IO (MaybeExe b)
|
||||||
runIfInstalled ds x = evalFeature $
|
runIfInstalled ds x = evalFeature $
|
||||||
Feature
|
Feature
|
||||||
{ ftrAction = x
|
{ ftrAction = x
|
||||||
|
, ftrDefault = Nothing
|
||||||
, ftrSilent = False
|
, ftrSilent = False
|
||||||
, ftrChildren = ds
|
, ftrChildren = ds
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue