Compare commits

...

16 Commits

Author SHA1 Message Date
Lea Anthony
6f94b047ab v1.6.0-pre6 2020-06-06 14:41:39 +10:00
Lea Anthony
37a56ead4d fix: Project options getting overwritten 2020-06-06 14:40:33 +10:00
Lea Anthony
ecaaafa9d9 v1.6.0-pre5 2020-05-27 12:49:14 +10:00
Lea Anthony
0009da9585 fix: ignore case of linux distro id 2020-05-27 12:48:28 +10:00
Lea Anthony
6235e83677 v1.6.0-pre4 2020-05-27 10:38:40 +10:00
Lea Anthony
9f93e7d979 fix default libs identifier for solus 2020-05-27 10:35:42 +10:00
Lea Anthony
949bc40317 Fix package detection for solus 2020-05-27 10:35:42 +10:00
Lea Anthony
81777f29d8 update package names 2020-05-27 10:35:42 +10:00
Lea Anthony
5d35dd3105 Initial support for solus 2020-05-27 10:35:42 +10:00
Lea Anthony
ad034d3950 fix: popos ID 2020-05-27 08:28:23 +10:00
Lea Anthony
98337df92d Support Pop!_OS
Added link to guide in request process
2020-05-27 08:28:23 +10:00
Dario Emerson
9cc417cf04 Add myself as contributor 2020-05-25 20:48:48 +10:00
Dario Emerson
030b954971 Correctly add icon to window on Windows 2020-05-25 20:48:48 +10:00
Dario Emerson
7a3ab27977 Changed icon scaling algorithm to CatmullRom 2020-05-25 17:32:49 +10:00
Dario Emerson
0e6265a9d7 Moved ico file writing later 2020-05-25 17:32:49 +10:00
Dario Emerson
b003a080b0 Improved Windows .ico generation 2020-05-25 17:32:49 +10:00
10 changed files with 138 additions and 57 deletions

View File

