Skip to content

Commit

Permalink
feat: Allow widget to hide when VPN is disconnected
Browse files Browse the repository at this point in the history
Closes #17
  • Loading branch information
korapp committed Apr 6, 2023
1 parent 33dbe0c commit f751533
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions plasmoid/contents/config/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
<entry name="showNotifications" type="Bool">
<default>true</default>
</entry>
<entry name="hideWhenDisconnected" type="Bool">
<default>false</default>
</entry>
</group>
<group name="Favorites">
<entry name="favoriteConnections" type="String"></entry>
Expand Down
6 changes: 6 additions & 0 deletions plasmoid/contents/ui/ConfigGeneral.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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")
Expand Down
4 changes: 3 additions & 1 deletion plasmoid/contents/ui/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f751533

Please # to comment.