-
Notifications
You must be signed in to change notification settings - Fork 42
plymouthcfg: Use simpledrm by default to show splash screen #204
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
base: cachyos
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,11 +12,11 @@ | |
| # Calamares is Free Software: see the License-Identifier above. | ||
| # | ||
|
|
||
| import subprocess | ||
|
|
||
| import os | ||
| import fileinput | ||
| import libcalamares | ||
|
|
||
| from libcalamares.utils import debug, target_env_call | ||
| from libcalamares.utils import debug, warning, target_env_call | ||
|
|
||
| import gettext | ||
| _ = gettext.translation("calamares-python", | ||
|
|
@@ -39,25 +39,6 @@ def detect_plymouth(): | |
| return target_env_call(["sh", "-c", "which plymouth"]) == 0 | ||
|
|
||
|
|
||
| def detect_amdgpu(): | ||
| """ | ||
| Checks if an AMD GPU is present using chwd. | ||
|
|
||
| @return True if an AMD GPU is detected, False otherwise | ||
| """ | ||
| try: | ||
| result = subprocess.run( | ||
| ["chwd", "--check", "amd"], | ||
| capture_output=True, text=True | ||
| ) | ||
| if result.returncode == 0: | ||
| debug("Detected AMD GPU via chwd") | ||
| return True | ||
| except OSError: | ||
| debug("Could not run chwd for AMD GPU detection") | ||
| return False | ||
|
|
||
|
|
||
| class PlymouthController: | ||
|
|
||
| def __init__(self): | ||
|
|
@@ -68,20 +49,31 @@ def root(self): | |
| return self.__root | ||
|
|
||
| def setTheme(self): | ||
| config = libcalamares.job.configuration | ||
| plymouth_theme = config["plymouth_theme"] | ||
| plymouth_theme = libcalamares.job.configuration["plymouth_theme"] | ||
| target_env_call(["plymouth-set-default-theme", plymouth_theme]) | ||
|
|
||
| if config.get("plymouth_theme_amdgpu") and detect_amdgpu(): | ||
| plymouth_theme = config["plymouth_theme_amdgpu"] | ||
| debug("Using AMD GPU plymouth theme: {}".format(plymouth_theme)) | ||
| def setUseSimpledrm(self): | ||
| conf_path = os.path.join(self.__root, "etc", "plymouth", "plymouthd.conf") | ||
|
|
||
| target_env_call(["plymouth-set-default-theme", plymouth_theme]) | ||
| try: | ||
| with fileinput.input(conf_path, inplace=True) as config: | ||
| for line in config: | ||
| if line.startswith("#[Daemon]") or line.startswith("[Daemon]"): | ||
| line = line.lstrip("#") | ||
| line = line + "UseSimpledrm=1\n" | ||
|
|
||
| print(line, end='') | ||
|
Comment on lines
+59
to
+65
|
||
| except Exception as e: | ||
| warning("Failed to set UseSimpledrm=1: {!s}".format(e)) | ||
|
|
||
| def run(self): | ||
| if detect_plymouth(): | ||
| if (("plymouth_theme" in libcalamares.job.configuration) and | ||
| (libcalamares.job.configuration["plymouth_theme"] is not None)): | ||
| self.setTheme() | ||
|
|
||
| if libcalamares.job.configuration.get("plymouth_simpledrm", False): | ||
| self.setUseSimpledrm() | ||
| return None | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,20 +3,20 @@ | |
| # | ||
| # Plymouth Configuration Module | ||
| # | ||
| # This module can be used to setup the default plymouth theme to | ||
| # This module can be used to setup the default plymouth theme to | ||
| # be used with your distribution | ||
| # | ||
| # You should only use this module if the plymouth package is installed | ||
| # on the build configurations of your distribution & the plymouth | ||
| # You should only use this module if the plymouth package is installed | ||
| # on the build configurations of your distribution & the plymouth | ||
| # theme you want to configure is installed as well. If the unpacked | ||
| # filesystem configures a plymouth theme already, there is no need | ||
| # to change it here. | ||
| --- | ||
|
|
||
|
|
||
| # Leave this commented if you want to use the default theme | ||
| # shipped with your distribution configurations. Make sure that | ||
| # the theme exists in the themes directory of plymouth path. | ||
| # Leave this commented if you want to use the default theme | ||
| # shipped with your distribution configurations. Make sure that | ||
| # the theme exists in the themes directory of plymouth path. | ||
| # Debian / Ubuntu comes with themes "joy", "script", "softwaves", | ||
| # possibly others. Look in /usr/share/plymouth/themes for more. | ||
| # | ||
|
|
@@ -26,8 +26,5 @@ | |
|
|
||
| plymouth_theme: cachyos-bootanimation | ||
|
|
||
| # Optional: set a different theme for systems with AMD GPUs. | ||
| # If an AMD GPU is detected and this is set, it overrides plymouth_theme. | ||
| # Leave commented to use the same theme for all hardware. | ||
| plymouth_theme_amdgpu: cachyos | ||
|
|
||
| # Use simpledrm driver to show splash screen | ||
| plymouth_simpledrm: true | ||
|
Comment on lines
27
to
+30
|
||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -7,4 +7,4 @@ additionalProperties: false | |||||||
| type: object | ||||||||
| properties: | ||||||||
| plymouth_theme: { type: string } | ||||||||
|
||||||||
| plymouth_theme: { type: string } | |
| plymouth_theme: { type: string } | |
| plymouth_theme_amdgpu: { type: string } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setUseSimpledrm()usesos.path.join(...)but this module no longer importsos, so it will raiseNameErrorat runtime whenplymouth_simpledrmis enabled. Add the missing import (or avoidos.path).