diff --git a/plasmoid/contents/config/main.xml b/plasmoid/contents/config/main.xml
index 3e8175f..24c5e8b 100644
--- a/plasmoid/contents/config/main.xml
+++ b/plasmoid/contents/config/main.xml
@@ -15,6 +15,9 @@
true
+
+ false
+
diff --git a/plasmoid/contents/ui/ConfigGeneral.qml b/plasmoid/contents/ui/ConfigGeneral.qml
index 52c0ad7..5687c82 100644
--- a/plasmoid/contents/ui/ConfigGeneral.qml
+++ b/plasmoid/contents/ui/ConfigGeneral.qml
@@ -8,6 +8,7 @@ Kirigami.FormLayout {
property alias cfg_toggleConnectionOnMiddleButton: toggleConnectionOnMiddleButton.checked
property alias cfg_showCountryIndicator: showCountryIndicator.checked
+ property alias cfg_hideWhenDisconnected: hideWhenDisconnected.checked
property alias cfg_showNotifications: showNotifications.checked
CheckBox {
@@ -20,6 +21,11 @@ Kirigami.FormLayout {
Kirigami.FormData.label: i18n("Show country indicator")
}
+ CheckBox {
+ id: hideWhenDisconnected
+ Kirigami.FormData.label: i18n("Hide when VPN is disconnected")
+ }
+
CheckBox {
id: showNotifications
Kirigami.FormData.label: i18n("Show notifications")
diff --git a/plasmoid/contents/ui/main.qml b/plasmoid/contents/ui/main.qml
index dc7f562..85b6759 100644
--- a/plasmoid/contents/ui/main.qml
+++ b/plasmoid/contents/ui/main.qml
@@ -14,7 +14,9 @@ Item {
Plasmoid.compactRepresentation: CompactRepresentation {}
Plasmoid.fullRepresentation: FullRepresentation {}
Plasmoid.toolTipSubText: getTooltipText()
- Plasmoid.status: nordvpn.isServiceRunning ? PlasmaCore.Types.ActiveStatus : PlasmaCore.Types.PassiveStatus
+ Plasmoid.status: nordvpn.isServiceRunning && (nordvpn.isConnected || !plasmoid.configuration.hideWhenDisconnected)
+ ? PlasmaCore.Types.ActiveStatus
+ : PlasmaCore.Types.PassiveStatus
Plasmoid.icon: Qt.resolvedUrl("../images/nordvpn.svgz")
Plasmoid.switchWidth: PlasmaCore.Units.gridUnit * 14