NegativeScreen icon indicating copy to clipboard operation
NegativeScreen copied to clipboard

Negative per window

Open rajsinghUSA opened this issue 7 years ago • 23 comments

Is it possible for NegativeScreen to work on a per-window basis? I have many apps and webpages that use dark/night mode on their own, but certain apps on Windows don't have an option for dark/night theming.

Would it be possible to implement NegativeScreen on particular windows within Windows? For example, a particular shortcut key that will only enable NegativeScreen on the currently focused/active window.

Also, thank you for this awesome app, it's seriously indispensable for me and one of the first items installed on any new computer of mine.

rajsinghUSA avatar Mar 28 '17 15:03 rajsinghUSA

It is technically possible to only invert a rectangle and not the entire screen, but generalizing that to invert a specific window, while properly handling the currently in focus window, potentially overlapping windows, etc, would be a lot of work. Also, windows are not necessarily rectangular, so this would be an (admittedly rare) problem. I'm also not quite sure the performance would be great.

mlaily avatar Mar 30 '17 18:03 mlaily

So closing this means wontfix?

myfairsyer avatar May 30 '17 07:05 myfairsyer

I guess, or at least most likely wontfix, as I don't see a practical way to implement this feature properly, and I don't plan to spend time to research it.

Since I see how having this feature could be useful, maybe I shouldn't have closed the issue though. I will reopen it. Having it still open will hopefully prevent future similar questions...

mlaily avatar May 30 '17 10:05 mlaily

@rajsinghUSA this isn't what you're looking for, but you might agree that the next best thing for now is to invert monitors independently and this older version does just that:

https://0.x2a.yt/other/private/NegativeScreen-custom-multi-monitor.exe

It's a tad bit slower, but I'm also like you and need to toggle inversion on a per window basis. Simply put all your windows that don't need inversion on one monitor screen (assuming you have more than 1) and when you right click on the tray icon you can toggle inversion off for that monitor.

Runs for me great on Windows 7 with 8 GB ram and an i5 processor

evbo avatar Jan 06 '19 14:01 evbo

I tried this tool, but once I open it, it dumped.

lightile avatar Jan 09 '19 11:01 lightile

Hello, is still not doable on Windows 10 ? Thanks

KaKi87 avatar Aug 11 '20 19:08 KaKi87

There is no relation between this feature request and Windows 10 (or other versions of Windows).

mlaily avatar Aug 12 '20 05:08 mlaily

Well, the website screenshots are Windows 7 screenshots so I thought maybe you didn't checked if the API would've been improved between 7 and 10.

KaKi87 avatar Aug 12 '20 08:08 KaKi87

I think there's a way to implement this feature:

  • Detect the focused window position and name. Apply filter to the focused window area according to rules set for that window name.
  • Apply a seperate filter to the rest of the screen. This filter could be a low contrast/low brightness filter which can be set independently (maybe it makes sense to change this on a per-window-basis). This makes sure that the rest of the screen won't dazzle the user.

Sogolumbo avatar Sep 05 '20 01:09 Sogolumbo

Ok but again, what happens when your target window is not focused? When windows overlap?

Actually, what is the purpose of the requested feature?

I don't think it can work very well in a multi-tasking workflow, but maybe that's not actually necessary. It could work with only a few side by side windows, if they are not overlapping, but the magic would break as soon as windows overlap.

Would it fit the bill to ignore windows, and instead have the ability to define rectangular areas on the screen, each with a specific filter?

mlaily avatar Sep 05 '20 06:09 mlaily

what is the purpose of the requested feature?

Making light apps dark without making already dark apps light.

KaKi87 avatar Sep 05 '20 11:09 KaKi87

The goal for me is multi-tasking. (E.g. splitscreen).

If we want to calculate complicated setups that's entirely possible: We can discribe Windows as rectangles and find out if they overlap. If they do we subdivide the area of the back window into (1,2, or more) smaller rectangles that are not overlapped. I think that would be a pretty fast calculation. And we don't have to support an infinite amount of windows. We could specify a maximum in the config file, which provides fast speed and still covers the main use cases.