@@ -27,3 +27,4 @@ Wails is what it is because of the time and effort given by these great people.
* [Jarek](https://github.com/Jarek-SRT)
* [Konez2k](https://github.com/konez2k)
* [msms](https://github.com/sayuthisobri)
* [dedo1911](https://github.com/dedo1911)

View File

@@ -55,7 +55,7 @@ _Debian: 8, 9, 10_
_Ubuntu: 16.04, 18.04, 19.04_
_Also succesfully tested on: Zorin 15, Parrot 4.7, Linuxmint 19, Elementary 5, Kali, Neon_
_Also succesfully tested on: Zorin 15, Parrot 4.7, Linuxmint 19, Elementary 5, Kali, Neon_, Pop!_OS
#### Arch Linux / ArchLabs

View File

@@ -59,6 +59,10 @@ const (
Leap
// ArchLabs distribution
ArchLabs
// PopOS distribution
PopOS
// Solus distribution
Solus
)
// DistroInfo contains all the information relating to a linux distribution
@@ -107,7 +111,7 @@ func parseOsRelease(osRelease string) *DistroInfo {
}
switch splitLine[0] {
case "ID":
osID = strings.Trim(splitLine[1], "\"")
osID = strings.ToLower(strings.Trim(splitLine[1], "\""))
case "NAME":
osNAME = strings.Trim(splitLine[1], "\"")
case "VERSION_ID":
@@ -116,7 +120,7 @@ func parseOsRelease(osRelease string) *DistroInfo {
}
// Check distro name against list of distros
switch strings.ToLower(osID) {
switch osID {
case "fedora":
result.Distribution = Fedora
case "centos":
@@ -159,6 +163,10 @@ func parseOsRelease(osRelease string) *DistroInfo {
result.Distribution = Tumbleweed
case "opensuse-leap":
result.Distribution = Leap
case "pop":
result.Distribution = PopOS
case "solus":
result.Distribution = Solus
default:
result.Distribution = Unknown
}
@@ -195,6 +203,17 @@ func DpkgInstalled(packageName string) (bool, error) {
return exitCode == 0, nil
}
// EOpkgInstalled uses dpkg to see if a package is installed
func EOpkgInstalled(packageName string) (bool, error) {
program := NewProgramHelper()
eopkg := program.FindProgram("eopkg")
if eopkg == nil {
return false, fmt.Errorf("cannot check dependencies: eopkg not found")
}
stdout, _, _, _ := eopkg.Run("info", packageName)
return strings.HasPrefix(stdout, "Installed"), nil
}
// PacmanInstalled uses pacman to see if a package is installed.
func PacmanInstalled(packageName string) (bool, error) {
program := NewProgramHelper()
@@ -266,5 +285,9 @@ func RequestSupportForDistribution(distroInfo *DistroInfo) error {
fmt.Println("Opening browser to file request.")
browser.OpenURL(fullURL + url.PathEscape(params))
result = Prompt("We have a guide for adding support for your distribution. Would you like to view it?", "yes")
if strings.ToLower(result) == "yes" {
browser.OpenURL("https://wails.app/guides/distro/")
}
return nil
}

View File

@@ -28,6 +28,15 @@ distributions:
gccversioncommand: &gccdumpfullversion -dumpfullversion
programs: *debiandefaultprograms
libraries: *debiandefaultlibraries
pop:
id: pop
releases:
default:
version: default
name: Pop!_OS
gccversioncommand: &gccdumpfullversion -dumpfullversion
programs: *debiandefaultprograms
libraries: *debiandefaultlibraries
kali:
id: kali
releases:
@@ -232,6 +241,25 @@ distributions:
gccversioncommand: *gccdumpfullversion
programs: *debiandefaultprograms
libraries: *debiandefaultlibraries
solus:
id: solus
releases:
default:
version: default
name: Solus
gccversioncommand: *gccdumpfullversion
programs: &solusdefaultprograms
- name: gcc
help: Please install with `sudo eopkg it -c system.devel` and try again
- name: pkg-config
help: Please install with `sudo eopkg it -c system.devel` and try again
- name: npm
help: Please install with `sudo eopkg it nodejs` and try again
libraries: &solusdefaultlibraries
- name: libgtk-3-devel
help: Please install with `sudo eopkg it libgtk-3-devel` and try again
- name: libwebkit-gtk-devel
help: Please install with `sudo eopkg it libwebkit-gtk-devel` and try again
opensuse-tumbleweed:
id: opensuse-tumbleweed

View File

@@ -16,9 +16,8 @@ import (
"text/template"
"time"
"golang.org/x/image/draw"
"github.com/jackmordaunt/icns"
"golang.org/x/image/draw"
)
// PackageHelper helps with the 'wails package' command
@@ -60,83 +59,107 @@ func newPlistData(title, exe, packageID, version, author string) *plistData {
}
}
type windowsIconHeader struct {
type windowsIcoHeader struct {
_ uint16
imageType uint16
imageCount uint16
width uint8
height uint8
colours uint8
_ uint8
planes uint16
bpp uint16
size uint32
offset uint32
}
type windowsIcoDescriptor struct {
width uint8
height uint8
colours uint8
_ uint8
planes uint16
bpp uint16
size uint32
offset uint32
}
type windowsIcoContainer struct {
Header windowsIcoDescriptor
Data []byte
}
func generateWindowsIcon(pngFilename string, iconfile string) error {
header := &windowsIconHeader{
imageType: 1,
imageCount: 1,
bpp: 32,
planes: 1,
offset: 22,
width: 0,
height: 0,
}
sizes := []int{256, 128, 64, 48, 32, 16}
// Load png
pngfile, err := os.Open(pngFilename)
if err != nil {
return err
}
defer pngfile.Close()
// Decode to internal image
pngdata, err := png.Decode(pngfile)
if err != nil {
return err
}
// Scale to 256*256
rect := image.Rect(0, 0, 255, 255)
rawdata := image.NewRGBA(rect)
scale := draw.ApproxBiLinear
scale.Scale(rawdata, rect, pngdata, pngdata.Bounds(), draw.Over, nil)
icons := []windowsIcoContainer{}
// Convert back to PNG
icondata := new(bytes.Buffer)
writer := bufio.NewWriter(icondata)
err = png.Encode(writer, rawdata)
if err != nil {
return err
}
err = writer.Flush()
if err != nil {
return err
for _, size := range sizes {
rect := image.Rect(0, 0, int(size), int(size))
rawdata := image.NewRGBA(rect)
scale := draw.CatmullRom
scale.Scale(rawdata, rect, pngdata, pngdata.Bounds(), draw.Over, nil)
icondata := new(bytes.Buffer)
writer := bufio.NewWriter(icondata)
err = png.Encode(writer, rawdata)
if err != nil {
return err
}
writer.Flush()
imgSize := size
if imgSize >= 256 {
imgSize = 0
}
data := icondata.Bytes()
icn := windowsIcoContainer{
Header: windowsIcoDescriptor{
width: uint8(imgSize),
height: uint8(imgSize),
planes: 1,
bpp: 32,
size: uint32(len(data)),
},
Data: data,
}
icons = append(icons, icn)
}
// Save size of PNG data
header.size = uint32(len(icondata.Bytes()))
// Open icon file for writing
outfilename := filepath.Join(filepath.Dir(pngFilename), iconfile)
outfile, err := os.Create(outfilename)
outfile, err := os.Create(iconfile)
if err != nil {
return err
}
defer outfile.Close()
// Write out the header
err = binary.Write(outfile, binary.LittleEndian, header)
ico := windowsIcoHeader{
imageType: 1,
imageCount: uint16(len(sizes)),
}
err = binary.Write(outfile, binary.LittleEndian, ico)
if err != nil {
return err
}
// Write out the image data
_, err = outfile.Write(icondata.Bytes())
if err != nil {
return err
offset := uint32(6 + 16*len(sizes))
for _, icon := range icons {
icon.Header.offset = offset
err = binary.Write(outfile, binary.LittleEndian, icon.Header)
if err != nil {
return err
}
offset += icon.Header.size
}
for _, icon := range icons {
_, err = outfile.Write(icon.Data)
if err != nil {
return err
}
}
return nil
}

View File

@@ -1,2 +1,2 @@
100 ICON "$NAME$.ico"
100 24 "$NAME$.exe.manifest"
110 24 "$NAME$.exe.manifest"

View File

@@ -274,7 +274,7 @@ func CheckDependencies(logger *Logger) (bool, error) {
distroInfo := GetLinuxDistroInfo()
switch distroInfo.Distribution {
case Ubuntu, Debian, Zorin, Parrot, Linuxmint, Elementary, Kali, Neon, Deepin, Raspbian:
case Ubuntu, Debian, Zorin, Parrot, Linuxmint, Elementary, Kali, Neon, Deepin, Raspbian, PopOS:
libraryChecker = DpkgInstalled
case Arch, ArcoLinux, ArchLabs, Manjaro, ManjaroARM:
libraryChecker = PacmanInstalled
@@ -284,6 +284,8 @@ func CheckDependencies(logger *Logger) (bool, error) {
libraryChecker = EqueryInstalled
case VoidLinux:
libraryChecker = XbpsInstalled
case Solus:
libraryChecker = EOpkgInstalled
default:
return false, RequestSupportForDistribution(distroInfo)
}

View File

@@ -1,4 +1,4 @@
package cmd
// Version - Wails version
const Version = "v1.6.0-pre3"
const Version = "v1.6.0-pre6"

View File

@@ -35,8 +35,6 @@ func init() {
// Project options
projectOptions := &cmd.ProjectOptions{}
projectOptions.Verbose = verbose
projectOptions.Platform = runtime.GOOS
// Check we are in project directory
// Check project.json loads correctly
@@ -46,6 +44,10 @@ func init() {
return err
}
// Set project options
projectOptions.Verbose = verbose
projectOptions.Platform = runtime.GOOS
// Save project directory
projectDir := fs.Cwd()

View File

@@ -1410,6 +1410,8 @@ struct webview_priv
wc.hInstance = hInstance;
wc.lpfnWndProc = wndproc;
wc.lpszClassName = classname;
wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(100));
wc.hIconSm = LoadIcon(hInstance, MAKEINTRESOURCE(100));
RegisterClassEx(&wc);
style = WS_OVERLAPPEDWINDOW;