Skip to content

Commit 87b2fbe

Browse files
authored
Merge pull request #37 from progrium/pruning
Pruning bridge and schema code
2 parents 295658d + 3f471f9 commit 87b2fbe

35 files changed

+2
-4812
lines changed

Makefile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,3 @@ notification: ## build and run notification example
2020
pomodoro: ## build and run pomodoro example
2121
$(GOEXE) run ./examples/pomodoro
2222
.PHONY: pomodoro
23-
24-
bridgehost: ## build and run bridgehost example
25-
$(GOEXE) install ./cmd/macbridge
26-
$(GOEXE) run ./examples/bridgehost
27-
.PHONY: bridgehost

README.md

Lines changed: 1 addition & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Native Mac APIs for Golang!
1111

1212
------
1313

14-
MacDriver is a toolkit for working with Apple/Mac APIs and frameworks in Go. It currently has 3 "layers":
14+
MacDriver is a toolkit for working with Apple/Mac APIs and frameworks in Go. It currently has 2 parts:
1515

1616
## 1. Bindings for Objective-C
1717
The `objc` package wraps the [Objective-C runtime](https://developer.apple.com/documentation/objectivec/objective-c_runtime?language=objc) to dynamically interact with Objective-C objects and classes:
@@ -83,71 +83,6 @@ func main() {
8383

8484
**NEW**: See [progrium/topframe](https://github.com/progrium/topframe) for a more fully-featured standalone version!
8585

86-
## 3. Bridge System
87-
Lastly, a common case for this toolkit is not just building full native apps, but integrating Go applications
88-
with Mac systems, like windows, native menus, status icons (systray), etc.
89-
One-off libraries for some of these exist, but besides often limiting what you can do,
90-
they're also just not composable. They all want to own the main thread!
91-
92-
For this and other reasons, we often run the above kind of code in a separate process altogether from our
93-
Go application. This might seem like a step backwards, but it is safer and more robust in a way.
94-
95-
The `bridge` package takes advantage of this situation to create a higher-level abstraction more aligned with a potential
96-
cross-platform toolkit. You can declaratively describe and modify structs that can be copied to the bridge process and applied to the Objective-C
97-
objects in a manner similar to configuration management:
98-
99-
```go
100-
package main
101-
102-
import (
103-
"os"
104-
105-
"github.com/progrium/macdriver/bridge"
106-
)
107-
108-
func main() {
109-
// start a bridge subprocess
110-
host := bridge.NewHost(os.Stderr)
111-
go host.Run()
112-
113-
// create a window
114-
window := bridge.Window{
115-
Title: "My Title",
116-
Size: bridge.Size{W: 480, H: 240},
117-
Position: bridge.Point{X: 200, Y: 200},
118-
Closable: true,
119-
Minimizable: false,
120-
Resizable: false,
121-
Borderless: false,
122-
AlwaysOnTop: true,
123-
Background: &bridge.Color{R: 1, G: 1, B: 1, A: 0.5},
124-
}
125-
host.Sync(&window)
126-
127-
// change its title
128-
window.Title = "My New Title"
129-
host.Sync(&window)
130-
131-
// destroy the window
132-
host.Release(&window)
133-
}
134-
135-
```
136-
This is the most WIP part of the project, but once developed further we can take this API and build a bridge
137-
system with the same resources for Windows and Linux, making a cross-platform OS "driver". We'll see.
138-
139-
* Current bridge types available:
140-
* Window
141-
* StatusItem (systray)
142-
* Menu
143-
144-
## Development Notes
145-
146-
As far as we know, due to limitations of Go modules, we often need to add `replace` directives to our `go.mod` during development
147-
to work against a local checkout of some dependency (like qtalk). However, these should not be versioned, so for now we encourage
148-
you to use `git update-index --skip-worktree go.mod` on your checkout if you need to add `replace` directives. When updates need to
149-
be checked in, `git update-index --no-skip-worktree go.mod` can be used to reverse this on your local repo to commit changes and then re-enable.
150-
15186
#### Generating wrappers
15287

15388
Eventually we can generate most of the wrapper APIs using bridgesupport and/or doc schemas. However, the number of APIs

bridge/bridge.go

Lines changed: 0 additions & 227 deletions
This file was deleted.

bridge/host.go

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)