Skip to content

Commit dd205f1

Browse files
committed
Add windows installer support
1 parent 73c241a commit dd205f1

File tree

7 files changed

+202
-48
lines changed

7 files changed

+202
-48
lines changed

Pipfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ fbs = "*"
1313
pyinstaller = "==3.4"
1414
pynput = "*"
1515
pyside2 = "*"
16+
pypiwin32 = { version = "*", os_name = "=='nt'" }
1617

1718
[requires]
1819
python_version = "3.6"

Pipfile.lock

Lines changed: 74 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"allowed_extensions": [
3+
4+
],
5+
"description": "Mouse Commander integration with native messaging support",
6+
"name": "mousecommander",
7+
"path": "",
8+
"type": "stdio"
9+
}
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
2+
!define FULLNAME "Mouse Commander Native Client"
3+
!define APPNAME "mousecommander"
4+
5+
6+
!include MUI2.nsh
7+
!include FileFunc.nsh
8+
9+
;--------------------------------
10+
;Perform Machine-level install, if possible
11+
12+
!define MULTIUSER_EXECUTIONLEVEL Highest
13+
;Add support for command-line args that let uninstaller know whether to
14+
;uninstall machine- or user installation:
15+
!define MULTIUSER_INSTALLMODE_COMMANDLINE
16+
!include MultiUser.nsh
17+
!include LogicLib.nsh
18+
19+
Function .onInit
20+
!insertmacro MULTIUSER_INIT
21+
;Do not use InstallDir at all so we can detect empty $InstDir!
22+
${If} $InstDir == "" ; /D not used
23+
${If} $MultiUser.InstallMode == "AllUsers"
24+
StrCpy $InstDir "$PROGRAMFILES\${FULLNAME}"
25+
${Else}
26+
StrCpy $InstDir "$LOCALAPPDATA\${FULLNAME}"
27+
${EndIf}
28+
${EndIf}
29+
FunctionEnd
30+
31+
Function un.onInit
32+
!insertmacro MULTIUSER_UNINIT
33+
FunctionEnd
34+
35+
;--------------------------------
36+
;General
37+
38+
Name "${FULLNAME}"
39+
OutFile "..\${APPNAME}-client-setup.exe"
40+
41+
;--------------------------------
42+
;Interface Settings
43+
44+
!define MUI_ABORTWARNING
45+
46+
;--------------------------------
47+
;Pages
48+
49+
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of ${FULLNAME}.$\r$\n$\r$\n$\r$\nClick Next to continue."
50+
!insertmacro MUI_PAGE_WELCOME
51+
!insertmacro MUI_PAGE_DIRECTORY
52+
!insertmacro MUI_PAGE_INSTFILES
53+
!define MUI_FINISHPAGE_NOAUTOCLOSE
54+
!define MUI_FINISHPAGE_RUN
55+
!define MUI_FINISHPAGE_RUN_CHECKED
56+
!define MUI_FINISHPAGE_RUN_TEXT "Run ${FULLNAME}"
57+
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
58+
!insertmacro MUI_PAGE_FINISH
59+
60+
!insertmacro MUI_UNPAGE_CONFIRM
61+
!insertmacro MUI_UNPAGE_INSTFILES
62+
63+
;--------------------------------
64+
;Languages
65+
66+
!insertmacro MUI_LANGUAGE "English"
67+
68+
;--------------------------------
69+
;Installer Sections
70+
71+
!define UNINST_KEY \
72+
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${FULLNAME}"
73+
!define MANIFEST_KEY \
74+
"Software\Mozilla\NativeMessagingHosts\${APPNAME}"
75+
Section
76+
SetOutPath "$InstDir"
77+
File /r "..\${APPNAME}\*"
78+
nsJSON::Set /file "$InstDir\${APPNAME}.json"
79+
nsJSON::Quote /always `$InstDir\${APPNAME}.exe`
80+
Pop $R0
81+
nsJSON::Set `path` /value `$R0`
82+
nsJSON::Serialize /format /file "$InstDir\${APPNAME}.json"
83+
WriteRegStr SHCTX "${MANIFEST_KEY}" "" "$InstDir\${APPNAME}.json"
84+
WriteRegStr SHCTX "Software\${FULLNAME}" "" $InstDir
85+
WriteUninstaller "$InstDir\uninstall.exe"
86+
CreateShortCut "$SMPROGRAMS\${FULLNAME}.lnk" "$InstDir\${APPNAME}.exe"
87+
WriteRegStr SHCTX "${UNINST_KEY}" "DisplayName" "${FULLNAME}"
88+
WriteRegStr SHCTX "${UNINST_KEY}" "UninstallString" \
89+
"$\"$InstDir\uninstall.exe$\" /$MultiUser.InstallMode"
90+
WriteRegStr SHCTX "${UNINST_KEY}" "QuietUninstallString" \
91+
"$\"$InstDir\uninstall.exe$\" /$MultiUser.InstallMode /S"
92+
WriteRegStr SHCTX "${UNINST_KEY}" "Publisher" "tumpio"
93+
${GetSize} "$InstDir" "/S=0K" $0 $1 $2
94+
IntFmt $0 "0x%08X" $0
95+
WriteRegDWORD SHCTX "${UNINST_KEY}" "EstimatedSize" "$0"
96+
97+
SectionEnd
98+
99+
;--------------------------------
100+
;Uninstaller Section
101+
102+
Section "Uninstall"
103+
104+
RMDir /r "$InstDir"
105+
Delete "$SMPROGRAMS\${FULLNAME}.lnk"
106+
DeleteRegKey /ifempty SHCTX "Software\${FULLNAME}"
107+
DeleteRegKey SHCTX "${MANIFEST_KEY}"
108+
DeleteRegKey SHCTX "${UNINST_KEY}"
109+
110+
SectionEnd
111+
112+
Function LaunchLink
113+
!addplugindir "."
114+
ShellExecAsUser::ShellExecAsUser "open" "$SMPROGRAMS\${FULLNAME}.lnk"
115+
FunctionEnd

app/src/main/python/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from PySide2.QtGui import QIcon
1313
from PySide2.QtWidgets import (QAction, QMenu, QMessageBox, QSystemTrayIcon)
1414

15-
name = "Mouse Commander Client"
15+
name = "Mouse Commander Native Client"
1616
version = 0.1
1717

1818
MESSAGE_QUEUE = Queue(10)
Lines changed: 1 addition & 1 deletion
Loading

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@
4747
]
4848
}
4949
}
50-
}
50+
}

0 commit comments

Comments
 (0)