Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grand rework #105

Merged
merged 42 commits into from
Oct 28, 2019
Merged

Grand rework #105

merged 42 commits into from
Oct 28, 2019

Conversation

Tyrrrz
Copy link
Owner

@Tyrrrz Tyrrrz commented Oct 5, 2019

LightBulb is a rather popular blue light filter but it hasn't been significantly updated in a long time.

Current version of LightBulb was designed with simplicity in mind but this design hinders adding new features that the users want. The idea is to rework LightBulb, both the back- and frontend, to make it more scalable in regards to future improvements. This is a step away from the very simplistic UI that LightBulb used to have, however the aesthetic hopefully will remain the same.

This PR will address these issues:
Closes #28
Closes #55
Closes #59
Closes #66
Closes #73
Closes #95
Closes #98
Closes #90

Due to a large amount of changes, it's likely (although not guaranteed, will need to be tested) that it will address these issues:
Maybe affects #102
Maybe affects #42
Maybe affects #32
Maybe affects #29
Maybe affects #99

@Tyrrrz
Copy link
Owner Author

Tyrrrz commented Oct 5, 2019

@mirh
Copy link

mirh commented Oct 5, 2019

I'm getting this error https://github.com/dotnet/core-setup/issues/6189

@Tyrrrz
Copy link
Owner Author

Tyrrrz commented Oct 5, 2019

This requires you to install .NET Core 3 runtime from here https://dotnet.microsoft.com/download/thank-you/dotnet-runtime-3.0.0-windows-x64-desktop-runtime-installer

Does it work if you do it?

@mirh
Copy link

mirh commented Oct 5, 2019

Installing .net core is another problem I had, and that it wouldn't hurt to be better handled in the program and in the documentation.

But I'm getting that error after having installed it.

@Tyrrrz
Copy link
Owner Author

Tyrrrz commented Oct 5, 2019

This is still not meant for public consumption yet. I'll take a look at the issue you mentioned.

@Tyrrrz
Copy link
Owner Author

Tyrrrz commented Oct 8, 2019

@mirh the issue you mentioned should be fixed, you can try again, although it's still not production ready

@mirh
Copy link

mirh commented Oct 8, 2019

It woooorks \o/
But it's telling me that I don't have an unlocked gamma range.

I had already set HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM\\GdiICMGammaRange long time ago, but somehow you are only checking for HKCU (which.. are you even sure is an actually working path?)

@Tyrrrz
Copy link
Owner Author

Tyrrrz commented Oct 8, 2019

I'll take a look

@Tyrrrz
Copy link
Owner Author

Tyrrrz commented Oct 9, 2019

You are right, fixed

@mirh
Copy link

mirh commented Oct 9, 2019

Hot damn, it's just so comfy and fine.
The UI is top notch (even though, the K of the temperature being inside the input box might annoy people with OCD)

But you need administrator privileges to write to HKLM

@Tyrrrz
Copy link
Owner Author

Tyrrrz commented Oct 10, 2019

Yeah I've also noticed the issue with the registry, will have to probably perform this out of process, no problem.

Glad you liked the UI!

@mirh
Copy link

mirh commented Oct 11, 2019

I don't know how much .net core has kept, but it should be possible to ask in-process for admin permissions...

Otherwise a .reg file or a batch like this launched in the normal shell should automatically do it for the user

REG ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\ICM" /v GdiICMGammaRange /t REG_DWORD /d 256

Anyway

