mirror of
https://github.com/wavetermdev/wails.git
synced 2026-08-05 13:53:43 -07:00
Remove all systray related for v2. (#2329)
Possible fix for #2265. Close systray separately after the application ran.
This commit is contained in:
@@ -1,3 +0,0 @@
|
|||||||
build/bin
|
|
||||||
node_modules
|
|
||||||
frontend/wailsjs
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
# System Tray
|
|
||||||
|
|
||||||
This example shows how to create a system tray using an experimental programmatic API.
|
|
||||||
|
|
||||||
## Running
|
|
||||||
|
|
||||||
As this example outputs text to the console, it is recommended to build using `wails build -debug`.
|
|
||||||
|
|
||||||
## Supported Platforms
|
|
||||||
|
|
||||||
- [x] Windows
|
|
||||||
- [ ] macOS
|
|
||||||
- [ ] Linux
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 130 KiB |
@@ -1,27 +0,0 @@
|
|||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>CFBundlePackageType</key>
|
|
||||||
<string>APPL</string>
|
|
||||||
<key>CFBundleName</key>
|
|
||||||
<string>{{.Info.ProductName}}</string>
|
|
||||||
<key>CFBundleExecutable</key>
|
|
||||||
<string>{{.Name}}</string>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>com.wails.{{.Name}}</string>
|
|
||||||
<key>CFBundleVersion</key>
|
|
||||||
<string>{{.Info.ProductVersion}}</string>
|
|
||||||
<key>CFBundleGetInfoString</key>
|
|
||||||
<string>{{.Info.Comments}}</string>
|
|
||||||
<key>CFBundleShortVersionString</key>
|
|
||||||
<string>{{.Info.ProductVersion}}</string>
|
|
||||||
<key>CFBundleIconFile</key>
|
|
||||||
<string>iconfile</string>
|
|
||||||
<key>LSMinimumSystemVersion</key>
|
|
||||||
<string>10.13.0</string>
|
|
||||||
<key>NSHighResolutionCapable</key>
|
|
||||||
<string>true</string>
|
|
||||||
<key>NSHumanReadableCopyright</key>
|
|
||||||
<string>{{.Info.Copyright}}</string>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB |
@@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"fixed": {
|
|
||||||
"file_version": "{{.Info.ProductVersion}}"
|
|
||||||
},
|
|
||||||
"info": {
|
|
||||||
"0000": {
|
|
||||||
"ProductVersion": "{{.Info.ProductVersion}}",
|
|
||||||
"CompanyName": "{{.Info.CompanyName}}",
|
|
||||||
"FileDescription": "{{.Info.ProductName}}",
|
|
||||||
"LegalCopyright": "{{.Info.Copyright}}",
|
|
||||||
"ProductName": "{{.Info.ProductName}}",
|
|
||||||
"Comments": "{{.Info.Comments}}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
Unicode true
|
|
||||||
|
|
||||||
####
|
|
||||||
## Please note: Template replacements don't work in this file. They are provided with default defines like
|
|
||||||
## mentioned underneath.
|
|
||||||
## If the keyword is not defined, "wails_tools.nsh" will populate them with the values from ProjectInfo.
|
|
||||||
## If they are defined here, "wails_tools.nsh" will not touch them. This allows to use this project.nsi manually
|
|
||||||
## from outside of Wails for debugging and development of the installer.
|
|
||||||
##
|
|
||||||
## For development first make a wails nsis build to populate the "wails_tools.nsh":
|
|
||||||
## > wails build --target windows/amd64 --nsis
|
|
||||||
## Then you can call makensis on this file with specifying the path to your binary:
|
|
||||||
## For a AMD64 only installer:
|
|
||||||
## > makensis -DARG_WAILS_AMD64_BINARY=..\..\bin\app.exe
|
|
||||||
## For a ARM64 only installer:
|
|
||||||
## > makensis -DARG_WAILS_ARM64_BINARY=..\..\bin\app.exe
|
|
||||||
## For a installer with both architectures:
|
|
||||||
## > makensis -DARG_WAILS_AMD64_BINARY=..\..\bin\app-amd64.exe -DARG_WAILS_ARM64_BINARY=..\..\bin\app-arm64.exe
|
|
||||||
####
|
|
||||||
## The following information is taken from the ProjectInfo file, but they can be overwritten here.
|
|
||||||
####
|
|
||||||
## !define INFO_PROJECTNAME "MyProject" # Default "{{.Name}}"
|
|
||||||
## !define INFO_COMPANYNAME "MyCompany" # Default "{{.Info.CompanyName}}"
|
|
||||||
## !define INFO_PRODUCTNAME "MyProduct" # Default "{{.Info.ProductName}}"
|
|
||||||
## !define INFO_PRODUCTVERSION "1.0.0" # Default "{{.Info.ProductVersion}}"
|
|
||||||
## !define INFO_COPYRIGHT "Copyright" # Default "{{.Info.Copyright}}"
|
|
||||||
###
|
|
||||||
## !define PRODUCT_EXECUTABLE "Application.exe" # Default "${INFO_PROJECTNAME}.exe"
|
|
||||||
## !define UNINST_KEY_NAME "UninstKeyInRegistry" # Default "${INFO_COMPANYNAME}${INFO_PRODUCTNAME}"
|
|
||||||
####
|
|
||||||
## !define REQUEST_EXECUTION_LEVEL "admin" # Default "admin" see also https://nsis.sourceforge.io/Docs/Chapter4.html
|
|
||||||
####
|
|
||||||
## Include the wails tools
|
|
||||||
####
|
|
||||||
!include "wails_tools.nsh"
|
|
||||||
|
|
||||||
# The version information for this two must consist of 4 parts
|
|
||||||
VIProductVersion "${INFO_PRODUCTVERSION}.0"
|
|
||||||
VIFileVersion "${INFO_PRODUCTVERSION}.0"
|
|
||||||
|
|
||||||
VIAddVersionKey "CompanyName" "${INFO_COMPANYNAME}"
|
|
||||||
VIAddVersionKey "FileDescription" "${INFO_PRODUCTNAME} Installer"
|
|
||||||
VIAddVersionKey "ProductVersion" "${INFO_PRODUCTVERSION}"
|
|
||||||
VIAddVersionKey "FileVersion" "${INFO_PRODUCTVERSION}"
|
|
||||||
VIAddVersionKey "LegalCopyright" "${INFO_COPYRIGHT}"
|
|
||||||
VIAddVersionKey "ProductName" "${INFO_PRODUCTNAME}"
|
|
||||||
|
|
||||||
!include "MUI.nsh"
|
|
||||||
|
|
||||||
!define MUI_ICON "..\icon.ico"
|
|
||||||
!define MUI_UNICON "..\icon.ico"
|
|
||||||
# !define MUI_WELCOMEFINISHPAGE_BITMAP "resources\leftimage.bmp" #Include this to add a bitmap on the left side of the Welcome Page. Must be a size of 164x314
|
|
||||||
!define MUI_FINISHPAGE_NOAUTOCLOSE # Wait on the INSTFILES page so the user can take a look into the details of the installation steps
|
|
||||||
!define MUI_ABORTWARNING # This will warn the user if they exit from the installer.
|
|
||||||
|
|
||||||
!insertmacro MUI_PAGE_WELCOME # Welcome to the installer page.
|
|
||||||
# !insertmacro MUI_PAGE_LICENSE "resources\eula.txt" # Adds a EULA page to the installer
|
|
||||||
!insertmacro MUI_PAGE_DIRECTORY # In which folder install page.
|
|
||||||
!insertmacro MUI_PAGE_INSTFILES # Installing page.
|
|
||||||
!insertmacro MUI_PAGE_FINISH # Finished installation page.
|
|
||||||
|
|
||||||
!insertmacro MUI_UNPAGE_INSTFILES # Uinstalling page
|
|
||||||
|
|
||||||
!insertmacro MUI_LANGUAGE "English" # Set the Language of the installer
|
|
||||||
|
|
||||||
## The following two statements can be used to sign the installer and the uninstaller. The path to the binaries are provided in %1
|
|
||||||
#!uninstfinalize 'signtool --file "%1"'
|
|
||||||
#!finalize 'signtool --file "%1"'
|
|
||||||
|
|
||||||
Name "${INFO_PRODUCTNAME}"
|
|
||||||
OutFile "..\..\bin\${INFO_PROJECTNAME}-${ARCH}-installer.exe" # Name of the installer's file.
|
|
||||||
InstallDir "$PROGRAMFILES64\${INFO_COMPANYNAME}\${INFO_PRODUCTNAME}" # Default installing folder ($PROGRAMFILES is Program Files folder).
|
|
||||||
ShowInstDetails show # This will always show the installation details.
|
|
||||||
|
|
||||||
Function .onInit
|
|
||||||
!insertmacro wails.checkArchitecture
|
|
||||||
FunctionEnd
|
|
||||||
|
|
||||||
Section
|
|
||||||
!insertmacro wails.webview2runtime
|
|
||||||
|
|
||||||
SetOutPath $INSTDIR
|
|
||||||
|
|
||||||
!insertmacro wails.files
|
|
||||||
|
|
||||||
CreateShortcut "$SMPROGRAMS\${INFO_PRODUCTNAME}.lnk" "$INSTDIR\${PRODUCT_EXECUTABLE}"
|
|
||||||
CreateShortCut "$DESKTOP\${INFO_PRODUCTNAME}.lnk" "$INSTDIR\${PRODUCT_EXECUTABLE}"
|
|
||||||
|
|
||||||
!insertmacro wails.writeUninstaller
|
|
||||||
SectionEnd
|
|
||||||
|
|
||||||
Section "uninstall"
|
|
||||||
RMDir /r "$AppData\${PRODUCT_EXECUTABLE}" # Remove the WebView2 DataPath
|
|
||||||
|
|
||||||
RMDir /r $INSTDIR
|
|
||||||
|
|
||||||
Delete "$SMPROGRAMS\${INFO_PRODUCTNAME}.lnk"
|
|
||||||
Delete "$DESKTOP\${INFO_PRODUCTNAME}.lnk"
|
|
||||||
|
|
||||||
!insertmacro wails.deleteUninstaller
|
|
||||||
SectionEnd
|
|
||||||
@@ -1,171 +0,0 @@
|
|||||||
# DO NOT EDIT - Generated automatically by `wails build`
|
|
||||||
|
|
||||||
!include "x64.nsh"
|
|
||||||
!include "WinVer.nsh"
|
|
||||||
!include "FileFunc.nsh"
|
|
||||||
|
|
||||||
!ifndef INFO_PROJECTNAME
|
|
||||||
!define INFO_PROJECTNAME "{{.Name}}"
|
|
||||||
!endif
|
|
||||||
!ifndef INFO_COMPANYNAME
|
|
||||||
!define INFO_COMPANYNAME "{{.Info.CompanyName}}"
|
|
||||||
!endif
|
|
||||||
!ifndef INFO_PRODUCTNAME
|
|
||||||
!define INFO_PRODUCTNAME "{{.Info.ProductName}}"
|
|
||||||
!endif
|
|
||||||
!ifndef INFO_PRODUCTVERSION
|
|
||||||
!define INFO_PRODUCTVERSION "{{.Info.ProductVersion}}"
|
|
||||||
!endif
|
|
||||||
!ifndef INFO_COPYRIGHT
|
|
||||||
!define INFO_COPYRIGHT "{{.Info.Copyright}}"
|
|
||||||
!endif
|
|
||||||
!ifndef PRODUCT_EXECUTABLE
|
|
||||||
!define PRODUCT_EXECUTABLE "${INFO_PROJECTNAME}.exe"
|
|
||||||
!endif
|
|
||||||
!ifndef UNINST_KEY_NAME
|
|
||||||
!define UNINST_KEY_NAME "${INFO_COMPANYNAME}${INFO_PRODUCTNAME}"
|
|
||||||
!endif
|
|
||||||
!define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINST_KEY_NAME}"
|
|
||||||
|
|
||||||
!ifndef REQUEST_EXECUTION_LEVEL
|
|
||||||
!define REQUEST_EXECUTION_LEVEL "admin"
|
|
||||||
!endif
|
|
||||||
|
|
||||||
RequestExecutionLevel "${REQUEST_EXECUTION_LEVEL}"
|
|
||||||
|
|
||||||
!ifdef ARG_WAILS_AMD64_BINARY
|
|
||||||
!define SUPPORTS_AMD64
|
|
||||||
!endif
|
|
||||||
|
|
||||||
!ifdef ARG_WAILS_ARM64_BINARY
|
|
||||||
!define SUPPORTS_ARM64
|
|
||||||
!endif
|
|
||||||
|
|
||||||
!ifdef SUPPORTS_AMD64
|
|
||||||
!ifdef SUPPORTS_ARM64
|
|
||||||
!define ARCH "amd64_arm64"
|
|
||||||
!else
|
|
||||||
!define ARCH "amd64"
|
|
||||||
!endif
|
|
||||||
!else
|
|
||||||
!ifdef SUPPORTS_ARM64
|
|
||||||
!define ARCH "arm64"
|
|
||||||
!else
|
|
||||||
!error "Wails: Undefined ARCH, please provide at least one of ARG_WAILS_AMD64_BINARY or ARG_WAILS_ARM64_BINARY"
|
|
||||||
!endif
|
|
||||||
!endif
|
|
||||||
|
|
||||||
!macro wails.checkArchitecture
|
|
||||||
!ifndef WAILS_WIN10_REQUIRED
|
|
||||||
!define WAILS_WIN10_REQUIRED "This product is only supported on Windows 10 (Server 2016) and later."
|
|
||||||
!endif
|
|
||||||
|
|
||||||
!ifndef WAILS_ARCHITECTURE_NOT_SUPPORTED
|
|
||||||
!define WAILS_ARCHITECTURE_NOT_SUPPORTED "This product can't be installed on the current Windows architecture. Supports: ${ARCH}"
|
|
||||||
!endif
|
|
||||||
|
|
||||||
${If} ${AtLeastWin10}
|
|
||||||
!ifdef SUPPORTS_AMD64
|
|
||||||
${if} ${IsNativeAMD64}
|
|
||||||
Goto ok
|
|
||||||
${EndIf}
|
|
||||||
!endif
|
|
||||||
|
|
||||||
!ifdef SUPPORTS_ARM64
|
|
||||||
${if} ${IsNativeARM64}
|
|
||||||
Goto ok
|
|
||||||
${EndIf}
|
|
||||||
!endif
|
|
||||||
|
|
||||||
IfSilent silentArch notSilentArch
|
|
||||||
silentArch:
|
|
||||||
SetErrorLevel 65
|
|
||||||
Abort
|
|
||||||
notSilentArch:
|
|
||||||
MessageBox MB_OK "${WAILS_ARCHITECTURE_NOT_SUPPORTED}"
|
|
||||||
Quit
|
|
||||||
${else}
|
|
||||||
IfSilent silentWin notSilentWin
|
|
||||||
silentWin:
|
|
||||||
SetErrorLevel 64
|
|
||||||
Abort
|
|
||||||
notSilentWin:
|
|
||||||
MessageBox MB_OK "${WAILS_WIN10_REQUIRED}"
|
|
||||||
Quit
|
|
||||||
${EndIf}
|
|
||||||
|
|
||||||
ok:
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
!macro wails.files
|
|
||||||
!ifdef SUPPORTS_AMD64
|
|
||||||
${if} ${IsNativeAMD64}
|
|
||||||
File "/oname=${PRODUCT_EXECUTABLE}" "${ARG_WAILS_AMD64_BINARY}"
|
|
||||||
${EndIf}
|
|
||||||
!endif
|
|
||||||
|
|
||||||
!ifdef SUPPORTS_ARM64
|
|
||||||
${if} ${IsNativeARM64}
|
|
||||||
File "/oname=${PRODUCT_EXECUTABLE}" "${ARG_WAILS_ARM64_BINARY}"
|
|
||||||
${EndIf}
|
|
||||||
!endif
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
!macro wails.writeUninstaller
|
|
||||||
WriteUninstaller "$INSTDIR\uninstall.exe"
|
|
||||||
|
|
||||||
SetRegView 64
|
|
||||||
WriteRegStr HKLM "${UNINST_KEY}" "Publisher" "${INFO_COMPANYNAME}"
|
|
||||||
WriteRegStr HKLM "${UNINST_KEY}" "DisplayName" "${INFO_PRODUCTNAME}"
|
|
||||||
WriteRegStr HKLM "${UNINST_KEY}" "DisplayVersion" "${INFO_PRODUCTVERSION}"
|
|
||||||
WriteRegStr HKLM "${UNINST_KEY}" "DisplayIcon" "$INSTDIR\${PRODUCT_EXECUTABLE}"
|
|
||||||
WriteRegStr HKLM "${UNINST_KEY}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
|
|
||||||
WriteRegStr HKLM "${UNINST_KEY}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
|
|
||||||
|
|
||||||
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
|
|
||||||
IntFmt $0 "0x%08X" $0
|
|
||||||
WriteRegDWORD HKLM "${UNINST_KEY}" "EstimatedSize" "$0"
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
!macro wails.deleteUninstaller
|
|
||||||
Delete "$INSTDIR\uninstall.exe"
|
|
||||||
|
|
||||||
SetRegView 64
|
|
||||||
DeleteRegKey HKLM "${UNINST_KEY}"
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
# Install webview2 by launching the bootstrapper
|
|
||||||
# See https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#online-only-deployment
|
|
||||||
!macro wails.webview2runtime
|
|
||||||
!ifndef WAILS_INSTALL_WEBVIEW_DETAILPRINT
|
|
||||||
!define WAILS_INSTALL_WEBVIEW_DETAILPRINT "Installing: WebView2 Runtime"
|
|
||||||
!endif
|
|
||||||
|
|
||||||
SetRegView 64
|
|
||||||
# If the admin key exists and is not empty then webview2 is already installed
|
|
||||||
ReadRegStr $0 HKLM "SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" "pv"
|
|
||||||
${If} $0 != ""
|
|
||||||
Goto ok
|
|
||||||
${EndIf}
|
|
||||||
|
|
||||||
${If} ${REQUEST_EXECUTION_LEVEL} == "user"
|
|
||||||
# If the installer is run in user level, check the user specific key exists and is not empty then webview2 is already installed
|
|
||||||
ReadRegStr $0 HKCU "Software\Microsoft\EdgeUpdate\Clients{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" "pv"
|
|
||||||
${If} $0 != ""
|
|
||||||
Goto ok
|
|
||||||
${EndIf}
|
|
||||||
${EndIf}
|
|
||||||
|
|
||||||
SetDetailsPrint both
|
|
||||||
DetailPrint "${WAILS_INSTALL_WEBVIEW_DETAILPRINT}"
|
|
||||||
SetDetailsPrint listonly
|
|
||||||
|
|
||||||
InitPluginsDir
|
|
||||||
CreateDirectory "$pluginsdir\webview2bootstrapper"
|
|
||||||
SetOutPath "$pluginsdir\webview2bootstrapper"
|
|
||||||
File "tmp\MicrosoftEdgeWebview2Setup.exe"
|
|
||||||
ExecWait '"$pluginsdir\webview2bootstrapper\MicrosoftEdgeWebview2Setup.exe" /silent /install'
|
|
||||||
|
|
||||||
SetDetailsPrint both
|
|
||||||
ok:
|
|
||||||
!macroend
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
||||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
|
||||||
<assemblyIdentity type="win32" name="com.wails.{{.Name}}" version="{{.Info.ProductVersion}}.0" processorArchitecture="*"/>
|
|
||||||
<dependency>
|
|
||||||
<dependentAssembly>
|
|
||||||
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
|
|
||||||
</dependentAssembly>
|
|
||||||
</dependency>
|
|
||||||
<asmv3:application>
|
|
||||||
<asmv3:windowsSettings>
|
|
||||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware> <!-- fallback for Windows 7 and 8 -->
|
|
||||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">permonitorv2,permonitor</dpiAwareness> <!-- falls back to per-monitor if per-monitor v2 is not supported -->
|
|
||||||
</asmv3:windowsSettings>
|
|
||||||
</asmv3:application>
|
|
||||||
</assembly>
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8"/>
|
|
||||||
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
|
|
||||||
<title>Systray Example</title>
|
|
||||||
<style>
|
|
||||||
html {
|
|
||||||
background-color: rgba(27, 38, 54, 0.75);
|
|
||||||
text-align: center;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@font-face {
|
|
||||||
font-family: "Nunito";
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 400;
|
|
||||||
src: local(""),
|
|
||||||
url("../../common/fonts/nunito-v16-latin-regular.woff2") format("woff2");
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
color: white;
|
|
||||||
font-family: "Nunito", sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
.logo {
|
|
||||||
display: block;
|
|
||||||
width: 50%;
|
|
||||||
height: 50%;
|
|
||||||
background-position: center;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-image: url("../../common/images/logo-universal.png");
|
|
||||||
background-size: 100% 100%;
|
|
||||||
background-origin: content-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
#app {
|
|
||||||
height: 100vh;
|
|
||||||
text-align: center;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="app">
|
|
||||||
<div class="logo"></div>
|
|
||||||
<p>Systray Example</p>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
-852
File diff suppressed because it is too large
Load Diff
@@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "frontend",
|
|
||||||
"private": true,
|
|
||||||
"version": "0.0.0",
|
|
||||||
"scripts": {
|
|
||||||
"dev": "vite",
|
|
||||||
"build": "vite build",
|
|
||||||
"preview": "vite preview"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"vite": "^2.9.9"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
module github.com/wailsapp/examples/systray
|
|
||||||
|
|
||||||
go 1.18
|
|
||||||
|
|
||||||
require github.com/wailsapp/wails/v2 v2.2.0
|
|
||||||
|
|
||||||
require (
|
|
||||||
github.com/bep/debounce v1.2.1 // indirect
|
|
||||||
github.com/go-ole/go-ole v1.2.6 // indirect
|
|
||||||
github.com/google/uuid v1.1.2 // indirect
|
|
||||||
github.com/imdario/mergo v0.3.12 // indirect
|
|
||||||
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect
|
|
||||||
github.com/labstack/echo/v4 v4.9.0 // indirect
|
|
||||||
github.com/labstack/gommon v0.3.1 // indirect
|
|
||||||
github.com/leaanthony/go-ansi-parser v1.0.1 // indirect
|
|
||||||
github.com/leaanthony/gosod v1.0.3 // indirect
|
|
||||||
github.com/leaanthony/slicer v1.5.0 // indirect
|
|
||||||
github.com/mattn/go-colorable v0.1.11 // indirect
|
|
||||||
github.com/mattn/go-isatty v0.0.14 // indirect
|
|
||||||
github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2 // indirect
|
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
|
||||||
github.com/samber/lo v1.27.1 // indirect
|
|
||||||
github.com/tkrajina/go-reflector v0.5.5 // indirect
|
|
||||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
|
||||||
github.com/valyala/fasttemplate v1.2.1 // indirect
|
|
||||||
github.com/wailsapp/mimetype v1.4.1 // indirect
|
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
|
|
||||||
golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 // indirect
|
|
||||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect
|
|
||||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
|
|
||||||
golang.org/x/text v0.3.7 // indirect
|
|
||||||
)
|
|
||||||
|
|
||||||
replace github.com/wailsapp/wails/v2 v2.2.0 => ../..
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
github.com/bep/debounce v1.2.1 h1:v67fRdBA9UQu2NhLFXrSg0Brw7CexQekrBwDMM8bzeY=
|
|
||||||
github.com/bep/debounce v1.2.1/go.mod h1:H8yggRPQKLUhUoqrJC1bO2xNya7vanpDl7xR3ISbCJ0=
|
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
|
||||||
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
|
|
||||||
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
|
||||||
github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y=
|
|
||||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
|
||||||
github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
|
|
||||||
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
|
|
||||||
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e h1:Q3+PugElBCf4PFpxhErSzU3/PY5sFL5Z6rfv4AbGAck=
|
|
||||||
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs=
|
|
||||||
github.com/labstack/echo/v4 v4.9.0 h1:wPOF1CE6gvt/kmbMR4dGzWvHMPT+sAEUJOwOTtvITVY=
|
|
||||||
github.com/labstack/echo/v4 v4.9.0/go.mod h1:xkCDAdFCIf8jsFQ5NnbK7oqaF/yU1A1X20Ltm0OvSks=
|
|
||||||
github.com/labstack/gommon v0.3.1 h1:OomWaJXm7xR6L1HmEtGyQf26TEn7V6X88mktX9kee9o=
|
|
||||||
github.com/labstack/gommon v0.3.1/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM=
|
|
||||||
github.com/leaanthony/debme v1.2.1 h1:9Tgwf+kjcrbMQ4WnPcEIUcQuIZYqdWftzZkBr+i/oOc=
|
|
||||||
github.com/leaanthony/debme v1.2.1/go.mod h1:3V+sCm5tYAgQymvSOfYQ5Xx2JCr+OXiD9Jkw3otUjiA=
|
|
||||||
github.com/leaanthony/go-ansi-parser v1.0.1 h1:97v6c5kYppVsbScf4r/VZdXyQ21KQIfeQOk2DgKxGG4=
|
|
||||||
github.com/leaanthony/go-ansi-parser v1.0.1/go.mod h1:7arTzgVI47srICYhvgUV4CGd063sGEeoSlych5yeSPM=
|
|
||||||
github.com/leaanthony/gosod v1.0.3 h1:Fnt+/B6NjQOVuCWOKYRREZnjGyvg+mEhd1nkkA04aTQ=
|
|
||||||
github.com/leaanthony/gosod v1.0.3/go.mod h1:BJ2J+oHsQIyIQpnLPjnqFGTMnOZXDbvWtRCSG7jGxs4=
|
|
||||||
github.com/leaanthony/slicer v1.5.0 h1:aHYTN8xbCCLxJmkNKiLB6tgcMARl4eWmH9/F+S/0HtY=
|
|
||||||
github.com/leaanthony/slicer v1.5.0/go.mod h1:FwrApmf8gOrpzEWM2J/9Lh79tyq8KTX5AzRtwV7m4AY=
|
|
||||||
github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE=
|
|
||||||
github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
|
|
||||||
github.com/mattn/go-colorable v0.1.11 h1:nQ+aFkoE2TMGc0b68U2OKSexC+eq46+XwZzWXHRmPYs=
|
|
||||||
github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
|
|
||||||
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
|
|
||||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
|
||||||
github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2 h1:acNfDZXmm28D2Yg/c3ALnZStzNaZMSagpbr96vY6Zjc=
|
|
||||||
github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI=
|
|
||||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
|
||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
|
||||||
github.com/samber/lo v1.27.1 h1:sTXwkRiIFIQG+G0HeAvOEnGjqWeWtI9cg5/n51KrxPg=
|
|
||||||
github.com/samber/lo v1.27.1/go.mod h1:it33p9UtPMS7z72fP4gw/EIfQB2eI8ke7GR2wc6+Rhg=
|
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
|
||||||
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
|
|
||||||
github.com/thoas/go-funk v0.9.1 h1:O549iLZqPpTUQ10ykd26sZhzD+rmR5pWhuElrhbC20M=
|
|
||||||
github.com/tkrajina/go-reflector v0.5.5 h1:gwoQFNye30Kk7NrExj8zm3zFtrGPqOkzFMLuQZg1DtQ=
|
|
||||||
github.com/tkrajina/go-reflector v0.5.5/go.mod h1:ECbqLgccecY5kPmPmXg1MrHW585yMcDkVl6IvJe64T4=
|
|
||||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
|
||||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
|
||||||
github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4=
|
|
||||||
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
|
|
||||||
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
|
|
||||||
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
|
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg=
|
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
|
||||||
golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 h1:3MTrJm4PyNL9NBqvYDSj3DHl46qQakyfqfWo4jgfaEM=
|
|
||||||
golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE=
|
|
||||||
golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
|
||||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0=
|
|
||||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
|
||||||
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200810151505-1b9f1253b3ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
|
|
||||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
|
||||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
|
||||||
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
|
|
||||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
|
|
||||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
|
||||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.1 KiB |
@@ -1,217 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"embed"
|
|
||||||
"fmt"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v2/pkg/application"
|
|
||||||
"github.com/wailsapp/wails/v2/pkg/menu"
|
|
||||||
"github.com/wailsapp/wails/v2/pkg/options"
|
|
||||||
"github.com/wailsapp/wails/v2/pkg/options/windows"
|
|
||||||
"github.com/wailsapp/wails/v2/pkg/runtime"
|
|
||||||
)
|
|
||||||
|
|
||||||
//go:embed all:frontend/dist
|
|
||||||
var assets embed.FS
|
|
||||||
|
|
||||||
//go:embed iconLightMode.png
|
|
||||||
var lightModeIcon []byte
|
|
||||||
|
|
||||||
//go:embed iconDarkMode.png
|
|
||||||
var darkModeIcon []byte
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
|
|
||||||
var runtimeContext context.Context
|
|
||||||
|
|
||||||
// Create a new Wails application using the current options
|
|
||||||
mainApp := application.NewWithOptions(&options.App{
|
|
||||||
Assets: assets,
|
|
||||||
StartHidden: true,
|
|
||||||
HideWindowOnClose: true,
|
|
||||||
OnStartup: func(ctx context.Context) {
|
|
||||||
runtimeContext = ctx
|
|
||||||
},
|
|
||||||
Windows: &windows.Options{
|
|
||||||
BackdropType: windows.Acrylic,
|
|
||||||
WindowIsTranslucent: true,
|
|
||||||
WebviewIsTransparent: true,
|
|
||||||
DisableWindowIcon: true,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
// ------------------------------------
|
|
||||||
// Create a systray for the application
|
|
||||||
// Currently we only support PNG for icons
|
|
||||||
|
|
||||||
var systray *application.SystemTray
|
|
||||||
var showWindow = func() {
|
|
||||||
// Show the window
|
|
||||||
// In a future version of this API, it will be possible to
|
|
||||||
// create windows programmatically and be able to show/hide
|
|
||||||
// them from the systray with something like:
|
|
||||||
//
|
|
||||||
// myWindow := mainApp.NewWindow(...)
|
|
||||||
// mainApp.NewSystemTray(&options.SystemTray{
|
|
||||||
// OnLeftClick: func() {
|
|
||||||
// myWindow.SetVisibility(!myWindow.IsVisible())
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
runtime.Show(runtimeContext)
|
|
||||||
}
|
|
||||||
systray = mainApp.NewSystemTray(&options.SystemTray{
|
|
||||||
// This is the icon used when the system in using light mode
|
|
||||||
LightModeIcon: &options.SystemTrayIcon{
|
|
||||||
Data: lightModeIcon,
|
|
||||||
},
|
|
||||||
// This is the icon used when the system in using dark mode
|
|
||||||
DarkModeIcon: &options.SystemTrayIcon{
|
|
||||||
Data: darkModeIcon,
|
|
||||||
},
|
|
||||||
Tooltip: "Systray Example",
|
|
||||||
OnLeftClick: showWindow,
|
|
||||||
OnMenuClose: func() {
|
|
||||||
// Add the left click call after 500ms
|
|
||||||
// We do this because the left click fires right
|
|
||||||
// after the menu closes, and we don't want to show
|
|
||||||
// the window on menu close.
|
|
||||||
go func() {
|
|
||||||
time.Sleep(500 * time.Millisecond)
|
|
||||||
systray.OnLeftClick(showWindow)
|
|
||||||
}()
|
|
||||||
},
|
|
||||||
OnMenuOpen: func() {
|
|
||||||
// Remove the left click callback
|
|
||||||
systray.OnLeftClick(func() {})
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
// ---------------------------------------------------
|
|
||||||
// Menu items are created in the order they are added.
|
|
||||||
// This is a contrived example to show what can be done
|
|
||||||
// with menus.
|
|
||||||
|
|
||||||
// This is a menuitem we will show/hide at runtime
|
|
||||||
visibleNotVisible := menu.Label("visible?").Show()
|
|
||||||
|
|
||||||
counter := 0
|
|
||||||
icons := [][]byte{lightModeIcon, darkModeIcon}
|
|
||||||
iconCounter := 0
|
|
||||||
|
|
||||||
disabledEnabledMenu := menu.Label("disabled").Disable().OnClick(func(c *menu.CallbackData) {
|
|
||||||
println("Disabled item clicked!")
|
|
||||||
})
|
|
||||||
|
|
||||||
// This checkbox menuitem will print the current checked state to the console when clicked.
|
|
||||||
// When a checkbox item is clicked, the state of the `Checked` variable is toggled.
|
|
||||||
// The UI automatically reflects the current state, even if this item is used multiple times.
|
|
||||||
mycheckbox := menu.Label("checked").SetChecked(true).OnClick(func(c *menu.CallbackData) {
|
|
||||||
println("My checked state is: ", c.MenuItem.Checked)
|
|
||||||
})
|
|
||||||
|
|
||||||
// This radio callback will be used by all the radio items.
|
|
||||||
// The CallbackData has a pointer back to the menuitem, so we can determine
|
|
||||||
// which item was selected
|
|
||||||
radioCallback := func(data *menu.CallbackData) {
|
|
||||||
println("Radio item clicked:", data.MenuItem.Label)
|
|
||||||
}
|
|
||||||
|
|
||||||
// We create 3 radio items , with the first being selected. They all share a callback.
|
|
||||||
radio1 := menu.Radio("Radio 1", true, nil, radioCallback)
|
|
||||||
radio2 := menu.Radio("Radio 2", false, nil, radioCallback)
|
|
||||||
radio3 := menu.Radio("Radio 3", false, nil, radioCallback)
|
|
||||||
|
|
||||||
// Now we set the menu of the systray.
|
|
||||||
// This would likely be created in a different function/file
|
|
||||||
systray.SetMenu(menu.NewMenuFromItems(
|
|
||||||
|
|
||||||
visibleNotVisible,
|
|
||||||
// This menu item changes its label when clicked.
|
|
||||||
menu.Label("Click Me!").OnClick(func(c *menu.CallbackData) {
|
|
||||||
counter++
|
|
||||||
c.MenuItem.SetLabel(fmt.Sprintf("Clicked %d times", counter))
|
|
||||||
systray.Update()
|
|
||||||
}),
|
|
||||||
|
|
||||||
// We add a checkbox
|
|
||||||
menu.Separator(),
|
|
||||||
mycheckbox,
|
|
||||||
|
|
||||||
// Next we create 2 radio groups containing the same menu items.
|
|
||||||
// It is perfectly fine to reuse radio item groups - the state and UI will
|
|
||||||
// stay in sync. Warning: Using the same radio item in different groups will
|
|
||||||
// lead to unspecified behaviour!
|
|
||||||
menu.Separator(),
|
|
||||||
radio1,
|
|
||||||
radio2,
|
|
||||||
radio3,
|
|
||||||
|
|
||||||
menu.Separator(),
|
|
||||||
mycheckbox,
|
|
||||||
|
|
||||||
menu.Label("Toggle items!").OnClick(func(c *menu.CallbackData) {
|
|
||||||
|
|
||||||
iconCounter++
|
|
||||||
|
|
||||||
// Swap light and dark mode icons
|
|
||||||
systray.SetIcons(&options.SystemTrayIcon{
|
|
||||||
Data: icons[iconCounter%2],
|
|
||||||
}, &options.SystemTrayIcon{
|
|
||||||
Data: icons[(iconCounter+1)%2],
|
|
||||||
})
|
|
||||||
|
|
||||||
// Do some toggling
|
|
||||||
if iconCounter%2 == 0 {
|
|
||||||
visibleNotVisible.Show()
|
|
||||||
disabledEnabledMenu.Disable()
|
|
||||||
} else {
|
|
||||||
visibleNotVisible.Hide()
|
|
||||||
disabledEnabledMenu.Enable()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update the menu
|
|
||||||
err := systray.Update()
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
// We create a checkbox item that is initially unchecked.
|
|
||||||
menu.Label("unchecked").SetChecked(false).OnClick(func(c *menu.CallbackData) {
|
|
||||||
println("My checked state is: ", c.MenuItem.Checked)
|
|
||||||
systray.SetTooltip("My updated tooltip!")
|
|
||||||
}),
|
|
||||||
|
|
||||||
// This menu item will toggle between enabled and disabled each time the "Toggle items!" menu
|
|
||||||
// option is selected
|
|
||||||
disabledEnabledMenu,
|
|
||||||
|
|
||||||
// We now add a submenu, reusing the checkbox item and submenu we created earlier
|
|
||||||
menu.SubMenu("submenu", menu.NewMenuFromItems(
|
|
||||||
mycheckbox,
|
|
||||||
menu.Label("submenu item").OnClick(func(data *menu.CallbackData) {
|
|
||||||
println("submenu item clicked")
|
|
||||||
}),
|
|
||||||
menu.Separator(),
|
|
||||||
radio1,
|
|
||||||
radio2,
|
|
||||||
radio3,
|
|
||||||
)),
|
|
||||||
menu.Separator(),
|
|
||||||
menu.Label("quit").OnClick(func(_ *menu.CallbackData) {
|
|
||||||
println("Quitting application")
|
|
||||||
mainApp.Quit()
|
|
||||||
}),
|
|
||||||
))
|
|
||||||
|
|
||||||
println("Check out the system tray!")
|
|
||||||
|
|
||||||
// Now we run the application
|
|
||||||
err := mainApp.Run()
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
println("Error:", err.Error())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "systray",
|
|
||||||
"outputfilename": "systray",
|
|
||||||
"frontend:install": "npm install",
|
|
||||||
"frontend:build": "npm run build",
|
|
||||||
"frontend:dev:watcher": "npm run dev",
|
|
||||||
"frontend:dev:serverUrl": "auto",
|
|
||||||
"author": {
|
|
||||||
"name": "Lea Anthony",
|
|
||||||
"email": "lea.anthony@gmail.com"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
package platform
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/wailsapp/wails/v2/internal/platform/systray"
|
|
||||||
"github.com/wailsapp/wails/v2/pkg/menu"
|
|
||||||
"github.com/wailsapp/wails/v2/pkg/options"
|
|
||||||
)
|
|
||||||
import "github.com/samber/lo"
|
|
||||||
|
|
||||||
type SysTray interface {
|
|
||||||
// SetTitle sets the title of the tray menu
|
|
||||||
SetTitle(title string)
|
|
||||||
SetTooltip(tooltip string) error
|
|
||||||
Show() error
|
|
||||||
Hide() error
|
|
||||||
Run() error
|
|
||||||
Close()
|
|
||||||
SetMenu(menu *menu.Menu) error
|
|
||||||
SetIcons(lightModeIcon, darkModeIcon *options.SystemTrayIcon) error
|
|
||||||
Update() error
|
|
||||||
OnLeftClick(func())
|
|
||||||
OnRightClick(func())
|
|
||||||
OnLeftDoubleClick(func())
|
|
||||||
OnRightDoubleClick(func())
|
|
||||||
OnMenuClose(func())
|
|
||||||
OnMenuOpen(func())
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewSysTray() SysTray {
|
|
||||||
return lo.Must(systray.New())
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user