-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
119 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
.PHONY: test format | ||
|
||
.PHONY: test | ||
test: | ||
cargo fmt -- --check | ||
cargo-sort --check --workspace | ||
cargo clippy --all-features --workspace -- -D warnings | ||
cargo test --all-features --workspace | ||
|
||
.PHONY: format | ||
format: | ||
cargo fmt | ||
cargo-sort --workspace | ||
|
||
.PHONY: installer | ||
installer: | ||
makensis installer/windows.nsi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Windows NSIS Installer | ||
|
||
Requires NsProcess plugin: | ||
- https://nsis.sourceforge.io/NsProcess_plugin | ||
- https://nsis.sourceforge.io/mediawiki/images/1/18/NsProcess.zip (The Unicode version nsProcessW.dll) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
!define nsProcess::FindProcess `!insertmacro nsProcess::FindProcess` | ||
|
||
!macro nsProcess::FindProcess _FILE _ERR | ||
nsProcess::_FindProcess /NOUNLOAD `${_FILE}` | ||
Pop ${_ERR} | ||
!macroend | ||
|
||
|
||
!define nsProcess::KillProcess `!insertmacro nsProcess::KillProcess` | ||
|
||
!macro nsProcess::KillProcess _FILE _ERR | ||
nsProcess::_KillProcess /NOUNLOAD `${_FILE}` | ||
Pop ${_ERR} | ||
!macroend | ||
|
||
!define nsProcess::CloseProcess `!insertmacro nsProcess::CloseProcess` | ||
|
||
!macro nsProcess::CloseProcess _FILE _ERR | ||
nsProcess::_CloseProcess /NOUNLOAD `${_FILE}` | ||
Pop ${_ERR} | ||
!macroend | ||
|
||
|
||
!define nsProcess::Unload `!insertmacro nsProcess::Unload` | ||
|
||
!macro nsProcess::Unload | ||
nsProcess::_Unload | ||
!macroend |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
Unicode True | ||
!addplugindir plugins | ||
!addincludedir include | ||
|
||
!include "MUI2.nsh" | ||
!include "nsProcess.nsh" | ||
|
||
OutFile "ssb-installer.exe" | ||
Name "Solar Screen Brightness" | ||
InstallDir "$LocalAppdata\solar-screen-brightness" | ||
|
||
!define SHORT_CUT "$SMPROGRAMS\Solar Screen Brightness.lnk" | ||
!define SHORT_CUT_UNINSTALL "$SMPROGRAMS\Uninstall Solar Screen Brightness.lnk" | ||
!define SHORT_CUT_START_UP "$SMSTARTUP\Solar Screen Brightness (Minimised).lnk" | ||
|
||
!define MUI_ICON "..\assets\icon-256.ico" | ||
!define MUI_WELCOMEPAGE_TITLE "Solar Screen Brightness" | ||
!define MUI_WELCOMEPAGE_TEXT "Click Install to start the installation." | ||
!define MUI_FINISHPAGE_RUN "$INSTDIR\ssb.exe" | ||
|
||
!insertmacro MUI_PAGE_WELCOME | ||
!insertmacro MUI_PAGE_INSTFILES | ||
!insertmacro MUI_PAGE_FINISH | ||
|
||
!define MUI_WELCOMEPAGE_TITLE "Solar Screen Brightness" | ||
!define MUI_WELCOMEPAGE_TEXT "Click Uninstall to start the uninstallation." | ||
|
||
!insertmacro MUI_UNPAGE_WELCOME | ||
!insertmacro MUI_UNPAGE_INSTFILES | ||
|
||
!insertmacro MUI_LANGUAGE "English" | ||
|
||
Section | ||
SetOutPath "$INSTDIR" | ||
|
||
# Stop version 1 | ||
${nsProcess::KillProcess} "solar-screen-brightness.exe" $R0 | ||
DetailPrint "Stopping solar-screen-brightness.exe code: $R0" | ||
# Stop version 2 | ||
${nsProcess::KillProcess} "ssb.exe" $R0 | ||
DetailPrint "Stopping ssb.exe code: $R0" | ||
|
||
# Allow time for processes to stop | ||
Sleep 500 | ||
|
||
# Delete version 1 | ||
RMDir /r "$APPDATA\Solar Screen Brightness" | ||
|
||
File "..\target\release\ssb.exe" | ||
File "..\target\release\ssb-cli.exe" | ||
WriteUninstaller "$INSTDIR\uninstall.exe" | ||
CreateShortcut "${SHORT_CUT}" "$INSTDIR\ssb.exe" | ||
CreateShortcut "${SHORT_CUT_UNINSTALL}" "$INSTDIR\uninstall.exe" | ||
CreateShortcut "${SHORT_CUT_START_UP}" "$INSTDIR\ssb.exe" "--minimised" | ||
SectionEnd | ||
|
||
Section "uninstall" | ||
# Stop version 2 | ||
${nsProcess::KillProcess} "ssb.exe" $R0 | ||
DetailPrint "Stopping ssb.exe code: $R0" | ||
|
||
# Allow time for processes to stop | ||
Sleep 500 | ||
|
||
Delete "${SHORT_CUT}" | ||
Delete "${SHORT_CUT_UNINSTALL}" | ||
Delete "${SHORT_CUT_START_UP}" | ||
RMDir /r "$INSTDIR" | ||
SectionEnd | ||
|
This file was deleted.
Oops, something went wrong.