Skip to content

Instantly share code, notes, and snippets.

@romanvm
Last active February 17, 2023 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save romanvm/110e038fefbb8afa107084bc052b3cec to your computer and use it in GitHub Desktop.
Save romanvm/110e038fefbb8afa107084bc052b3cec to your computer and use it in GitHub Desktop.
VPN indicator fix for Cinnamon desktop Network applet
// The code is public domain and you can use it as you want.
// The following code should be added to _updateIcon function after else block and before catch block
// around line # 2345
// File path: /usr/share/cinnamon/applets/network@cinnamon.org/applet.js
// When VPN is connected the network icon is changed to "lock with WiFi" if connected via WiFi
// and to "lock with wire" if connected via other methods.
// *** Start of VPN icon fix ***
for (let i = 0; i < this._activeConnections.length; i++) {
const a = this._activeConnections[i];
if (a._section === NMConnectionCategory.VPN && a.state === NM.ActiveConnectionState.ACTIVATING) {
this._setIcon('network-vpn-acquiring');
this.set_applet_tooltip(_("Connecting to the VPN..."));
break;
}
else if (a._section === NMConnectionCategory.VPN && a.state === NM.ActiveConnectionState.ACTIVATED) {
let iconName = 'network-vpn';
if (mc._section == NMConnectionCategory.WIRELESS) {
const dev = mc._primaryDevice;
if (dev) {
const ap = dev.device.active_access_point;
iconName = 'network-wireless-signal-' + signalToIcon(ap.strength) + '-secure-symbolic';
}
}
this._setIcon(iconName);
this.set_applet_tooltip(_("Connected to the VPN"));
break;
}
}
// *** End of VPN icon fix ***
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment