Native Mac APIs for Go

Overview

MacDriver Logo

Native Mac APIs for Golang!

GoDoc Test workflow Go Report Card @progriumHQ on Twitter Project Forum Sponsor Project


MacDriver is a toolkit for working with Apple/Mac APIs and frameworks in Go. It currently has 2 parts:

1. Bindings for Objective-C

The objc package wraps the Objective-C runtime to dynamically interact with Objective-C objects and classes:

cls := objc.NewClass("AppDelegate", "NSObject")
cls.AddMethod("applicationDidFinishLaunching:", func(app objc.Object) {
	fmt.Println("Launched!")
})
objc.RegisterClass(cls)

delegate := objc.Get("AppDelegate").Alloc().Init()
app := objc.Get("NSApplication").Get("sharedApplication")
app.Set("delegate:", delegate)
app.Send("run")
  • Access any class or method you can access in Objective-C
  • Common object convenience methods: Get, Set, Alloc, Init, ...
  • Create and extend classes at runtime that can be used by Objective-C code
  • Retain and Release methods for working with Objective-C memory management

2. Framework Packages

The cocoa, webkit, and core packages wrap objc with wrapper types for parts of the Apple/Mac APIs. They're being added to as needed by hand until we can automate this process with schema data. These packages effectively let you use Apple APIs as if they were native Go libraries, letting you write Mac applications (potentially also iOS, watchOS, etc) as Go applications:

func main() {
	app := cocoa.NSApp_WithDidLaunch(func(notification objc.Object) {
		config := webkit.WKWebViewConfiguration_New()
		wv := webkit.WKWebView_Init(core.Rect(0, 0, 1440, 900), config)
		url := core.URL("http://progrium.com")
		req := core.NSURLRequest_Init(url)
		wv.LoadRequest(req)

		w := cocoa.NSWindow_Init(core.Rect(0, 0, 1440, 900),
			cocoa.NSClosableWindowMask|
				cocoa.NSTitledWindowMask,
			cocoa.NSBackingStoreBuffered, false)
		w.SetContentView(wv)
		w.MakeKeyAndOrderFront(w)
		w.Center()
	})
	app.SetActivationPolicy(cocoa.NSApplicationActivationPolicyRegular)
	app.ActivateIgnoringOtherApps(true)
	app.Run()
}
  • 1:1 mapping of API names with Objective-C APIs
  • Cocoa types: NSApplication, NSImage, NSMenu, NSWindow, more ...
  • Webkit types: WKWebView and configuration classes
  • Core types: NSData, NSDictionary, NSNumber, NSPoint, NSRect, NSSize, NSString, NSURL, more ...
  • Core also allows dispatching Go functions in the Cocoa run loop
  • Many constants/enums are defined

Examples

examples/largetype - A Contacts/Quicksilver-style Large Type utility in under 80 lines: largetype screenshot

examples/pomodoro - A menu bar pomodoro timer in under 80 lines: pomodoro gif

examples/topframe - An always-on-top webview with transparent background in 120 lines [requires Go 1.16+]: topframe screenshot

NEW: See progrium/topframe for a more fully-featured standalone version!

Generating wrappers

Eventually we can generate most of the wrapper APIs using bridgesupport and/or doc schemas. However, the number of APIs is pretty ridiculous so there are lots of edge cases I wouldn't know how to automate yet. We can just continue to create them by hand as needed until we have enough coverage/confidence to know how we'd generate wrappers.

Thanks

The original objc and variadic packages were written by Mikkel Krautz. The variadic package is some assembly magic to make everything possible since libobjc relies heavily on variadic function calls, which aren't possible out of the box in Cgo.

License

MIT

