Giter VIP home page Giter VIP logo

Comments (3)

lukaskollmer avatar lukaskollmer commented on July 26, 2024

Not sure what you mean, tbh. It seems to me like that's something that would fall into the scope of AppKit, rather than this library.

from objc.

Lijian1122 avatar Lijian1122 commented on July 26, 2024

I want to get current NSView or NSWindow.
Is it possible?

Have you reslove this problem? Do you know the method , thanks

from objc.

shirakaba avatar shirakaba commented on July 26, 2024

This is essentially how you'd do it:

// Import AppKit to get access to its symbols (like NSApplication)
const objc = require('objc');
objc.import('AppKit');

// Once the application has started, and a window is available, you
// can get a reference to it like this:
const mainWindow = objc.NSApplication.sharedApplication().mainWindow();

For an example of starting up an application from scratch, see #43 (where I actually initialise the NSWindow myself, so getting a reference to it is easy).

If you want to control an already-running app using this (which it seems many Electron users do), I have no idea whether that's even possible (if nothing else due to macOS sandboxing apps from each other). It would be easiest to start up and manage the entire app using this framework rather than attach to an existing one.

from objc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.