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

Apply GTK settings before the UI is visible #45

Open
bbb651 opened this issue Oct 21, 2023 · 8 comments
Open

Apply GTK settings before the UI is visible #45

bbb651 opened this issue Oct 21, 2023 · 8 comments
Labels
help wanted Extra attention is needed

Comments

@bbb651
Copy link

bbb651 commented Oct 21, 2023

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
Copy link
Owner

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.

@rharish101 rharish101 added the help wanted Extra attention is needed label Dec 31, 2023
@gvolpe
Copy link

gvolpe commented May 2, 2024

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
[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
Copy link
Contributor

max-ishere commented Sep 1, 2024

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
Copy link
Contributor

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
Copy link
Contributor

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

@max-ishere
Copy link
Contributor

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
Copy link
Contributor

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

@max-ishere
Copy link
Contributor

/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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants