Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 20 additions & 28 deletions src/modules/plymouthcfg/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
# Calamares is Free Software: see the License-Identifier above.
#

import subprocess

import os
import fileinput
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

setUseSimpledrm() uses os.path.join(...) but this module no longer imports os, so it will raise NameError at runtime when plymouth_simpledrm is enabled. Add the missing import (or avoid os.path).

Suggested change
import fileinput
import fileinput
import os

Copilot uses AI. Check for mistakes.
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",
Expand All @@ -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):
Expand All @@ -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
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

The current in-place edit only inserts UseSimpledrm=1 after the [Daemon] header and does not update an existing UseSimpledrm= entry. If the file already contains UseSimpledrm=0 later in the section, that later value may override the inserted one, so the setting may not take effect. Consider replacing any existing UseSimpledrm= line within [Daemon] and only inserting if missing (e.g., via configparser or a small state machine).

Copilot uses AI. Check for mistakes.
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


Expand Down
19 changes: 8 additions & 11 deletions src/modules/plymouthcfg/plymouthcfg.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand All @@ -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
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

This config change drops the AMD-GPU-specific theme override (plymouth_theme_amdgpu) and enables plymouth_simpledrm by default. The PR title/description only mentions the simpledrm default; if removing the AMD override is intentional, it should be called out explicitly (it’s a behavior/config surface change).

Copilot uses AI. Check for mistakes.
2 changes: 1 addition & 1 deletion src/modules/plymouthcfg/plymouthcfg.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ additionalProperties: false
type: object
properties:
plymouth_theme: { type: string }
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

This schema change removes plymouth_theme_amdgpu. If any existing Calamares configurations still provide that key, schema validation will now fail due to additionalProperties: false. If the removal is intentional, consider keeping it temporarily (deprecated) or ensuring all downstream configs are updated in lockstep.

Suggested change
plymouth_theme: { type: string }
plymouth_theme: { type: string }
plymouth_theme_amdgpu: { type: string }

Copilot uses AI. Check for mistakes.
plymouth_theme_amdgpu: { type: string }
plymouth_simpledrm: { type: boolean }