Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v3 feature] support for MacOS Panel #3763

Open
wants to merge 25 commits into
base: v3-alpha
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
84bcb3a
first implementation of a macos panel
nixpare Sep 15, 2024
5b5b12b
MacOS NSPanel implemented with every existing feature
nixpare Sep 19, 2024
8372120
Fixed WebviewWindow dealloc function
nixpare Sep 19, 2024
7d39b17
Merge commit '860d02d1fe7c7e11731d9e0c2dc617d0e80cdc39 (tag v3.0.0-al…
nixpare Sep 19, 2024
71327ca
Improved event error logs
nixpare Sep 19, 2024
1a9b1b1
Proper file rename
nixpare Sep 20, 2024
7797e2e
Prepared multi-os support and fixed examples
nixpare Sep 20, 2024
76558b9
App method to create panel exposed to every OS
nixpare Sep 20, 2024
2ede8e2
Fixed some issues pointed out in the PR by rabbit
nixpare Sep 21, 2024
95710b7
Merge commit '5367d056e2e4f028fdbae4ede4d51e6d079fdd7a' into v3-alpha…
nixpare Sep 21, 2024
c142752
Reduced code duplication and magic numbers, improved code style consi…
nixpare Sep 21, 2024
5b5aa4a
Support for linux deb,rpm,arch linux packager packaging
atterpac Nov 23, 2024
7f13eca
remove optional tasks from linux:package task
atterpac Nov 23, 2024
8783d21
Merge branch 'v3-alpha' into v3/linux-packaging
atterpac Nov 23, 2024
6e12413
Update Taskfile.linux.yml
leaanthony Nov 24, 2024
475ba28
Integrated nfpm into CLI.
leaanthony Nov 24, 2024
8d7f763
package tool fixes and add bundle name field
atterpac Nov 24, 2024
c222803
add linux depdencies
atterpac Nov 24, 2024
2276b73
Add some docs
leaanthony Nov 24, 2024
473bbfb
Fixed tests. Updated task to latest.
leaanthony Nov 24, 2024
bd568e6
Update v3/internal/commands/tool_package.go
leaanthony Nov 24, 2024
0f2bd0e
Remove doctor references to nfpm
leaanthony Nov 30, 2024
4cf4d57
Merge branch 'fork/atterpac/v3/linux-packaging' into fork/nixpare/v3-…
leaanthony Nov 30, 2024
2ece458
Merge branch 'refs/heads/v3-alpha' into fork/nixpare/v3-alpha-feature…
leaanthony Nov 30, 2024
ac210d9
Fix bugs
leaanthony Nov 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions v3/examples/build/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func main() {
log.Println("ApplicationDidFinishLaunching")
})

