Skip to content

Instantly share code, notes, and snippets.

@CampinCarl
Last active April 13, 2023 07:02
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save CampinCarl/5b7af54f83b123127a84c16c17572a1c to your computer and use it in GitHub Desktop.
Save CampinCarl/5b7af54f83b123127a84c16c17572a1c to your computer and use it in GitHub Desktop.
OpenVPN-GUI Replace Windows System Tray Icons

OpenVPN-GUI Replace Windows System Tray Icons

As of this writing, the OpenVPN-GUI system tray icon is very similar to the Windows 10 wired network icon, making it difficult to distinguish the two at a glance. This gist provides color swapped versions of the default OpenVPN icon to match the three (3) connection states, i.e., disconnected, connecting, and connected.

Icons

Using a resource editor, the user can modify their copy of the openvpn-gui.exe binary file to use the new icons. This gist includes a sample Resource Hacker script for this purpose, see "replace-tray-icons.txt".

Usage: ResourceHacker.exe -script replace-tray-icons.txt

The sample script assumes the openvpn-gui.exe file is in the same directory. Modify the Open and Save parameters to change this as needed.

[FILENAMES]
Open = openvpn-gui.exe
Save = openvpn-gui-new.exe
Log = replace-tray-icons.log
[COMMANDS]
-modify connected.ico, IconGroup,91,1033
-modify connecting.ico, IconGroup,92,1033
-modify disconnected.ico, IconGroup,93,1033
@msmal
Copy link

msmal commented Aug 15, 2019

Hi,
is it possible that this procedure does not work with OpenVPN version 2.4.7?
I don't get an output file from ressource hacker.

When I open the OpenVPN installer in the Resource Hacker gui I don't see the icon group that should be modified.

@CampinCarl
Copy link
Author

I'm using v2.4.7 with the modified icons, what does your replace-tray-icons.log file say?

@msmal
Copy link

msmal commented Aug 15, 2019

[15 Aug 2019, 15:41:37]

[FileNames]
Source : D:\rh\openvpn-install.exe
Save As : D:\rh\openvpn-install-new.exe
Log File: D:\rh\replace-tray-icons.log

[Commands]
-modify connected.ico, IconGroup,91,1033
-modify connecting.ico, IconGroup,92,1033
-modify disconnected.ico, IconGroup,93,1033

Success!

But there is no D:\rh\openvpn-install-new.exe

the cmd is opened with administrator rights

@CampinCarl
Copy link
Author

Administrator rights shouldn't be necessary if your account has access to the D:\rh\ directory.

I just tested the script against the openvpn-gui.exe binaries included with the openvpn-install-2.4.7-I607-Win10.exe and openvpn-install-2.4.7-I607-Win7.exe release binaries and it worked with both versions.

Here's an excerpt from my log file. I noticed that your output did not include the Modified: ICONGROUP,##,1033 line below each -modify command. I suspect that something is failing but unfortunately the log isn't very helpful.

[15 Aug 2019, 09:53:25]

[FileNames]
Source  : C:\Temp\openvpn-gui.exe
Save As : C:\Temp\openvpn-gui-new.exe
Log File: C:\Temp\replace-tray-icons.log

[Commands]
-modify        connected.ico,    IconGroup,91,1033
  Modified: ICONGROUP,91,1033
-modify        connecting.ico,   IconGroup,92,1033
  Modified: ICONGROUP,92,1033
-modify        disconnected.ico, IconGroup,93,1033
  Modified: ICONGROUP,93,1033

Success!

You could also try using the ResourceHacker GUI directly to modify the icons. It might produce a more useful error message.

@msmal
Copy link

msmal commented Aug 15, 2019

Ok sorry for the wasted time. I am I idiot.
I tried to modify the installer and not the openvpn-gui.exe.

I would like to have the icon in the installer so I don't have to replace it on every PC when I distribute it.

@CampinCarl
Copy link
Author

I see, no worries.

You could theoretically unpack, modify the GUI binary, and then repackage the installer. That said, keep in mind that the PGP signature would no longer validate (if that's a concern for your environment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment