Skip to content

Commit eaeb757

Browse files
committed
merge start/pause, gui removal and installer fixes into main
2 parents be380bb + 68e332c commit eaeb757

File tree

13 files changed

+70
-69
lines changed

13 files changed

+70
-69
lines changed

.screenshot/context-menu.png

15.3 KB
Loading

.screenshot/in-the-tray.png

-1.16 KB
Loading
-8.96 KB
Binary file not shown.

LICENCE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 Adam Bonner
3+
Copyright (c) 2023 Adam Bonner
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ prevent the system from entering sleep or turning off the display
1212
## Background and Information
1313
This simple windows app keeps a machine/workstation from going idle. Oriignally this application pressed the Scroll Lock button twice every second to keep windows "awake". The recent version now uses a native windows call "```ES_DISPLAY_REQUIRED```" to keep the display on instead.
1414

15-
I built this tool to solve a problem, learn about ```tkinter```, ```pyautogui``` and python ```threading```. Displaying a basic GUI while a second thread takes care of the automation. You can still see that code in as recent as the [v0.4.0](https://github.com/adambonneruk/awake/tree/v0.4.0) tag.
15+
I built this tool to solve a problem, learn about ```tkinter```, ```pyautogui``` and python ```threading```. Displaying a basic GUI while a second thread takes care of the automation. Whilst the latest version is much more efficient/compact, you can still see that code in as recent as the [v0.4.0](https://github.com/adambonneruk/awake/tree/v0.4.0) tag.
1616

1717
## Usage
18-
The App starts in the system tray (with the [Z] icon).
18+
The App starts in the system tray (with the _Z_ icon).
1919

20-
![Running in the Windows 10 System Tray](.screenshot/in-the-tray.png)
20+
![Running in the system tray](.screenshot/in-the-tray.png)
2121

22-
A right-click context menu allowing you to "```Show```" the main GUI (below) or "```Quit```" and close the application. The GUI close cross again minimises to the system tray.
22+
A right-click context menu allows you to "```Start/Pause```" the program (pausing will allow windows to sleep again, this is represented by ⏸ icon) or "```Quit```" and close the application.
2323

24-
![Running awake.pyw on Windows 10](.screenshot/stay-awake-dont-sleep.png)
24+
![Start/Pause and Quit Menu while Paused](.screenshot/context-menu.png)
2525

2626
## Development
2727

@@ -39,14 +39,18 @@ py -m pip install -r .\requirements.txt --trusted-host pypi.python.org --trusted
3939

4040
### Compile
4141
```ps
42-
# run manually
42+
# compile manually
4343
pyinstaller "src/awake.spec" --noconfirm
4444
45-
# run automatically
45+
package with nsis manually
46+
makensis installer/awake.nsi
47+
48+
# run both automatically
4649
py "tools/make.py"
4750
```
4851

4952
## Further Reading
5053
### Useful Links
5154
- https://stackoverflow.com/questions/58273482/can-pyautogui-be-used-to-prevent-windows-screen-lock
5255
- https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setthreadexecutionstate
56+
- [change icon dynamically in pystray](https://github.com/moses-palmer/pystray/issues/68)

installer/awake.nsi

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
; defines
99
!define $PRODUCT_NAME "Awake"
10-
!define $APPVERSION "v0.5.1"
10+
!define $APPVERSION "v0.5.2"
1111
!define $PRODUCT_PUBLISHER "adambonneruk"
1212
!define $ICON_PATH "..\src\assets\awake.ico"
1313
!define $REG_PATH "Software\Microsoft\Windows\CurrentVersion\Uninstall\Awake"
@@ -19,13 +19,12 @@ Unicode True
1919

2020
; settings
2121
Name "${$PRODUCT_NAME} ${$APPVERSION}"
22-
OutFile "Awake Installer (${$APPVERSION}).exe"
22+
OutFile "Awake Installer (${$APPVERSION}) x64.exe"
2323
BrandingText "${$PRODUCT_PUBLISHER}"
2424

2525
; gui configuration
2626
!define MUI_ICON ${$ICON_PATH}
2727
!define MUI_UNICON ${$ICON_PATH}
28-
!define MUI_ABORTWARNING ; "are you sure you want to quit?" prompt
2928
!define MUI_WELCOMEFINISHPAGE_BITMAP "assets\wizard.bmp"
3029
!define MUI_HEADERIMAGE
3130
!define MUI_HEADERIMAGE_BITMAP ".\assets\header.bmp"
@@ -48,24 +47,17 @@ Section "Base Files" SecBaseFiles
4847
SetOutPath $INSTDIR
4948
DetailPrint "Cleaning install directory"
5049
RMDIR /r $INSTDIR\*.* ; clean the installation directory
51-
52-
; copy files given x86 or x86-64 operating system
53-
${If} ${RunningX64}
54-
DetailPrint "64-Bit Mode"
55-
File /r ..\dist\awake\*.*
56-
${else}
57-
DetailPrint "32-Bit Mode"
58-
File /r ..\dist\awake\*.*
59-
${EndIf}
50+
File /r ..\dist\awake\*.* ; copy files given x86-64 operating system
6051

6152
; add uninstaller entry to the add/remove programs control panel
53+
SetRegView 64 ; set registry view given x86-64 operating system
6254
WriteRegStr HKLM "${$REG_PATH}" "DisplayName" "${$PRODUCT_NAME}"
6355
WriteRegStr HKLM "${$REG_PATH}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
6456
WriteRegStr HKLM "${$REG_PATH}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
6557
WriteRegStr HKLM "${$REG_PATH}" "DisplayIcon" "$\"$INSTDIR\assets\awake.ico$\""
6658
WriteRegStr HKLM "${$REG_PATH}" "DisplayVersion" "${$APPVERSION}"
6759
WriteRegStr HKLM "${$REG_PATH}" "Publisher" "${$PRODUCT_PUBLISHER}" ; Not show in Windows 10
68-
WriteRegDWORD HKLM "${$REG_PATH}" "EstimatedSize" 26986 ; Calculated size based on v0.5.0
60+
WriteRegDWORD HKLM "${$REG_PATH}" "EstimatedSize" 19558 ; Calculated size based on v0.5.2, in KiB
6961
WriteRegDWORD HKLM "${$REG_PATH}" "NoModify" 1
7062
WriteRegDWORD HKLM "${$REG_PATH}" "NoRepair" 1
7163

@@ -92,14 +84,8 @@ SectionEnd
9284

9385
Function .onInit
9486

95-
; set install folder given x86 or x86-64 operating system
96-
${If} ${RunningX64}
97-
StrCpy $INSTDIR "$PROGRAMFILES64\Awake"
98-
SetRegView 64
99-
${else}
100-
StrCpy $INSTDIR "$PROGRAMFILES\Awake"
101-
SetRegView 32
102-
${EndIf}
87+
; set install folder given x86-64 operating system
88+
StrCpy $INSTDIR "$PROGRAMFILES64\Awake"
10389

10490
FunctionEnd
10591

@@ -124,13 +110,7 @@ Section "Uninstall"
124110
Delete "$SMPROGRAMS\Awake\*.lnk"
125111
RMDir "$SMPROGRAMS\Awake"
126112

127-
; set registry view given x86 or x86-64 operating system
128-
${If} ${RunningX64}
129-
SetRegView 64
130-
${else}
131-
SetRegView 32
132-
${EndIf}
133-
113+
SetRegView 64 ; set registry view given x86-64 operating system
134114
DeleteRegKey HKLM "${$REG_PATH}" ; delete windows add/remove programs key
135115

136116
SectionEnd

src/assets/ZZZZ.pdn

-27.3 KB
Binary file not shown.

src/assets/ZZZZ.png

-7.26 KB
Binary file not shown.

src/assets/awake-icon-256.png

-6.75 KB
Binary file not shown.

src/assets/awake-icon-64-off.png

671 Bytes
Loading

0 commit comments

Comments
 (0)