Application: LightBulb.exe
CoreCLR Version: 4.700.19.46205
.NET Core Version: 3.0.0
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Net.Http.HttpRequestException: The requested name is valid, but no data of the requested type was found.
 ---> System.Net.Sockets.SocketException (11004): The requested name is valid, but no data of the requested type was found.
   at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.DecompressionHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
   at Onova.Services.GithubPackageResolver.GetPackageVersionUrlMapAsync()
   at Onova.Services.GithubPackageResolver.GetPackageVersionsAsync()
   at Onova.UpdateManager.CheckForUpdatesAsync()
   at LightBulb.Services.UpdateService.CheckPrepareUpdateAsync() in C:\projects\lightbulb\LightBulb\Services\UpdateService.cs:line 23
   at LightBulb.ViewModels.RootViewModel.<.ctor>b__35_5() in C:\projects\lightbulb\LightBulb\ViewModels\RootViewModel.cs:line 124
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__139_1(Object state)
   at System.Threading.QueueUserWorkItemCallback.<>c.<.cctor>b__6_0(QueueUserWorkItemCallback quwi)
   at System.Threading.ExecutionContext.RunForThreadPoolUnsafe[TState](ExecutionContext executionContext, Action`1 callback, TState& state)
   at System.Threading.QueueUserWorkItemCallback.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()

@Tyrrrz
Copy link
Owner Author

Tyrrrz commented Oct 19, 2019

@mirh yeah I'll get to it later, currently working on some other things. Just click "close" on that dialog for now, when you are testing.

@mirh
Copy link

mirh commented Oct 20, 2019

Ehrm, that's not a dialog. It's the crash report.

@Tyrrrz
Copy link
Owner Author

Tyrrrz commented Oct 20, 2019

#16 and #39 were descoped (will do them outside of this PR).

@Tyrrrz
Copy link
Owner Author

Tyrrrz commented Oct 20, 2019

@mirh I was talking about extended gamma range dialog

@Tyrrrz Tyrrrz force-pushed the grand-rework branch 4 times, most recently from aea186d to 6dfb670 Compare October 27, 2019 17:40
@Tyrrrz Tyrrrz marked this pull request as ready for review October 28, 2019 18:41
@Tyrrrz Tyrrrz merged commit 7b6475b into master Oct 28, 2019
@Tyrrrz Tyrrrz deleted the grand-rework branch October 28, 2019 18:43
@mirh
Copy link

mirh commented Oct 28, 2019

MFW I wake the computer and nothing crashed.
Also good jesus, the brightness and sundial UI. Crazy, stunning, awesome.

@Tyrrrz
Copy link
Owner Author

Tyrrrz commented Oct 28, 2019

Hey, thanks a lot!

I've merged this but I will keep doing more updates to master in the upcoming days, now that this is pretty stable. If you have time, please check CI builds, I really appreciate your continuous quality assurance. :)

Also, if you need to reach me, my Discord is Tyrrrz#5447

@aure2006
Copy link

aure2006 commented Oct 30, 2019

CI build 202 / 6e28ef7 won't start for me. Tried the portable and installed version. Windows 7 x64.
I tried some other versions (including 135) and they also won't start.

@Tyrrrz
Copy link
Owner Author

Tyrrrz commented Oct 30, 2019

@NomDeMorte
Copy link

TL;DR at the bottom :)

I wish I'd noticed the CI link in the readme before, I've been checking this page religiously for a month, looking forward to a new release. Grabbed the latest build as of today, hooray! (Pro tip: Don't do this at 0330 MY EYES ARE BURNING lol)

I downloaded the runtime linked above, and the app failed to start.

Logs show the following:

Description: A .NET Core application failed.
Application: LightBulb.exe
Path: C:\Program Files\LightBulb\LightBulb.exe
Message: A fatal error occurred. The required library hostfxr.dll could not be found.
If this is a self-contained application, that library should exist in [C:\Program Files\LightBulb].
If this is a framework-dependent application, install the runtime in the global location [C:\Program Files\dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x64\InstallLocation].

Indeed, the hostfxr.dll file is not installed in either the lightbulb or dotnet directories.

According to this issue: https://github.com/dotnet/cli/issues/3907 this issue is worked around by having installed VS, so I would guess that's why it is not effecting you.

Following the pre-requisites mentioned in that issue, I found myself on the following page: https://dotnet.microsoft.com/download/dotnet-core/3.0/runtime

This lists two requisite downloads, the second of which is the one linked above. The first download, installed the missing DLL, and Lightbulb started.

TL;DR

Not sure that we need this: https://dotnet.microsoft.com/download/thank-you/dotnet-runtime-3.0.0-windows-x64-desktop-runtime-installer

We DEFINITELY need this: https://dotnet.microsoft.com/download/thank-you/dotnet-runtime-3.0.0-windows-x64-installer

It works now. Oooh, pretty!

@Tyrrrz
Copy link
Owner Author

Tyrrrz commented Nov 2, 2019

@NomDeMorte thank you for letting me know. I was under the impression that desktop runtime includes the base runtime, but I guess not. I will make sure to include these instructions when v2 is released. :)

@NomDeMorte
Copy link

@NomDeMorte thank you for letting me know. I was under the impression that desktop runtime includes the base runtime, but I guess not. I will make sure to include these instructions when v2 is released. :)

You're very welcome and thanks for the great work. Already enjoying my 66% brightness at night, and my altered day/night times :)

I do wonder, based on the event log, if perhaps you might just be able to package the DLL with the application:

Message: A fatal error occurred. The required library hostfxr.dll could not be found.
If this is a self-contained application, that library should exist in [C:\Program Files\LightBulb].

If you would like, I could try to un-install the dotnet stuff I just installed, and copy that DLL to the lightbulb directory to see if it works? (I assume it is not so easy for you to test, given that you have the full dev environment in place there).... But perhaps I am mistaken. Let me know if I can help in any way.

@Tyrrrz
Copy link
Owner Author

Tyrrrz commented Nov 2, 2019

I think it's just the first dependency it failed to find and there's more. There's a way to make the app self-contained so you don't have to install the runtime but I'm not a fan of that because it makes the size much higher, i.e. ~200mb.

If we make sure the users know what they need to download, I think it should be fine.

@NomDeMorte
Copy link

Sounds fine.

Slightly offtopic but I wanted to note, that the rework is using less resources on both GPU and CPU. Not sure if that was intentional, but there it is. Really enjoying this!

A couple of items of minor consequence (perhaps these should be in a separate issue?)

When the app is running, the window position of the settings dialog is remembered, but if I close Lightbulb and re-open it, the settings dialog goes back to the centre of the screen. Would be nice if it remembered where I left it. Not really a big deal, since I practically never change it.

Speaking of re-positioning the settings dialog, the tooltip which pops up below the buttons, can overlay the buttons, if the dialog is at the bottom of the screen:
image

HTH!

@Tyrrrz
Copy link
Owner Author

Tyrrrz commented Nov 3, 2019

Slightly offtopic but I wanted to note, that the rework is using less resources on both GPU and CPU. Not sure if that was intentional, but there it is. Really enjoying this!

It's probably a mixture of my optimizations and .NET Core. Good news eitherway.

When the app is running, the window position of the settings dialog is remembered, but if I close Lightbulb and re-open it, the settings dialog goes back to the centre of the screen. Would be nice if it remembered where I left it. Not really a big deal, since I practically never change it.

It didn't use to do it before either :) It's probably better to create a separate issue for that

@Tyrrrz
Copy link
Owner Author

Tyrrrz commented Nov 4, 2019

.NET Core runtime should hopefully be installed by the latest installer now.

@mirh
Copy link

mirh commented Nov 4, 2019

It would be even nicer if the executable alone could warn you gracefully it is missing, rather than just crashing badly

@Tyrrrz
Copy link
Owner Author

Tyrrrz commented Nov 4, 2019

Unfortunately that's not possible

@aure2006
Copy link

aure2006 commented Dec 13, 2019

2.0 still isn't working for me (won't start and doesn't show any errors). No other lightbulb instance was running when attempting to run lightbulb 2.0.

What I tried:
Reinstalling Windows 7 x64
LightBulb.zip
LightBulb-Installer.exe
Latest graphics drivers
.NET Core 3.1.0 desktop runtime (both x86 and x64)
.NET Core 3.0.1 desktop runtime (both x86 and x64)
.NET Core 3.0.1 runtime (both x86 and x64)
Restarting computer after installing all the .NET Core stuff

It's probably a missing windows update.

Edit: It was a missing update (KB2533623).
Running "dotnet" in the command prompt gave an error about failing to load hostfxr.dll and then a link to fix it.
This is the link: https://go.microsoft.com/fwlink/?linkid=798306
Full link: https://docs.microsoft.com/en-us/dotnet/core/install/dependencies
The KB2533623 link on that page leads to a broken download so I had to manually search for the download links.
Windows 7 x64 - https://www.microsoft.com/en-ie/download/details.aspx?id=26764
Windows 7 x86 - https://www.microsoft.com/en-us/download/details.aspx?id=26767
After installing the correct update and restarting my computer, lightbulb 2.0 worked.

@Tyrrrz
Copy link
Owner Author

Tyrrrz commented Dec 13, 2019

@aure2006 can you check the Windows event log? Press Start and type "event viewer" and then go to Windows logs->Application. See if there might be something related.

You would be looking for something like this:

image

Although it might be something else

@aure2006
Copy link

Found the fix and added it to my previous comment.

@Tyrrrz
Copy link
Owner Author

Tyrrrz commented Dec 13, 2019

Great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment