Embed app icon and polish Windows build
This commit is contained in:
@@ -43,6 +43,8 @@ Windows:
|
||||
.\scripts\build-windows.bat
|
||||
```
|
||||
|
||||
The Windows build is created as a GUI application, so it does not open a terminal window.
|
||||
|
||||
The binary is written to:
|
||||
|
||||
```text
|
||||
@@ -160,7 +162,7 @@ Changing `jobs_dir` saves the current job list to the new directory.
|
||||
- `cmd/pysentry` starts the desktop app.
|
||||
- `src/gui` contains the GUI.
|
||||
- `src/core` contains YAML storage, command execution, scheduling, and log cleanup.
|
||||
- `assets` contains app icons.
|
||||
- `assets` contains app icons that are embedded into the application binary.
|
||||
- `scripts` contains build helpers.
|
||||
|
||||
Build outputs are written to `dist/`. The old local `bin/` directory is not used.
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package assets
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
)
|
||||
|
||||
//go:embed pysentry-icon.png
|
||||
var iconBytes []byte
|
||||
|
||||
func Icon() fyne.Resource {
|
||||
return fyne.NewStaticResource("pysentry-icon.png", iconBytes)
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 13 KiB |
@@ -3,6 +3,7 @@
|
||||
<path d="M128 32 204 64v58c0 50-29 82-76 104-47-22-76-54-76-104V64z" fill="none" stroke="#ffffff" stroke-width="20" stroke-linejoin="round"/>
|
||||
<path d="M128 76v55l42-32" fill="none" stroke="#ffffff" stroke-width="20" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<circle cx="128" cy="132" r="14" fill="#ffffff"/>
|
||||
<path d="M77 154l26 22-26 22" fill="none" stroke="#ffb31a" stroke-width="18" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M125 198h36" fill="none" stroke="#ffb31a" stroke-width="18" stroke-linecap="round"/>
|
||||
<rect x="48" y="142" width="160" height="70" rx="16" fill="#00343c"/>
|
||||
<path d="M74 160l38 17-38 17" fill="none" stroke="#ffb31a" stroke-width="18" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M132 195h48" fill="none" stroke="#ffb31a" stroke-width="18" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 673 B After Width: | Height: | Size: 745 B |
Binary file not shown.
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 32 KiB |
@@ -8,7 +8,5 @@ container_id="$(docker create pysentry-linux-builder)"
|
||||
mkdir -p "$(dirname "$output")"
|
||||
docker cp "${container_id}:/out/pysentry" "$output"
|
||||
docker rm "$container_id" >/dev/null
|
||||
rm -rf "$(dirname "$output")/assets"
|
||||
cp -R assets "$(dirname "$output")/assets"
|
||||
|
||||
echo "Built $output"
|
||||
|
||||
@@ -9,7 +9,5 @@ export GOOS=linux
|
||||
export GOARCH=amd64
|
||||
|
||||
go build -trimpath -ldflags "-s -w" -o "$output" ./cmd/pysentry
|
||||
rm -rf "$(dirname "$output")/assets"
|
||||
cp -R assets "$(dirname "$output")/assets"
|
||||
|
||||
echo "Built $output"
|
||||
|
||||
@@ -21,9 +21,7 @@ if %ERRORLEVEL%==0 (
|
||||
windres.exe -O coff -o cmd\pysentry\rsrc_windows_amd64.syso packaging\windows\pysentry.rc
|
||||
)
|
||||
|
||||
"%GOEXE%" build -trimpath -ldflags "-s -w" -o "%OUTPUT%" .\cmd\pysentry
|
||||
"%GOEXE%" build -trimpath -ldflags "-s -w -H=windowsgui" -o "%OUTPUT%" .\cmd\pysentry
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
xcopy /E /I /Y assets "%OUTDIR%assets" >nul
|
||||
|
||||
echo Built %OUTPUT%
|
||||
|
||||
+3
-18
@@ -2,12 +2,11 @@ package gui
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/pysentry/pysentry/assets"
|
||||
"github.com/pysentry/pysentry/src/core"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
@@ -39,19 +38,7 @@ func Run() {
|
||||
}
|
||||
|
||||
func loadAppIcon() fyne.Resource {
|
||||
candidates := []string{}
|
||||
if executable, err := os.Executable(); err == nil {
|
||||
candidates = append(candidates, filepath.Join(filepath.Dir(executable), "assets", "pysentry-icon.png"))
|
||||
}
|
||||
if workingDir, err := os.Getwd(); err == nil {
|
||||
candidates = append(candidates, filepath.Join(workingDir, "assets", "pysentry-icon.png"))
|
||||
}
|
||||
for _, path := range candidates {
|
||||
if resource, err := fyne.LoadResourceFromPath(path); err == nil {
|
||||
return resource
|
||||
}
|
||||
}
|
||||
return theme.ComputerIcon()
|
||||
return assets.Icon()
|
||||
}
|
||||
|
||||
func configureSystemTray(a fyne.App, w fyne.Window) {
|
||||
@@ -558,7 +545,6 @@ func newHistoryView(events *[]event) *fyne.Container {
|
||||
}
|
||||
|
||||
func settingsView(w fyne.Window, store *core.Store, jobs *[]job) fyne.CanvasObject {
|
||||
runOnStartup := widget.NewCheck("Start PySentry when I sign in", nil)
|
||||
minimizeToTray := widget.NewCheck("Keep running in the system tray", nil)
|
||||
minimizeToTray.SetChecked(store.Config.KeepRunningInTray)
|
||||
notifications := widget.NewCheck("Show desktop notifications for failed jobs", nil)
|
||||
@@ -621,7 +607,6 @@ func settingsView(w fyne.Window, store *core.Store, jobs *[]job) fyne.CanvasObje
|
||||
|
||||
return container.NewPadded(container.NewVBox(
|
||||
widget.NewLabelWithStyle("Application", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}),
|
||||
runOnStartup,
|
||||
minimizeToTray,
|
||||
notifications,
|
||||
widget.NewSeparator(),
|
||||
@@ -635,7 +620,7 @@ func settingsView(w fyne.Window, store *core.Store, jobs *[]job) fyne.CanvasObje
|
||||
settingsStatus,
|
||||
widget.NewSeparator(),
|
||||
widget.NewLabelWithStyle("Scheduler", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}),
|
||||
widget.NewLabel("Current core supports @every schedules. Cron expressions come next."),
|
||||
widget.NewLabel("Current core supports @every schedules and standard 5-field cron expressions."),
|
||||
))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user