Create mac application without window - macos

Hi want to create an application like xscope or pixelruler, but all application that i have created have a stardard windows.
how can i draw directly in a screen whitout windows?

You can't draw without a window, but you can have a window with a transparent background.
This tutorial should help you out. You'll want a custom NSWindow subclass, and to make it transparent you pass in NSBorderlessWindowMask for the styleMask. Then you can do your drawing in your window's content view.

Related

How to create whole screen overlay in MacOS with Swift?

There's an app called Intermission that creates a whole screen overlay:
I tried creating a floating panel which utilizes NSPanel (adapted from https://cindori.com/developer/floating-panel), but it is unable to expand beyond the toolbar/app bar.
I know I can create a new window in full screen mode and achieve a similar result, however I want to draw this overlay directly on top of the screen without entering full screen mode. How can I achieve this result in the way the Intermission app does it?
I figured it out! The trick is to set NSWindow.Level to .popUpMenu. This allows it to appear above the menubar and dock.

How to create a global overlay for MacOS?

I am trying to develop a MacOS application using Xcode and Cocoa. My intent is to create an overlay on the user's screen that is mostly transparent, and does not register input. For example, an application like f.lux tints the colour of your entire screen like a global overlay, but you can still click on-screen items, as mouse clicks go right through (assuming that it's an overlay). How can I get started with achieving a similar overlay/widget?

How create transparent window in mac?

I am new to MAC development. I want to create a window with transparent. If i put the image or any control, the control only should display and window should not display and that window move horizontally or vertically within screen.
See Apple's sample project RoundTransparentWindow.

How to pass click on NSView through to app window beneath it?

My app has a NSView in a NSWindow which covers the screen and draws a semi-transparent shade on it, above that I've got another NSWindow which contains my app's UI, so the full screen view is designed to fade out background distraction of other windows.
How can I allow mouse clicks on the full screen view to go straight through to the underlying window, which will belong to another app, or even the desktop? Note that I don't want it to keep focus on my app.
Shady by Matt Gemmell does exactly the same, take a look at the source:
http://instinctivecode.com/shady/
It does this by sending the following message to the window:
[window setIgnoresMouseEvents:YES];

Using Webkit to create Skinable custom windows on OSX

There are tutorials for using a webkit view inside a cocoa application to achieve skinnable contents, but what would I do if I wanted to use webkit to create custom, skinnable windows?
Examples would be dashboard widgets, or
BowTie
Beware, I'm a noob.
I've never tried it, but I think you'd just set a WebView as the content view of a transparent borderless window, and tell the WebView not to draw a background. That way, the content of the WebView would define the window boundary.
You create a borderless window by passing NSBorderlessWindowMask to the -initWithContentRect:styleMask:backing:defer: method of NSWindow, and you can set its background to transparent by calling [window setBackgroundColor:[NSColor clearColor]].
You'd have to handle dragging of the window etc yourself. It will probably get a bit messy.
To be honest, it's not something I'd attempt as a first Cocoa project.

Resources