adi1090x / plymouth-themes

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

[Resource] Python Script to install all themes #30

Closed at-pyrix closed 1 year ago

at-pyrix commented 2 years ago

NOTE: This is not an issue but a resource to install all the themes in the github repository. This is just for the people who want to install all the themes, feel free to close this "issue" if you want :)

However it would be nice to include a shell equivalent of this script or include this script in the repository :)

Requirements:

pip3
python3

Install dependencies

pip3 install colorama

Copy the script over to the base dir of the repo, (where the readme and license is) and run with

python3 install_themes.py
import os
from subprocess import run  
from colorama import Fore as fc, init
init(autoreset=True)

folders = ['pack_1', 'pack_2', 'pack_3', 'pack_4']

print('\n')

# To get sudo access
print(fc.CYAN + '? ' + fc.LIGHTWHITE_EX + 'Enter your password to get sudo access: ')
run('sudo ls .', capture_output=True, shell=True)

print('\n')

for pack in folders:

    for theme in os.listdir(f'./{pack}'):
        print(fc.BLUE + '-> ' + fc.RESET + f'Installing theme {theme}')
        theme_location = os.path.realpath(f'{pack}/{theme}')
        output = run(f'sudo cp -r {theme_location} /usr/share/plymouth/themes/', capture_output=True, shell=True)
        if output.returncode != 0:
            print(fc.RED + 'Failed installing theme\n')
            print(output.stderr.decode('utf-8'))
            exit(1)
        else:
            print(fc.GREEN + f'Successfully installed {theme}\n')
        pass

# Set the theme with sudo plymouth-set-default-theme -r <theme_name>
Paulie420 commented 2 years ago

Thanks for posting this - what I want to do is cycle randomly thru all the themes that I choose, I suppose I could do that w/ a script that runs at boot that runs some 'sudo plymouth-set-default-theme -R $RANDOM'... have any better idea of how to do this? Again, thanks for the above - it was helpful.

ALSO, to the creator - I was gonna post a 'issue' simply saying THANK YOU so much... yer themes don't have many 'likes' on the AUR - and they are obviously the best resource for Plymouth themes around. GREAT job!!! I love Cubes!

nero-dv commented 2 years ago

Perhaps it may be more useful to add the script to your shutdown/restart routines instead of at boot. As for setting a random theme, you could create a dictionary of themes by setting a numerical key and calling the key with $RANDOM % 10 | bc (10 being the total count of the themes you want the script to choose from, aka the key in the dictionary)

adi1090x commented 1 year ago

Don't do it, not a good idea to regenerate init on every reboot or shutdown.