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

Sync wallpaper to greeter #72

Merged
merged 23 commits into from
Jul 20, 2023
Merged

Sync wallpaper to greeter #72

merged 23 commits into from
Jul 20, 2023

Conversation

lenemter
Copy link
Member

@lenemter lenemter commented Jun 30, 2023

@lenemter lenemter marked this pull request as draft July 2, 2023 15:58
@lenemter lenemter marked this pull request as ready for review July 3, 2023 10:06
@lenemter lenemter requested a review from a team July 3, 2023 10:06
src/Backends/InterfaceSettings.vala Outdated Show resolved Hide resolved
src/Backends/InterfaceSettings.vala Outdated Show resolved Hide resolved
Comment on lines 100 to 110
if (folder.query_exists ()) {
var enumerator = folder.enumerate_children ("standard::*", FileQueryInfoFlags.NOFOLLOW_SYMLINKS);
FileInfo? info = null;
while ((info = enumerator.next_file ()) != null) {
enumerator.get_child (info).@delete ();
}
} else {
folder.make_directory_with_parents ();
}

source.copy (dest, FileCopyFlags.OVERWRITE | FileCopyFlags.ALL_METADATA);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does we need all this? wouldn't $XDG_GREETER_DATA_DIR/wallpaper.$ext and $XDG_GREETER_DATA_DIR/wallpaper-dark.$ext be enough? this way we can skip this enumerator loop and just do:

    if (!folder.query_exists ()) { // folder here point to $XDG_GREETER_DATA_DIR
        folder.make_directory_with_parents ();
    }

    source.copy (folder.get_child (wallpaper_name), OVERWRITE | ALL_METADATA); // wallpaper_name would be "wallpaper.png" for a png file, or "wallpaper.xml" for a dynamic one, etc...

Copy link
Member Author

@lenemter lenemter Jul 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a straightforward way of getting a file extension. Can we just drop it and use $XDG_GREETER_DATA_DIR/wallpaper?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this need a test with a animated/dynamic wallpaper, if they end working correct in the greeter, i think it would be better.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tested it, Greeter doesn't support dynamic wallpapers, instead it falls back to /usr/share/backgrounds/elementaryos-default file.

Copy link
Member Author

@lenemter lenemter Jul 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh just got that you're talking about file without extensions sorry.

What if we check it's mimetype? Is it dependent on file extension?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Gdk.Pixbuf will already check it for us, the problematic case was dynamic ones, since theses are XML files, and sometimes they don't have the XML header that is used to define the mimetype when the file has no extension.

but since we don't support them in the greeter, we don't need to worry about that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested again, now with wallpaper file, greeter falls back in this case too.

wait, you tested a static or dynamic one? if it a static one, and fails, the fallback one would fail too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested both.

if it a static one, and fails, the fallback one would fail too.

Why?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because it doesn't have a extension too, so if Gdk.Pixbuf fails to check the mimetype for the wallpaper named one it would fail in the elementaryos-default too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested here, and \var\lib\lightdm-data\$user\wallpaper woked fine with my current wallpaper (a .jpg file).

src/Backends/InterfaceSettings.vala Outdated Show resolved Hide resolved
@lenemter lenemter requested a review from Marukesu July 13, 2023 05:25
src/Backends/InterfaceSettings.vala Outdated Show resolved Hide resolved
src/Backends/InterfaceSettings.vala Outdated Show resolved Hide resolved
@danirabbit danirabbit mentioned this pull request Jul 13, 2023
@lenemter lenemter requested a review from Marukesu July 16, 2023 06:28
Copy link
Contributor

@Marukesu Marukesu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last thing.

src/Backends/InterfaceSettings.vala Outdated Show resolved Hide resolved
@lenemter lenemter requested a review from Marukesu July 19, 2023 16:00
Copy link
Contributor

@Marukesu Marukesu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lenemter lenemter merged commit 1f75e53 into master Jul 20, 2023
@lenemter lenemter deleted the lenemter/background-settings branch July 20, 2023 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sync Wallpapers to Greeter
3 participants