Comments
  • return NSWorkspace runningApplications array

    return NSWorkspace runningApplications array

    Im trying to return an array of NSApplication from NSWorkspace.runningApplications. im having trouble working out how i can turn the returned value from "Get("runningApplications")" into an array of "NSRunningApplication" any help is appreciated.

    Also im loving the work you've done, it's coming in real handy :)

    `type NSWorkspace struct { objc.Object }

    type NSRunningApplication struct { objc.Object }

    var NSWorkspace_ = NSWorkspace{objc.Get("NSWorkspace")}

    func NSWorkspace_New() NSWorkspace { return NSWorkspace{NSWorkspace_.Alloc().Init()} }

    func (ws NSWorkspace) RunningApplications() { i := ws.Get("runningApplications")

    }`

    opened by AStrangwood 15
  • Provide and document @autoreleasepool block equivalent

    Provide and document @autoreleasepool block equivalent

    From this thread: https://news.ycombinator.com/item?id=26028441

    If you call into Cocoa APIs from foreign threads without an @autoreleasepool block active, the APIs will leak memory.

    https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmAutoreleasePools.html

    Cocoa always expects code to be executed within an autorelease pool block, otherwise autoreleased objects do not get released and your application leaks memory

    This StackOverflow answer suggests the @autoreleasepool block is implemented by generating calls to these objc runtime functions:

    void *_objc_autoreleasePoolPush(void);
    _objc_autoreleasePoolPop(void *ctxt); // ctxt is Apple's label for the param
    

    Here's an example of how you might provide the API: https://play.golang.org/p/dljXN3BdEGr

    I also suggest prominently documenting this once it is implemented, as any long running app calling into Cocoa APIs will leak without it.

    help wanted 
    opened by lunixbochs 14
  • [wip] schema generation tool

    [wip] schema generation tool

    This PR introduces a new tool that can parse Apple documentation pages for a class and produce a partial schema in JSON. It's intended to aid in the eventual code generation of wrapper types. Since Apple API schemas don't really exist other than hard-to-find, sometimes outdated, and otherwise crufty bridgesupport files, I dreamed of just scraping the documentation. At the very least, it can provide stubs that include generated doc comments with links to actual Apple API docs as we've been starting to do by hand.

    Schemas are useful for all sorts of things, so separating schema generation from code generation increases the value of what we're providing here. Although it doesn't yet know type and other metadata for class members, all that data can be parsed from their individual pages, which this does pull the links for.

    I've written and tried against NSWindow (and now many others), which is our biggest class. The file schema/NSWindow.json was generated with go run . "https://developer.apple.com/documentation/appkit/nswindow?language=objc" from the tools/schema directory.

    It's using chromedp instead of something lighter and more ergonomic, but Apple's site doesn't seem to render without Javascript. That said, I'm surprised what could be done with just 150 lines, it's just a little awkward.

    enhancement 
    opened by progrium 9
  • add support for NSPasteboard

    add support for NSPasteboard

    This PR adds support for NSPasteboard. Currently it covers the basic read from and write to pasteboard operations.

    I included the objc code that i used to get the constants as comment. If anyone knows how we can access them directly instead let me know. I would gladly replace it.

    Also i did not include the constants NSFileContentsPboardType, NSFindPanelSearchOptionsPboardType Pasteboard types as they had different contents that i was not sure about.

    In terms of testing, i use this as showcased in the example with string only for now and have not yet tested pictures or anything else.

    Also i spend some time to get the original apple doc comments converted and linked in the relevant places. Not sure if we want to do this or not.

    opened by flexzuu 9
  • Support for NSWorkspace

    Support for NSWorkspace

    👋 are there any plans to support NSWorkspace.

    I have a trivial application I'd like to migrate to test this library which opens links from a menu item. Natively, I use:

    NSWorkspace.shared.open(url)
    
    opened by andrew-waters 8
  • menuitem .SetTitle() open/closes systray every time its called

    menuitem .SetTitle() open/closes systray every time its called

    Im in the process of moving over some code that's using https://github.com/getlantern/systray to macdriver. I have hit a weird issue where every call to menuitem .SetTitle() open/closes systray. When using https://github.com/getlantern/systray im able to set the item title as many time as i want without hitting this issue.

    A simple bit of code that reproduces the issue. Run the code and then click on the systray icon, you will see the systray open and close every second.

    go 1.16rc1

    `package main

    import ( "runtime" "strconv" "time"

    "github.com/progrium/macdriver/cocoa"
    "github.com/progrium/macdriver/objc"
    

    )

    func Run() { runtime.LockOSThread()

    app := cocoa.NSApp_WithDidLaunch(func(n objc.Object) {
    	obj := cocoa.NSStatusBar_System().StatusItemWithLength(cocoa.NSVariableStatusItemLength)
    	obj.Retain()
    	obj.Button().SetTitle("counting")
    
    	itemNext := cocoa.NSMenuItem_New()
    
    	go func() {
    		timer := 1
    		for {
    			select {
    			case <-time.After(1 * time.Second):
    				itemNext.SetTitle(strconv.Itoa(timer))
    				timer++
    			}
    		}
    	}()
    	menu := cocoa.NSMenu_New()
    	menu.AddItem(itemNext)
    	obj.SetMenu(menu)
    
    })
    app.Run()
    

    }`

    opened by AStrangwood 7
  • Is example code running outside main goroutine unsafe?

    Is example code running outside main goroutine unsafe?

    My (very rusty) knowledge of Cocoa is that actions in the UI need to happen on the "main thread" / run loop. I assume think is why runtime.LockOSThread() is used in all of the examples. But it looks like the Pomodoro example has a menu item's title being changed from a different goroutine:

    https://github.com/progrium/macdriver/blob/a13d2b6e51df9c8aad758af32377b128ae26078b/examples/pomodoro/main.go#L21 ... https://github.com/progrium/macdriver/blob/a13d2b6e51df9c8aad758af32377b128ae26078b/examples/pomodoro/main.go#L54

    It appears to be working ok. My memory (again, faulty) is that these sorts of things can appear to work ok for a while, but fail in mysterious ways as the program becomes more complex. Is there some kind of wizardry going on that makes this code ok? Or should it be happening inside the Cocoa app's run loop?

    opened by aidansteele 7
  • Implement objc method swizzling

    Implement objc method swizzling

    Hi,

    This is a great project - I love your work. I've got a PR to add method swizzling for Objective-C methods. I've also included an example to show one of the reasons this is useful. I want to be able to show the user notifications from a Golang binary. NSNotificationCenter refuses to do this if [[NSBundle mainBundle] bundleIdentifier], which is the case for non-.app apps.

    I don't expect this to be merged as-is, it's more a concrete example to get your thoughts. Specifically, TODO_RegisterClassInMap is likely something you wouldn't want. I suppose there are a few options:

    1. (At startup?) Enumerate the list of all classes registered with the runtime using objc_copyClassList and add them all to the classMap.

    2. Register pre-existing classes (and their methods) lazily in MethodForSelector.

    3. Something else entirely.

    What are your thoughts?

    opened by aidansteele 7
  • autoreleasepool

    autoreleasepool

    Implements AutoreleasePool(func()) to run the body with an active autoreleasepool.

    There's a test to show that this calls dealloc on the object that has been added to the autoreleasepool with .Autorelease().

    I'm posting this for discussion, but I want to explore #49 more before settling on a solution here. Integrating with the Go GC to release objects automatically would be much easier for Go developers, but then do we still want them to have to manually manage the autoreleasepools around blocks of code?

    Alternatively, I think we could wrap each Send with an autoreleasepool so that after each external call to ObjC, we would free any additional memory allocated before returning to Go. This seems like it should produce "correct" behavior, but there may be cases where this is a bit heavy-weight and developers would want direct control over when to free the memory.

    Fixes #12

    opened by mgood 6
  • OpenGL app crashes

    OpenGL app crashes

    I have a GTK app. I want to use macdriver to implement a native UI. The project is https://gitlab.com/eukano/runway. I'm executing go run ./cmd/runway view. It works for a few minutes or a few seconds, but it always crashes.

    It occasionally fails in GC (in Go): gc1.log, gc2.log (GC error dumps are pretty long). Most of the time my app fails during an Objective-C call:

    $ go run ./cmd/runway view
    fatal error: unexpected signal during runtime execution
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x143545348 pc=0x7fff201aee89]
    
    runtime stack:
    runtime.throw(0x4c901c3, 0x2a)
            /GOROOTS/1.16.2/go/src/runtime/panic.go:1117 +0x72
    runtime.sigpanic()
            /GOROOTS/1.16.2/go/src/runtime/signal_unix.go:718 +0x2ef
    
    goroutine 1 [syscall, locked to thread]:
    runtime.cgocall(0x4a50e10, 0xc0002fece8, 0x8)
            /GOROOTS/1.16.2/go/src/runtime/cgocall.go:154 +0x5b fp=0xc0002fecb8 sp=0xc0002fec80 pc=0x4006f7b
    github.com/progrium/macdriver/objc._Cfunc_GoObjc_TypeInfoForMethod(0x143545348, 0x7fff7c628991, 0x0)
            _cgo_gotypes.go:263 +0x49 fp=0xc0002fece8 sp=0xc0002fecb8 pc=0x4a1bfe9
    github.com/progrium/macdriver/objc.typeInfoForMethod.func1(0x5107518, 0xc00063e378, 0x7fff7c628991, 0xc00063e378)
            /PROJ/macdriver/objc/selector.go:85 +0x96 fp=0xc0002fed20 sp=0xc0002fece8 pc=0x4a25e56
    github.com/progrium/macdriver/objc.typeInfoForMethod(0x5106da8, 0xc00063e370, 0x4c3da0c, 0xd, 0xc0002feda8, 0x4a1bd25)
            /PROJ/macdriver/objc/selector.go:85 +0x7d fp=0xc0002fed58 sp=0xc0002fed20 pc=0x4a24cdd
    github.com/progrium/macdriver/objc.simpleTypeInfoForMethod(0x5106da8, 0xc00063e370, 0x4c3da0c, 0xd, 0xbff0000000000000, 0x0)
            /PROJ/macdriver/objc/selector.go:113 +0x59 fp=0xc0002fede0 sp=0xc0002fed58 pc=0x4a24d79
    github.com/progrium/macdriver/objc.sendMsg(0x5106da8, 0xc00063e370, 0x4c3b11f, 0xc, 0x4c3da0c, 0xd, 0x0, 0x0, 0x0, 0x0, ...)
            /PROJ/macdriver/objc/msg_amd64.go:85 +0xe9 fp=0xc0002fefb8 sp=0xc0002fede0 pc=0x4a214a9
    github.com/progrium/macdriver/objc.object.Send(...)
            /PROJ/macdriver/objc/msg_amd64.go:234
    github.com/progrium/macdriver/objc.(*object).Send(0xc00063e338, 0x4c3da0c, 0xd, 0x0, 0x0, 0x0, 0x5106da8, 0x561ff00)
            <autogenerated>:1 +0xa8 fp=0xc0002ff020 sp=0xc0002fefb8 pc=0x4a28088
    main.(*GLView).drawRect(0xc000caa018, 0x100000000000000)
            /PROJ/runway/cmd/runway/view_cocoa.go:172 +0x139 fp=0xc0002ff080 sp=0xc0002ff020 pc=0x4a47079
    runtime.call16(0xc000ca6120, 0x4f8c5f0, 0xc000122930, 0x1000000010)
            /GOROOTS/1.16.2/go/src/runtime/asm_amd64.s:550 +0x3e fp=0xc0002ff0a0 sp=0xc0002ff080 pc=0x4078a1e
    reflect.Value.call(0x4adf7a0, 0x4f8c5f0, 0x13, 0x4c2a426, 0x4, 0xc000ca6510, 0x2, 0x2, 0x2, 0x18, ...)
            /GOROOTS/1.16.2/go/src/reflect/value.go:476 +0x8e7 fp=0xc0002ff2a8 sp=0xc0002ff0a0 pc=0x40b9c67
    reflect.Value.Call(0x4adf7a0, 0x4f8c5f0, 0x13, 0xc000ca6510, 0x2, 0x2, 0x1, 0x2, 0x0)
            /GOROOTS/1.16.2/go/src/reflect/value.go:337 +0xb9 fp=0xc0002ff328 sp=0xc0002ff2a8 pc=0x40b9139
    github.com/progrium/macdriver/objc.goMethodCallEntryPoint(0x7ffeefbfc040, 0x40074fb)
            /PROJ/macdriver/objc/call_amd64.go:273 +0x27f0 fp=0xc0002ff7a8 sp=0xc0002ff328 pc=0x4a1edd0
    _cgoexp_6ee9b331048c_goMethodCallEntryPoint(0x7ffeefbfc010)
            _cgo_gotypes.go:297 +0x2e fp=0xc0002ff7c8 sp=0xc0002ff7a8 pc=0x4a2604e
    runtime.cgocallbackg1(0x4a26020, 0x7ffeefbfc010, 0x0)
            /GOROOTS/1.16.2/go/src/runtime/cgocall.go:292 +0x18c fp=0xc0002ff868 sp=0xc0002ff7c8 pc=0x400732c
    runtime.cgocallbackg(0x4a26020, 0x7ffeefbfc010, 0x0)
            /GOROOTS/1.16.2/go/src/runtime/cgocall.go:228 +0xda fp=0xc0002ff8d8 sp=0xc0002ff868 pc=0x40070fa
    runtime.cgocallback(0x4006f9f, 0x4a5f0b0, 0xc0002ff970)
            /GOROOTS/1.16.2/go/src/runtime/asm_amd64.s:788 +0xa9 fp=0xc0002ff900 sp=0xc0002ff8d8 pc=0x407a1e9
    runtime.asmcgocall(0x4a5f0b0, 0xc0002ff970)
            /GOROOTS/1.16.2/go/src/runtime/asm_amd64.s:652 +0x42 fp=0xc0002ff908 sp=0xc0002ff900 pc=0x407a0c2
    runtime.cgocall(0x4a5f0b0, 0xc0002ff970, 0xc0002ff980)
            /GOROOTS/1.16.2/go/src/runtime/cgocall.go:164 +0x7f fp=0xc0002ff940 sp=0xc0002ff908 pc=0x4006f9f
    github.com/progrium/macdriver/misc/variadic._Cfunc_VariadicCall(0xc000150090, 0x0)
            _cgo_gotypes.go:73 +0x45 fp=0xc0002ff970 sp=0xc0002ff940 pc=0x4a1a565
    github.com/progrium/macdriver/misc/variadic.(*FunctionCall).Call.func1(0xc000150090, 0xc0002ffa0c)
            /PROJ/macdriver/misc/variadic/variadic_amd64.go:68 +0x4d fp=0xc0002ff9a0 sp=0xc0002ff970 pc=0x4a1a9ad
    github.com/progrium/macdriver/misc/variadic.(*FunctionCall).Call(0xc000150090, 0x76)
            /PROJ/macdriver/misc/variadic/variadic_amd64.go:68 +0x2b fp=0xc0002ff9c0 sp=0xc0002ff9a0 pc=0x4a1a86b
    github.com/progrium/macdriver/objc.sendMsg(0x5106da8, 0xc00063e120, 0x4c3b11f, 0xc, 0x4c2a10e, 0x3, 0x0, 0x0, 0x0, 0x0, ...)
            /PROJ/macdriver/objc/msg_amd64.go:230 +0x705 fp=0xc0002ffb98 sp=0xc0002ff9c0 pc=0x4a21ac5
    github.com/progrium/macdriver/objc.object.Send(...)
            /PROJ/macdriver/objc/msg_amd64.go:234
    github.com/progrium/macdriver/objc.(*object).Send(0xc000389200, 0x4c2a10e, 0x3, 0x0, 0x0, 0x0, 0x5106da8, 0x561ff08)
            <autogenerated>:1 +0xa8 fp=0xc0002ffc00 sp=0xc0002ffb98 pc=0x4a28088
    github.com/progrium/macdriver/cocoa.NSApplication.Run(...)
            /PROJ/macdriver/cocoa/NSApplication.go:51
    main.viewRun(0x56a5340, 0x570c4e0, 0x0, 0x0)
            /PROJ/runway/cmd/runway/view_cocoa.go:128 +0x376 fp=0xc0002ffcc0 sp=0xc0002ffc00 pc=0x4a46936
    github.com/spf13/cobra.(*Command).execute(0x56a5340, 0x570c4e0, 0x0, 0x0, 0x56a5340, 0x570c4e0)
            /GOROOTS/1.16.2/packages/pkg/mod/github.com/spf13/[email protected]/command.go:856 +0x2c2 fp=0xc0002ffd80 sp=0xc0002ffcc0 pc=0x42094e2
    github.com/spf13/cobra.(*Command).ExecuteC(0x56a4940, 0x4c2d747, 0x6, 0x4c64d38)
            /GOROOTS/1.16.2/packages/pkg/mod/github.com/spf13/[email protected]/command.go:960 +0x375 fp=0xc0002ffe60 sp=0xc0002ffd80 pc=0x420a215
    main.main()
            /PROJ/runway/cmd/runway/main.go:37 +0x21c fp=0xc0002fff88 sp=0xc0002ffe60 pc=0x4a4563c
    runtime.main()
            /GOROOTS/1.16.2/go/src/runtime/proc.go:225 +0x256 fp=0xc0002fffe0 sp=0xc0002fff88 pc=0x4041536
    runtime.goexit()
            /GOROOTS/1.16.2/go/src/runtime/asm_amd64.s:1371 +0x1 fp=0xc0002fffe8 sp=0xc0002fffe0 pc=0x407a461
    exit status 2
    
    opened by firelizzard18 5
  • How to monitor shortcut behavior

    How to monitor shortcut behavior

    environment

    • macos verison: 11.2.3
    • github.com/progrium/macdriver v0.0.3-0.20210330171321-295658df6845

    describe

    I want to develop a shortcut function. But I couldn't capture the user's keyboard press event.

    	events := make(chan cocoa.NSEvent)
    	go func() {
    		for e := range events {
    			fmt.Println(e)
    		}
    	}()
    
    	cocoa.NSEvent_GlobalMonitorMatchingMask(cocoa.NSEventMaskAny, events)
    

    image

    Only mouse/ctrl/option/command press events can be captured.

    expect

    Is there any other good way? or any example? thx.

    opened by LinkinStars 5
  • Add basic arm64 support

    Add basic arm64 support

    This pull request implements basic arm64 support.

    Tested with topframe and pomodoro examples, as well as all existing tests in objc and variadic.

    I am not sure how much the new gan-infrastructure still relies on objc and misc/variadic? If there is something else that would make better sense to test, let me know.

    Notes: This is pretty basic support. It doesn't yet support overflowing parameters to the stack - so it relies on there being enough registers to pass all expected parameters. This is true both for the variadic and the "call" module of the objc package, which is used to implement ObjC objects in Go. I've not yet run into issues, but I thought this was a good starting point. Since this is something that pops up at development-time, that should raise a flag for when/if further development to support overflowing to the stack is needed.

    It also doesn't support struct returns (stret) yet.

    opened by mkrautz 0
  • Missing NSApplicationMain() implementation

    Missing NSApplicationMain() implementation

    In an Objective-C application the NSApplicationMain() function is called to start the application. It basically does all this:

    void NSApplicationMain(int argc, char *argv[]) { [NSApplication sharedApplication]; [NSBundle loadNibNamed:@"myMain" owner:NSApp]; [NSApp run]; } *from https://developer.apple.com/documentation/appkit/nsapplication?language=objc

    Please add this function to the Go bindings. This would enable the use of xib files.

    Thank you.

    opened by iMacker2020 1
  • The API I want is not in cocoa, is it possible to add this example

    The API I want is not in cocoa, is it possible to add this example

    For example, I want to call GCController.controllers

    I don't know the mechanism of macdriver (is it called using reflection?) I also don't know about objective-c, so I would like to get a more detailed example

    opened by wushu037 0
  • Addig CoreBluetooth

    Addig CoreBluetooth

    It would be nice to have the CoreBluetooth module in the repository. I wanted to add it, but I faced with several issues. If you can help me with these I can handle the rest and creating the PR. (Assume I'm not a Mac programmer)

    1. The core bluetooth delegate implementations are Protocols, I don't know what does it mean, but the macschema can't handle it. (I cloned the repo and I built my own version, so I'm running on latest.) How can I add implementation to the macschema to handle this?
    2. If you check this, I added the generated api descriptors and it's generating the corebluetooth just fine. (Obviously I left out the delegate ones, because those were empty descriptors). But I needed to leave out the Enum descriptors as well, because I got a nil dereference error, from this section. (I just skipped this if it's Enum just for curiosity, and I got an other one from somewhere else). So it seems it's only handling Classes.

    Let me know your thoughts, if you can help me, I can invest sometime to add these features.

    opened by PumpkinSeed 5
  • error: returning 'id' from a function with incompatible result type 'double'

    error: returning 'id' from a function with incompatible result type 'double'

    I tried to run all the examples in the example folder, but saw these errors every time:

    cocoa/cocoa_objc.gen.go:3043:9: error: returning 'id' from a function with incompatible result type 'double'
            return [(NSScreen*)id
                   ^~~~~~~~~~~~~~
    cocoa/cocoa_objc.gen.go:3053:9: error: returning 'id' from a function with incompatible result type 'double'
            return [(NSScreen*)id
    
    

    How to reproduce: cd to root level of the macdriver folder. Build the OpenGL example like this: go build ./examples/opengl/main.go

    My info: Mac OS 10.14 Go 1.18

    Notes: I used the June 11th version of MacDriver. I downloaded a zip file from GitHub.com.

    opened by iMacker2020 6
  • Request: add nib file example

    Request: add nib file example

    Hi, I am wishing for a nib file example using Go. I think most people out there will be making their interface using Xcode rather than thru code, so this example could help a lot of people out.

    opened by programmingkidx 0
Releases(v0.2.0)
  • v0.2.0(Oct 21, 2021)

    API Additions

    This release introduces generated bindings to greatly expand the methods defined on the current types, as well as adding a number of new types. See: https://github.com/progrium/macdriver/pull/56

    • core.NSAttributedString added (@mvrilo)
    • objc.Autorelease added to wrap functions with an autoreleasepool (@mgood)
    • core.NSNib got NSNib_InitWithNibNamed_Bundle, NSNib_InitWithNibData_Bundle, InstantiateWithOwner_TopLevelObjects (@firelizzard18)
    • cocoa.NSControl added (@fserb)
    • cocoa.NSPopover added (@fserb)

    API Removals

    • core.NSAutoreleasePool replaced by objc.Autorelease
    • remove code for 386 architecture (@firelizzard18)

    Docs & Examples

    • comments on discovering enum values moved to wiki (@flexzuu)
    • fix a few typos and rewording (@bradfitz)
    • fix top frame example (@revilon1991)
    • OpenGL example (@firelizzard18)

    Optimizations

    • optimize sendMsg and selector lookups (@firelizzard18)
    • fix memory leaks with C.CString (@mgood)

    New Contributors

    • @mvrilo made their first contribution in https://github.com/progrium/macdriver/pull/43
    • @bradfitz made their first contribution in https://github.com/progrium/macdriver/pull/45
    • @firelizzard18 made their first contribution in https://github.com/progrium/macdriver/pull/60
    • @revilon1991 made their first contribution in https://github.com/progrium/macdriver/pull/65
    • @mgood made their first contribution in https://github.com/progrium/macdriver/pull/56
    • @fserb made their first contribution in https://github.com/progrium/macdriver/pull/74

    Full Changelog: https://github.com/progrium/macdriver/compare/v0.1.0...v0.2.0

    Source code(tar.gz)
    Source code(zip)
  • v0.1.0(Apr 6, 2021)

    API Additions

    • core.NSData got Length, Bytes (@flexzuu)
    • core.NSArray got NSArray_WithObjects, Count, ObjectAtIndex, Strings (@flexzuu)
    • cocoa.NSPasteboard added with SetStringForType, StringForType, DataForType, Types, AvailableTypeFromArray (@flexzuu)
    • cocoa.NSWindow got SetHasShadow, HasShadow, OrderOut, OrderFront, OrderBack
    • cocoa.NSTextView got SetTextColor (@tmc)
    • cocoa.NSScreen got NSScreen_Screens (@tmc)

    API Removals

    • Removed exported class reference variables (NSApplication_, NSMenu_, NSWindow_, etc)

    Package Removals

    • Removed misc/bundle package
    • Removed bridge package and bridgehost example (moved to new repo)
    Source code(tar.gz)
    Source code(zip)
  • v0.0.3(Apr 1, 2021)

    This is a release candidate of sorts for v0.1.0, which will include a full changelog of changes since first release. Most notably, "bridge" and "schema" work have been split out into separate projects.

    Source code(tar.gz)
    Source code(zip)
Owner
Jeff Lindsay
Jeff Lindsay
An example desktop system tray application that can launch HTML5 windows. Go source with a build process for Windows, Mac and Linux.

ExampleTrayGUI An example cross-platform (Mac, Windows, Linux) system tray application that can launch HTML5 windows, developed in Go including functi

Grant Moore 49 Aug 29, 2022
An example desktop system tray application that can launch HTML5 windows. Go source with a build process for Windows, Mac and Linux.

An example cross-platform (Mac, Windows, Linux) system tray application that can launch HTML5 windows, developed in Go including functional build process. This repository is intended as a quick reference to help others start similar projects using the referenced libraries and will not be actively maintained.

Grant Moore 49 Aug 29, 2022
An example desktop system tray application that can launch HTML5 windows. Go source with a build process for Windows, Mac and Linux.

ExampleTrayGUI An example cross-platform (Mac, Windows, Linux) system tray application that can launch HTML5 windows, developed in Go including functi

Owen Moore 49 Aug 29, 2022
Native Go (golang) Graphical Interface system (2D and 3D), built on GoKi tree framework

GoGi is part of the GoKi Go language (golang) full strength tree structure system (ki = 木 = tree in Japanese) package gi is a scenegraph-based 2D and

GoKi 1.1k Sep 30, 2022
Platform-native GUI library for Go.

ui: platform-native GUI library for Go This is a library that aims to provide simple GUI software development in Go. It is based on my libui, a simple

Pietro Gagliardi 8.2k Sep 21, 2022
RobotGo, Go Native cross-platform GUI automation @vcaesar

Robotgo Golang Desktop Automation. Control the mouse, keyboard, bitmap, read the screen, Window Handle and global event listener. RobotGo supports Mac

vgo 7.9k Sep 28, 2022
Breaking Cloud Native Web APIs in their natural habitat.

cnfuzz - Cloud Native Web API Fuzzer "Breaking Cloud Native Web APIs in their natural habitat." Fuzzing web APIs in their fully converged Cloud Native

Sue B.V. - Cloud Native 33 Aug 15, 2022
An open-source, distributed, cloud-native CD (Continuous Delivery) product designed for developersAn open-source, distributed, cloud-native CD (Continuous Delivery) product designed for developers

Developer-oriented Continuous Delivery Product ⁣ English | 简体中文 Table of Contents Zadig Table of Contents What is Zadig Quick start How to use? How to

null 0 Oct 19, 2021
An example desktop system tray application that can launch HTML5 windows. Go source with a build process for Windows, Mac and Linux.

ExampleTrayGUI An example cross-platform (Mac, Windows, Linux) system tray application that can launch HTML5 windows, developed in Go including functi

Grant Moore 49 Aug 29, 2022
An example desktop system tray application that can launch HTML5 windows. Go source with a build process for Windows, Mac and Linux.

ExampleTrayGUI An example cross-platform (Mac, Windows, Linux) system tray application that can launch HTML5 windows, developed in Go including functi

Grant Moore 49 Aug 29, 2022
An example desktop system tray application that can launch HTML5 windows. Go source with a build process for Windows, Mac and Linux.

An example cross-platform (Mac, Windows, Linux) system tray application that can launch HTML5 windows, developed in Go including functional build process. This repository is intended as a quick reference to help others start similar projects using the referenced libraries and will not be actively maintained.

Grant Moore 49 Aug 29, 2022
CLI to support with downloading and compiling terraform providers for Mac with M1 chip

m1-terraform-provider-helper A CLI to help with managing the installation and compilation of terraform providers when running a new M1 Mac. Motivation

kreuzwerker GmbH 216 Sep 27, 2022
Hermit - uniform tooling for Linux and Mac

Hermit installs tools for software projects in self-contained, isolated sets, so your team, your contributors, and your CI have the same consistent tooling.

Cash App 359 Sep 16, 2022
Raspberry Pi Archlinux Automated Offline Installer with Wi-Fi. Windows, Mac and more features coming.

Raspberry Pi Archlinux Automated Installer with Wi-Fi. Windows, Mac and more features coming. Download Go to releases page and download the zip file f

Mansour Behabadi 10 May 29, 2022
A rule based proxy For Mac base on Clash.

ClashX A rule based proxy For Mac base on Clash. ClashX 旨在提供一个简单轻量化的代理客户端,如果需要更多的定制化,可以考虑使用 CFW Mac 版 Features HTTP/HTTPS and SOCKS protocol Surge lik

Yicheng 19.9k Oct 2, 2022
A tool helps connect to your AriPods when sound playing in your Mac

Auto connect to airpods this tool helps connect to your AriPods when sound playing in your Mac. dependencenes SwitchAudioSource $ brew install switcha

Fndroid 2 Dec 9, 2021
Termial remote (mac) for Sony Bravia TV

Sony Bravia terminal remote Environment variables HOST: [....] PSK: [....] Configure the Bravia TV Todo: Scan network for a Bravia device Move and git

Emil 1 Nov 26, 2021
Quick and dirty test to compare MySQL perf between ARM64 & Rosetta MySQL on M1Pro mac

Quick and dirty test to compare MySQL perf between ARM64 & Rosetta MySQL on M1Pro mac

Chris Atkins 0 Nov 5, 2021
An example desktop system tray application that can launch HTML5 windows. Go source with a build process for Windows, Mac and Linux.

ExampleTrayGUI An example cross-platform (Mac, Windows, Linux) system tray application that can launch HTML5 windows, developed in Go including functi

Owen Moore 49 Aug 29, 2022
Connect directly to Docker-for-Mac containers via IP address 🐳 💻

Docker Mac Net Connect Connect directly to Docker-for-Mac containers via IP address. Features L3 connectivity: Connect to Docker containers from macOS

Chipmunk 111 Sep 30, 2022