currentWindow := func(fn func(window *application.WebviewWindow)) {
currentWindow := func(fn func(window application.Window)) {
if app.CurrentWindow() != nil {
fn(app.CurrentWindow())
} else {
Expand Down Expand Up @@ -118,122 +118,122 @@ func main() {

sizeMenu := menu.AddSubmenu("Size")
sizeMenu.Add("Set Size (800,600)").OnClick(func(ctx *application.Context) {
currentWindow(func(w *application.WebviewWindow) {
currentWindow(func(w application.Window) {
w.SetSize(800, 600)
})
})

sizeMenu.Add("Set Size (Random)").OnClick(func(ctx *application.Context) {
currentWindow(func(w *application.WebviewWindow) {
currentWindow(func(w application.Window) {
w.SetSize(rand.Intn(800)+200, rand.Intn(600)+200)
})
})
sizeMenu.Add("Set Min Size (200,200)").OnClick(func(ctx *application.Context) {
currentWindow(func(w *application.WebviewWindow) {
currentWindow(func(w application.Window) {
w.SetMinSize(200, 200)
})
})
sizeMenu.Add("Set Max Size (600,600)").OnClick(func(ctx *application.Context) {
currentWindow(func(w *application.WebviewWindow) {
currentWindow(func(w application.Window) {
w.SetMaximiseButtonState(application.ButtonDisabled)
w.SetMaxSize(600, 600)
})
})
sizeMenu.Add("Get Current WebviewWindow Size").OnClick(func(ctx *application.Context) {
currentWindow(func(w *application.WebviewWindow) {
currentWindow(func(w application.Window) {
width, height := w.Size()
application.InfoDialog().SetTitle("Current WebviewWindow Size").SetMessage("Width: " + strconv.Itoa(width) + " Height: " + strconv.Itoa(height)).Show()
})
})

sizeMenu.Add("Reset Min Size").OnClick(func(ctx *application.Context) {
currentWindow(func(w *application.WebviewWindow) {
currentWindow(func(w application.Window) {
w.SetMinSize(0, 0)
})
})

sizeMenu.Add("Reset Max Size").OnClick(func(ctx *application.Context) {
currentWindow(func(w *application.WebviewWindow) {
currentWindow(func(w application.Window) {
w.SetMaxSize(0, 0)
w.SetMaximiseButtonState(application.ButtonEnabled)
})
})
positionMenu := menu.AddSubmenu("Position")
positionMenu.Add("Set Relative Position (0,0)").OnClick(func(ctx *application.Context) {
currentWindow(func(w *application.WebviewWindow) {
currentWindow(func(w application.Window) {
w.SetRelativePosition(0, 0)
})
})
positionMenu.Add("Set Relative Position (Random)").OnClick(func(ctx *application.Context) {
currentWindow(func(w *application.WebviewWindow) {
currentWindow(func(w application.Window) {
w.SetRelativePosition(rand.Intn(1000), rand.Intn(800))
})
})

positionMenu.Add("Get Relative Position").OnClick(func(ctx *application.Context) {
currentWindow(func(w *application.WebviewWindow) {
currentWindow(func(w application.Window) {
x, y := w.RelativePosition()
application.InfoDialog().SetTitle("Current WebviewWindow Relative Position").SetMessage("X: " + strconv.Itoa(x) + " Y: " + strconv.Itoa(y)).Show()
})
})

positionMenu.Add("Center").OnClick(func(ctx *application.Context) {
currentWindow(func(w *application.WebviewWindow) {
currentWindow(func(w application.Window) {
w.Center()
})
})
stateMenu := menu.AddSubmenu("State")
stateMenu.Add("Minimise (for 2 secs)").OnClick(func(ctx *application.Context) {
currentWindow(func(w *application.WebviewWindow) {
currentWindow(func(w application.Window) {
w.Minimise()
time.Sleep(2 * time.Second)
w.Restore()
})
})
stateMenu.Add("Maximise").OnClick(func(ctx *application.Context) {
currentWindow(func(w *application.WebviewWindow) {
currentWindow(func(w application.Window) {
w.Maximise()
})
})
stateMenu.Add("Fullscreen").OnClick(func(ctx *application.Context) {
currentWindow(func(w *application.WebviewWindow) {
currentWindow(func(w application.Window) {
w.Fullscreen()
})
})
stateMenu.Add("UnFullscreen").OnClick(func(ctx *application.Context) {
currentWindow(func(w *application.WebviewWindow) {
currentWindow(func(w application.Window) {
w.UnFullscreen()
})
})
stateMenu.Add("Restore").OnClick(func(ctx *application.Context) {
currentWindow(func(w *application.WebviewWindow) {
currentWindow(func(w application.Window) {
w.Restore()
})
})
stateMenu.Add("Hide (for 2 seconds)").OnClick(func(ctx *application.Context) {
currentWindow(func(w *application.WebviewWindow) {
currentWindow(func(w application.Window) {
w.Hide()
time.Sleep(2 * time.Second)
w.Show()
})
})
stateMenu.Add("Always on Top").OnClick(func(ctx *application.Context) {
currentWindow(func(w *application.WebviewWindow) {
currentWindow(func(w application.Window) {
w.SetAlwaysOnTop(true)
})
})
stateMenu.Add("Not always on Top").OnClick(func(ctx *application.Context) {
currentWindow(func(w *application.WebviewWindow) {
currentWindow(func(w application.Window) {
w.SetAlwaysOnTop(false)
})
})
stateMenu.Add("Google.com").OnClick(func(ctx *application.Context) {
currentWindow(func(w *application.WebviewWindow) {
currentWindow(func(w application.Window) {
w.SetURL("https://google.com")
})
})
stateMenu.Add("wails.io").OnClick(func(ctx *application.Context) {
currentWindow(func(w *application.WebviewWindow) {
currentWindow(func(w application.Window) {
w.SetURL("https://wails.io")
})
})
Expand All @@ -258,7 +258,7 @@ func main() {
}
})
stateMenu.Add("Get Screen for WebviewWindow").OnClick(func(ctx *application.Context) {
currentWindow(func(w *application.WebviewWindow) {
currentWindow(func(w application.Window) {
screen, err := w.GetScreen()
if err != nil {
application.ErrorDialog().SetTitle("Error").SetMessage(err.Error()).Show()
Expand Down
4 changes: 2 additions & 2 deletions v3/examples/events-bug/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ func main() {
Mac: application.MacOptions{
ApplicationShouldTerminateAfterLastWindowClosed: true,
},
KeyBindings: map[string]func(window *application.WebviewWindow){
"shift+ctrl+c": func(window *application.WebviewWindow) {
KeyBindings: map[string]func(window application.Window){
"shift+ctrl+c": func(window application.Window) {
selection, err := application.OpenFileDialog().
CanChooseFiles(true).
CanCreateDirectories(true).
Expand Down
4 changes: 2 additions & 2 deletions v3/examples/keybindings/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ func main() {
Mac: application.MacOptions{
ApplicationShouldTerminateAfterLastWindowClosed: true,
},
KeyBindings: map[string]func(window *application.WebviewWindow){
"shift+ctrl+c": func(window *application.WebviewWindow) {
KeyBindings: map[string]func(window application.Window){
"shift+ctrl+c": func(window application.Window) {
nixpare marked this conversation as resolved.
Show resolved Hide resolved
window.Center()
},
},
Expand Down
Loading