adi1090x / plymouth-themes

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

Animation not centered on multiple monitors #42

Open gop3k opened 1 year ago

gop3k commented 1 year 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 12 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 12 months ago

Probably this is linked to #36.

TheRedCyclops commented 6 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 5 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 5 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

TheRedCyclops commented 5 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 4 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().

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.

TheRedCyclops commented 4 months 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 4 months ago

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

IPlayZed commented 4 months ago

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

TheRedCyclops commented 4 months ago

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

gop3k commented 4 months ago

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

bphenriques commented 2 months ago

I face the same issue. Laptop screen connectef to a external screen. The animation bounces between places on both screens. Works fine when the external screen is disconnected

IPlayZed commented 2 months ago

I face the same issue. Laptop screen connectef to a external screen. The animation bounces between places on both screens. Works fine when the external screen is disconnected

@bphenriques Did applying the patch showed here solve this issue for you?

bphenriques commented 2 months ago

I face the same issue. Laptop screen connectef to a external screen. The animation bounces between places on both screens. Works fine when the external screen is disconnected

@bphenriques Did applying the patch showed here solve this issue for you?

I am on NixOS and I have to learn how to apply a patch. Will try this week and provide more details on my setup for reference

bphenriques commented 2 months ago

I face the same issue. Laptop screen connectef to a external screen. The animation bounces between places on both screens. Works fine when the external screen is disconnected

@bphenriques Did applying the patch showed here solve this issue for you?

I did test and it is hard to test reliably as it depends on how fast the external display turns on and attempts to show the boot logo.

I believe fixed at first but then it did not (switched between the configurations).

This is the overlay I used:

 (final: prev: {
    adi1090x-plymouth-themes = prev.adi1090x-plymouth-themes.overrideAttrs (previousAttrs: {
      installPhase = previousAttrs.installPhase + ''
        find $out/share/plymouth/themes/ -name \*.script -exec sed -i 's/Window.GetX()/Window.GetX(0)/g' {} \;
        find $out/share/plymouth/themes/ -name \*.script -exec sed -i 's/Window.GetY()/Window.GetY(0)/g' {} \;
      '';
    });
  })
arthurzenika commented 2 days ago

I'm getting hit by this problem too. In my case I also seem to have a resolution change at some point in the boot which is visually not great (single and dual screen problem).