rharish101 / ReGreet

Clean and customizable greeter for greetd
GNU General Public License v3.0
390 stars 16 forks source link

Apply GTK settings before the UI is visible #45

Open bbb651 opened 11 months ago

bbb651 commented 11 months ago

Currently, there's a brief pause from when the UI is visible but frozen, to when the gtk settings loads and the application unfreezes. This is especially noticeable when using application_prefer_dark_theme (which IMO should default to true, it's not a good user experience to go from a dark console to a completely white screen, but I digress), because it flashes the screen with white then goes to dark, which is very jarring.

I'm not familiar with Relm4 but I can try to make a PR (although without #30 it sounds very painful).

rharish101 commented 9 months ago

A PR would be much appreciated!

I don't know how to fix this for the multi-monitor case, because I've noticed that the GTK settings are "reset" when I select the monitor to be fullscreened on, and I have to re-apply them. It's possible that the pause that you're experiencing is due to this GTK behaviour.

gvolpe commented 5 months ago

Giving ReGreet a try, and experiencing the same issue, also using a dark theme.

What happens exactly in my case is that first there's a pause going from the console view to the ReGreet UI, but that's acceptable to me. The worst part is that ReGreet UI is displayed first in light mode (background image already visible at this stage) and then there's a flickering with a 500 ms pause or so and it switches to dark mode, as set by the theme.

Is this worth reporting as a separate issue? Not clear if it's the same one.

Here's my config ```toml [background] path = "/path/to/hyprland.png" # How the background image covers the screen if the aspect ratio doesn't match # Available values: "Fill", "Contain", "Cover", "ScaleDown" fit = "Contain" # The entries defined in this section will be passed to the session as environment variables when it is started [env] ENV_VARIABLE = "value" [GTK] # Whether to use the dark theme application_prefer_dark_theme = true # Cursor theme name cursor_theme_name = "Juno-ocean" # Font name and size font_name = "JetBrainsMono 12" # Icon theme name icon_theme_name = "BeautyLine" # GTK theme name theme_name = "Juno-ocean" [commands] # The command used to reboot the system reboot = [ "systemctl", "reboot" ] # The command used to shut down the system poweroff = [ "systemctl", "poweroff" ] ```
max-ishere commented 1 month ago

Applications can override system-wide settings by setting the property of the GtkSettings object with g_object_set(). This should be restricted to special cases though; GtkSettings are not meant as an application configuration facility.

I have a feeling that the current approach is flawed to begin with. I am currently doing some development and noticed that regreet uses my user's gtk settings with like 0 config. And no flicker and it works fine. So... Maybe like... replace the config setting with a manual on how to configure a theme? Same in #72, just maybe link a tutorial to how to make gtk themes and not hack together weird solutions when clearly a system-level application theme is the way to go?

max-ishere commented 1 month ago

GTK settings are "reset" when I select the monitor to be fullscreened on

Could potentially be solved by a system level config too.

max-ishere commented 1 month ago

Forgot to link the source: https://docs.gtk.org/gtk4/class.Settings.html

max-ishere commented 1 week ago

Welp. At least on NixOS I can't actually implement a system-wide dark theme preference... That is sad. If anyone can figure this one out, I'd appreciate it. And that tutorial should go into the readme then.

max-ishere commented 1 week ago

Not to say it is impossible, I just give up for now.

max-ishere commented 5 days ago

/tableflip I had to reboot...

What I am saying is that it is possible to use some kind of configuration facility that is system/user wide (I am not sure exactly what config optiions, I tried all the methods I found on the internet at once, will report back) but that system config doesnt have the flicker. And it just works.