Skip to content

Commit 87b5c63

Browse files
authored
feat: windows installer & titlebar icon (#2)
* feat: nsis install scripts * chore: minor changes to actions * fix * add windows icon in titlebar * oops * Update installer.nsi
1 parent f96f56d commit 87b5c63

4 files changed

Lines changed: 112 additions & 4 deletions

File tree

.github/workflows/build.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ jobs:
6868
- name: Install Rust stable
6969
uses: dtolnay/rust-toolchain@stable
7070

71-
- name: Setup Windows dependencies
72-
run: choco install strawberryperl make --no-progress
73-
7471
- name: Setup Windows MSVC environment
7572
uses: ilammy/msvc-dev-cmd@v1
7673

@@ -80,11 +77,19 @@ jobs:
8077
cargo fetch --locked || true
8178
cargo patch-crate --force
8279
mkdir -p build/out
80+
mkdir -p build/nsis
8381
8482
- name: Build & Bundle (Windows)
8583
run: |
8684
cargo build --bin ${{ env.BINARY_NAME }} --release
87-
cp target/release/${{ env.BINARY_NAME }}.exe build/out
85+
cp target/release/${{ env.BINARY_NAME }}.exe build/nsis
86+
87+
- name: Create NSIS Installer
88+
run: |
89+
mv package/windows/* build/nsis/
90+
choco install nsis.portable
91+
makensis build/nsis/installer.nsi
92+
mv build/nsis/PlumeInstaller.exe build/out/${{ env.BINARY_NAME }}-setup.exe
8893
8994
- name: Upload Bundles
9095
uses: actions/upload-artifact@v4

apps/plumeimpactor/src/frame.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ use crate::keychain::AccountCredentials;
2121
use crate::pages::{LoginDialog, DefaultPage, InstallPage, SettingsDialog, WINDOW_SIZE, create_default_page, create_install_page, create_login_dialog, create_settings_dialog};
2222
use crate::utils::{Device, Package};
2323

24+
#[cfg(target_os = "windows")]
25+
const INSTALLER_IMAGE_BYTES: &[u8] = include_bytes!("../../../package/windows/icon.rgba");
26+
#[cfg(target_os = "windows")]
27+
const INSTALLER_IMAGE_SIZE: u32 = 128;
28+
2429
pub const APP_NAME: &str = concat!(env!("CARGO_PKG_NAME"), " – Version ", env!("CARGO_PKG_VERSION"));
2530

2631
pub struct PlumeFrame {
@@ -44,6 +49,17 @@ impl PlumeFrame {
4449
.with_style(FrameStyle::CloseBox | FrameStyle::MinimizeBox | FrameStyle::Caption | FrameStyle::SystemMenu)
4550
.build();
4651

52+
#[cfg(target_os = "windows")]
53+
{
54+
let bitmap = Bitmap::from_rgba(
55+
INSTALLER_IMAGE_BYTES,
56+
INSTALLER_IMAGE_SIZE,
57+
INSTALLER_IMAGE_SIZE,
58+
).unwrap();
59+
60+
frame.set_icon(&bitmap);
61+
}
62+
4763
let sizer = BoxSizer::builder(Orientation::Vertical).build();
4864

4965
let top_row = BoxSizer::builder(Orientation::Horizontal).build();

package/windows/icon.rgba

64 KB
Binary file not shown.

package/windows/installer.nsi

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
;===========================================================
2+
; Modern NSIS Installer for a Single EXE (64-bit)
3+
;===========================================================
4+
5+
!define APPNAME "PlumeImpactor"
6+
!define APPEXE "plumeimpactor.exe"
7+
!define COMPANY "Samara"
8+
9+
Name "${APPNAME}"
10+
BrandingText "${APPNAME} Setup"
11+
12+
OutFile "PlumeInstaller.exe"
13+
14+
RequestExecutionLevel admin
15+
InstallDir "$PROGRAMFILES64\${APPNAME}"
16+
InstallDirRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "InstallLocation"
17+
18+
;-----------------------------------------------------------
19+
; Modern UI 2
20+
;-----------------------------------------------------------
21+
!include "MUI2.nsh"
22+
23+
!define MUI_ABORTWARNING
24+
!define MUI_ICON "icon.ico"
25+
!define MUI_UNICON "icon.ico"
26+
27+
;-----------------------------------------------------------
28+
; Installer Pages
29+
;-----------------------------------------------------------
30+
!insertmacro MUI_PAGE_WELCOME
31+
!insertmacro MUI_PAGE_DIRECTORY
32+
!insertmacro MUI_PAGE_INSTFILES
33+
!insertmacro MUI_PAGE_FINISH
34+
35+
;-----------------------------------------------------------
36+
; Uninstaller Pages
37+
;-----------------------------------------------------------
38+
!insertmacro MUI_UNPAGE_WELCOME
39+
!insertmacro MUI_UNPAGE_CONFIRM
40+
!insertmacro MUI_UNPAGE_INSTFILES
41+
!insertmacro MUI_UNPAGE_FINISH
42+
43+
!insertmacro MUI_LANGUAGE "English"
44+
45+
;===========================================================
46+
; Installer Section
47+
;===========================================================
48+
Section "Install"
49+
50+
SetOutPath "$INSTDIR"
51+
File "${APPEXE}"
52+
53+
; Start Menu entries
54+
CreateDirectory "$SMPROGRAMS\${APPNAME}"
55+
CreateShortcut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\${APPEXE}"
56+
57+
CreateShortcut "$DESKTOP\${APPNAME}.lnk" "$INSTDIR\${APPEXE}"
58+
59+
WriteUninstaller "$INSTDIR\Uninstall.exe"
60+
61+
; 64-bit registry uninstall entry
62+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME}"
63+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "Publisher" "${COMPANY}"
64+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "InstallLocation" "$INSTDIR"
65+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$INSTDIR\Uninstall.exe"
66+
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoModify" 1
67+
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoRepair" 1
68+
69+
SectionEnd
70+
71+
;===========================================================
72+
; Uninstaller Section
73+
;===========================================================
74+
Section "Uninstall"
75+
76+
Delete "$DESKTOP\${APPNAME}.lnk"
77+
Delete "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk"
78+
RMDir "$SMPROGRAMS\${APPNAME}"
79+
80+
Delete "$INSTDIR\${APPEXE}"
81+
Delete "$INSTDIR\Uninstall.exe"
82+
83+
RMDir "$INSTDIR"
84+
85+
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
86+
87+
SectionEnd

0 commit comments

Comments
 (0)