Comments (11)
just bumped into your project through mss, cool stuff :>
noticed this issue and gave it a try since i had a mac nearby.
encountered somewhat similar behavior on 0.1.10:
- the red border is painted on startup, however the menu bar is on a layer above the border and renders over it
- capturing contents inside the menu bar is impossible; normcap reports that nothing was captured
- the dummy window appears when initiating the selection (click/drag)
can confirm that 0.1.11 mostly fixes both of these in my case;
- the red border is still covered by the menu bar until the left mouse button is clicked, this immediately makes the border top-level
- ...so capturing contents inside the menu bar is now possible by starting a selection right below it
- the dummy window no longer appears at all
this was using the system-provided python 3.8 and tkinter on catalina 10.15.7
from normcap.
@dynobo I'm not a super expert in developing for MacOS, but I think I may have here something interesting for you. Here's an example of how to use Python and the PyObjC library to draw a window which in the fullscreen mode will render over the menu bar:
import objc
from Foundation import NSObject
from AppKit import NSApp, NSApplication, NSWindow, NSScreen, NSNormalWindowLevel, NSFloatingWindowLevel, NSTitledWindowMask, NSResizableWindowMask, NSClosableWindowMask, NSBorderlessWindowMask, NSBackingStoreBuffered, NSWindowCollectionBehaviorFullScreenPrimary
from PyObjCTools import AppHelper
class MyWindow(NSObject):
def __new__(cls, *args, **kwargs):
return cls.alloc().init()
def __init__(self):
frame = ((0.0, 0.0), (640.0, 480.0))
mask = NSTitledWindowMask | NSResizableWindowMask | NSClosableWindowMask | NSBorderlessWindowMask
screen = NSScreen.mainScreen()
#level = NSFloatingWindowLevel
# It's just an integer, you can set it for something ridiculously high, so for example in the full screen mode the window will render over the menu bar and the dock
level = 999999
self._window = NSWindow.alloc().initWithContentRect_styleMask_backing_defer_screen_(frame, mask, NSBackingStoreBuffered, False, screen)
self._window.setTitle_("Hello World")
self._window.setLevel_(level)
self._window.setDelegate_(self)
self._window.setCollectionBehavior_(NSWindowCollectionBehaviorFullScreenPrimary)
self._window.makeKeyAndOrderFront_(self)
self._window.retain()
def main():
app = NSApplication.sharedApplication()
win = MyWindow()
NSApp.activateIgnoringOtherApps_(True)
AppHelper.runEventLoop()
if __name__ == "__main__":
main()
I hope this might be useful for this issue. I think that you could try to use the same Objective-C APIs with tcl/tk.
from normcap.
In the new beta release 0.2.0-b1 I got completely rid of the "dummy window". In general it should provide a much nicer experience on MacOS (still not perfect, e.g. it still is behind the application menu and dock).
Please help by testing and providing feedback.
from normcap.
Thanks for the report, @tcptps !
I actually didn't test on MacOS for quite a while (I don't have a Mac myself), but I try to take a look at it next weekend.
from normcap.
Hi @tcptps,
today I installed Sierra in a VM and tried to reproduce the issue, but without success. To me, it seems like everything's working as expected.
Can you please provide additional information?
- Do you have a multi-monitor setup or only one display?
- You wrote "useful Application Window never appeared.". Are you sure? The "application window" is barely visible, because it shows only a screenshot from your current desktop. The red border it draws (see screenshot) is basically the only thing visible:
If you see the red border, try selecting a portion of the screen with text using the mouse to trigger the recognition process. - I'm not so familiar with MacOS, but I know there are some options how application windows show up. I think you can configure Mac to always maximize windows or something. Do you have something like that configure?
Thanks!
from normcap.
Hi,
- one Display
- No red border for me.
- Thats a weird one I have to say, because the Menu bar is hidden which is normally a sign that an application is in full Screen mode but on the other hand there is the little window. Using python 3.9 I think I used the Installer from the python website.
Since my Setup is weird sometimes and it works in your VM I would suggest to wait if somebody else experiences the same Problem and assume my Setup is just broken somehow. If there is any test I can run let me know. I tried using the development Environment: https://github.com/dynobo/normcap#setup-environment but no luck either:
from normcap.
You observations are quite interesting!
What technically should happen is, that normcap
opens two windows:
- A "dummy" window, which seems to be necessary to receive keyboard shortcuts. This is the small window you see that prompts you to report the bug.
- Window 1) should never be visible, because a child window should open fullscreen in front of it showing the screenshot with red border. (In multi-monitor setup, one child window per screen is spawned)
Setting window 2) to fullscreen was quite difficult, because the behavior is different across the operation systems and because I also wanted multi-monitor setup. Especially on MacOS it was a struggle. The best I could come up with so far is a certain combination of options. If you are familiar with Python, this would be the section of code to experiment with.
Now the interesting part for me:
While I read, that the options I use for Mac should result in a fullscreen and topmost window, in my tests it never really was topmost: menubar and dock always were in front of it (in my screenshot above, you the red border end below menubar). I thought this might be the MacOS way, not allowing a real top-most window. In your screenshot on the other hand, it seems like menubar and dock are somehow hidden, which is quite interesting.
It looks a bit like in your case fullscreen mode is somehow enabled, but window 2) just not visible. Maybe it is not at the correct position/size...
In any case, I'd be happy about help or hints anyone.
from normcap.
I tried a change which might fix this problem. Could anyone affected by this issue please try v0.1.11 and report back?
pip install normcap==0.1.11
from normcap.
@9001 Thanks for your valuable feedback! This seems like updating to v0.1.11
is a good workaround for people on MacOS affected by this issue,
I leave this ticket open, because it still doesn't behave as it should (menu bar should be covered, too.)
I'm currently experimenting with a different GUI-Framework (Kivy) that hopefully fixes this issue and makes other things more easier for me, too. I'll drop a notice here, as soon as it's ready for testing.
from normcap.
@y4rr Thanks a lot for your efforts and this information. I'm currently working hard on a switch from Tk to Qt (see the respective branch), which hopefully makes it more easy to maintain NormCap for multiple platforms.
Interestingly, showing the fullscreen already works quite well with Qt on MacOS, but there are some other Mac-specific issues I have to sort out, e.g. I can't change the cursor to crosshair yet and the window doesn't get focused to receive keypress events... But maybe objc can be of use here, too! :-)
from normcap.
The issue with "dummy window" is solved with #116 and has been published in the new v0.2.0b3.
For the problem that the window stay below the menubar, I created Issue #119
from normcap.
Related Issues (20)
- Error: Couldn't Locate Tesseract Binary HOT 4
- Scale-based bug - the screenshot is zoomed into the top left corner when using scaling != 100% HOT 13
- Fails to recognize short codes HOT 4
- [MacOS] Normcap for ARM64 - Normcap hangs system after capture HOT 4
- Improve recognition of "random" character combinations
- Add NormCap to Scoop HOT 1
- [Linux, Wayland] Normcap not copying to clipboard when launched through shortcut HOT 9
- UnicodeDecodeError: 'utf-8' codec can't decode byte
- Allow custom save folders HOT 3
- Indicators HOT 3
- Make notification clickable HOT 11
- Add option to start NormCap in background
- Add introduction on first NormCap start HOT 11
- Add an option to choose trained language model types (fast,normal,best) HOT 2
- Does not start HOT 3
- Random numbers being added to text output HOT 2
- [Windows] Error after update to v0.4.2 - QtCore: The specified module could not be found HOT 8
- Error in v0.4.2 HOT 6
- NormCap-0.4.3-x86_64.AppImage crashs - could not load the qt platform plugin HOT 5
- Exit option in system tray does not work in NormCap-0.4.3-x86_64.AppImage HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from normcap.