adi1090x / plymouth-themes

A huge collection (80+) of plymouth themes ported from android bootanimations
GNU General Public License v3.0
1.71k stars 112 forks source link

Animation not centered on multiple monitors #42

Open gop3k opened 10 months ago

gop3k commented 10 months ago

I'm a Linux Mint 21.2 Cinnamon Edition user, and I've been using your Plymouth theme 'colorful_sliced'. I recently encountered an issue where the theme displays with an offset across both screens on my dual-screen setup.

After extensive research and experimentation, I managed to find a workaround by replacing "Window.GetX()" with "Window.GetX(0)" and "Window.GetY()" with "Window.GetY(0)"in the theme's script (lines 36 and 37), which centers the animation on both screens.

However, I'm keen to understand more about the values for functions like 'Window.GetX()' and 'Window.GetY()' used in Plymouth scripts. The official documentation lacks specific details, and online searches haven't provided clarity.

I'd appreciate your insights and if possible, testing this solution on your system.

Thank you for your contributions to the open-source community.

IPlayZed commented 9 months ago

When using a custom theme from here for multiple monitors it is not applied only to the main one in my case. On shutdown this doesn't happen. Also, hot-plugging causes the animation to crash.

IPlayZed commented 9 months ago

Probably this is linked to #36.

Glich440 commented 3 months ago

In my case changing

flyingman_sprite.SetX(Window.GetX() + (Window.GetWidth(0) / 2 - flyingman_image[0].GetWidth() / 2)); # Place images in the center
flyingman_sprite.SetY(Window.GetY() + (Window.GetHeight(0) / 2 - flyingman_image[0].GetHeight() / 2));

to

flyingman_sprite.SetX(Window.GetX() + (Window.GetWidth(1) / 2 - flyingman_image[0].GetWidth() / 2)); # Place images in the center
flyingman_sprite.SetY(Window.GetY() + (Window.GetHeight(1) / 2 - flyingman_image[0].GetHeight() / 2));

in the script file fixes it

dax-dot-gay commented 2 months ago

Same issue here, also fixed by

In my case changing

flyingman_sprite.SetX(Window.GetX() + (Window.GetWidth(0) / 2 - flyingman_image[0].GetWidth() / 2)); # Place images in the center
flyingman_sprite.SetY(Window.GetY() + (Window.GetHeight(0) / 2 - flyingman_image[0].GetHeight() / 2));

to

flyingman_sprite.SetX(Window.GetX() + (Window.GetWidth(1) / 2 - flyingman_image[0].GetWidth() / 2)); # Place images in the center
flyingman_sprite.SetY(Window.GetY() + (Window.GetHeight(1) / 2 - flyingman_image[0].GetHeight() / 2));

in the script file fixes it

For circle_hud specifically

IPlayZed commented 2 months ago

Will this cause a regression (improper placement) if you use only 1 monitor? I can not test this now. @Glich440 @gop3k

I think it would cause issues if there is only 1 monitor if the array is 0 indexed always for GetWidth() and GetHeight().

Is there any way so this can be dynamically configured in runtime? IMO It would be reasonable to handle 1,2 and 3 horizontal monitor setups imo and falling back to showing only on 1 (and making sure it does not show on others) on more complex setups. As far as I understand there would be no way to get information at this boot stage about how the monitors are placed (like two verticals and one on top at the middle)? @adi1090x

Glich440 commented 2 months ago

I think that probably fixes it, but I can't test it right now due to another bug with the systemd password prompt not being shown, I would have to try the solutions in #10

gop3k commented 1 month ago

Will this cause a regression (improper placement) if you use only 1 monitor? I can not test this now. @Glich440 @gop3k

I think it would cause issues if there is only 1 monitor if the array is 0 indexed always for GetWidth() and GetHeight().

These are my screens resolutions :1920x1080, 1280x1024

When I start my computer with only one screen, replacing "Window.GetX()" with "Window.GetX(0)" and "Window.GetY()" with "Window.GetY(0)" in the lines 36 and 37 of the theme's script work both with dual monitor and with only one monitor for me.

Glich440 commented 1 month ago

I think that it may be related to what screen is detected first, in my case the smaller one is detected as 0. This may be due to the fact that it is connected via HDMI vs the larger one that is connected via Display Port

gop3k commented 1 month ago

Almost the same here : the bigger monitor is on HDMI and the smaller one on Display Port.

IPlayZed commented 1 month ago

Then a PR with your changes would probably fix this for most setups.

Glich440 commented 1 month ago

the problem is that if the index is set to 1 it probably breaks the most common setup, one monitor

gop3k commented 1 month ago

Please see the first post: I didn't set any index to 1 and my fix works for both 1 monitor and 2.