It is possible to find out the order of the windows, right?

Btw: this feature is very important to me. There's a sickness called ME/CFS which, beneath many horrible symptoms, can cause increased sensitivity to light. Someone close to me has this illness and has problems with some programs that don't allow him to change their color and asked me for help. I have some experience with C# developing and I'm willing to invest time on this. I haven't looked at the code yet, I'll start on monday.

Sogolumbo avatar Sep 05 '20 12:09 Sogolumbo

How is this guy able to invert color on a per-window basis with AutoIt? https://github.com/gileli121/WindowTop

rajsinghUSA avatar Sep 08 '20 06:09 rajsinghUSA

Well, thank you for sharing this tool with us, I'm going to try right away.

KaKi87 avatar Sep 08 '20 07:09 KaKi87

How is this guy able to invert color on a per-window basis with AutoIt? https://github.com/gileli121/WindowTop

Mmh, not sure, but it might be using https://docs.microsoft.com/en-us/windows/win32/api/magnification/nf-magnification-magsetwindowfilterlist ... (I think all the interesting source code removed is mostly still present in the first commit of the linked repo)

Honestly, I'm more impressed by this: https://youtu.be/SkOq3-jjGf4 (Not the auto-toggle, but the part where images stay normal)

mlaily avatar Sep 08 '20 08:09 mlaily

Wow, that software is awesome. Thanks @rajsinghUSA for sharing.

@mlaily Are you going to port this software's features into FLOSS ? :)

PS : regarding web browsing, you'd better use Brave which natively supports dark window colors, and the Dark Reader extension, which smartly force-dark websites.

KaKi87 avatar Sep 08 '20 08:09 KaKi87

@mlaily Are you going to port this software's features into FLOSS ? :)

I'm not interested in most features, but the ones related to dark mode might be a good fit if I can find a way to implement them reliably...

PS : regarding web browsing, you'd better use Brave which natively supports dark window colors, and the Dark Reader extension, which smartly force-dark websites.

I don't want to use Brave, but I have some dark mode extensions for Firefox and Chrome. They work well, but only in the browser.

mlaily avatar Sep 08 '20 08:09 mlaily

the ones related to dark mode might be a good fit if I can find a way to implement them reliably

That's the only ones I also care about actually. But the other software is reliable, really. Multi-DPI is the only issue to be fixed.

KaKi87 avatar Sep 08 '20 20:09 KaKi87

I think he's also using the magnification api of windows. When moving the windows in his app you can see that the dark windows lag behind a little bit. Also when you select dark mode in a maximized window he will invert the whole screen (including the task bar).

Sogolumbo avatar Sep 11 '20 01:09 Sogolumbo

I just went through the history and saw 53ae0fa. It seems like at that point you were just a function call to MagSetWindowFilterList away from having window specific color inversion.

Edit: Well, I tried to call MagSetWindowFilterList, turns out that won't give us any desireable results: The windows which are excluded from the filter will just be rendered invisible (instead of being shown normally). Here's the branch.

Sogolumbo avatar Sep 11 '20 04:09 Sogolumbo

@mlaily Now I think I understand your conerns about non-rectangular and overlapping windows. I do think that it would make sense to do something similar like in 53ae0fa where there's a magnifierControl for every screen. Just instead of one window per screen we can cover exactly the area that we want by using multiple dynamically sized magnifier windows:

We can discribe Windows as rectangles and find out if they overlap. If they do we subdivide the area of the back window into (1,2, or more) smaller rectangles that are not overlapped.

Do you think that would work?

Btw I just wanted to tell you I have a lot of respect for all the work you have put into this project.

Sogolumbo avatar Sep 12 '20 04:09 Sogolumbo

Do you think that would work?

It would work in theory, but I don't think having too many magnifier surfaces is a good idea, and I don't want to go this route. You are free to try!

mlaily avatar Sep 12 '20 06:09 mlaily

I found this post from this thread using autohotkey in case anyone is still watching this. It looks like it uses MagSetColorEffect.

kmantel avatar Jun 11 '22 05:06 kmantel