ENH make switch for ethernet toggle
This commit is contained in:
parent
78545be3d3
commit
9530b7369f
|
@ -494,6 +494,7 @@ data XPFeatures = XPFeatures
|
||||||
{ xpfOptimus :: Bool
|
{ xpfOptimus :: Bool
|
||||||
, xpfVirtualBox :: Bool
|
, xpfVirtualBox :: Bool
|
||||||
, xpfXSANE :: Bool
|
, xpfXSANE :: Bool
|
||||||
|
, xpfEthernet :: Bool
|
||||||
, xpfWireless :: Bool
|
, xpfWireless :: Bool
|
||||||
, xpfVPN :: Bool
|
, xpfVPN :: Bool
|
||||||
, xpfBluetooth :: Bool
|
, xpfBluetooth :: Bool
|
||||||
|
@ -508,6 +509,7 @@ instance FromJSON XPFeatures where
|
||||||
<$> o .:+ "optimus"
|
<$> o .:+ "optimus"
|
||||||
<*> o .:+ "virtualbox"
|
<*> o .:+ "virtualbox"
|
||||||
<*> o .:+ "xsane"
|
<*> o .:+ "xsane"
|
||||||
|
<*> o .:+ "ethernet"
|
||||||
<*> o .:+ "wireless"
|
<*> o .:+ "wireless"
|
||||||
<*> o .:+ "vpn"
|
<*> o .:+ "vpn"
|
||||||
<*> o .:+ "bluetooth"
|
<*> o .:+ "bluetooth"
|
||||||
|
@ -527,6 +529,7 @@ defXPFeatures = XPFeatures
|
||||||
{ xpfOptimus = False
|
{ xpfOptimus = False
|
||||||
, xpfVirtualBox = False
|
, xpfVirtualBox = False
|
||||||
, xpfXSANE = False
|
, xpfXSANE = False
|
||||||
|
, xpfEthernet = False
|
||||||
, xpfWireless = False
|
, xpfWireless = False
|
||||||
-- TODO this might be broken down into different flags (expressvpn, etc)
|
-- TODO this might be broken down into different flags (expressvpn, etc)
|
||||||
, xpfVPN = False
|
, xpfVPN = False
|
||||||
|
|
|
@ -265,9 +265,11 @@ runToggleBluetooth cl = Sometimes "bluetooth toggle" xpfBluetooth
|
||||||
#!&& fmtNotifyCmd defNoteInfo { body = Just $ Text "bluetooth powered $a" }
|
#!&& fmtNotifyCmd defNoteInfo { body = Just $ Text "bluetooth powered $a" }
|
||||||
|
|
||||||
runToggleEthernet :: SometimesX
|
runToggleEthernet :: SometimesX
|
||||||
runToggleEthernet = sometimes1 "ethernet toggle" "nmcli" $ IORoot (spawn . cmd) $
|
runToggleEthernet = Sometimes "ethernet toggle" xpfEthernet
|
||||||
And1 (Only readEthernet) (Only_ $ sysExe networkManagerPkgs "nmcli")
|
[Subfeature root "nmcli"]
|
||||||
where
|
where
|
||||||
|
root = IORoot (spawn . cmd) $ And1 (Only readEthernet) $ Only_
|
||||||
|
$ sysExe networkManagerPkgs "nmcli"
|
||||||
-- TODO make this less noisy
|
-- TODO make this less noisy
|
||||||
cmd iface =
|
cmd iface =
|
||||||
"nmcli -g GENERAL.STATE device show " ++ iface ++ " | grep -q disconnected"
|
"nmcli -g GENERAL.STATE device show " ++ iface ++ " | grep -q disconnected"
|
||||||
|
|
Loading…
Reference in New Issue