linuxmint / cinnamon

A Linux desktop featuring a traditional layout, built from modern technology and introducing brand new innovative features.
GNU General Public License v2.0
4.57k stars 744 forks source link

Themes Naming Bug #12471

Closed C-Yassin closed 3 weeks ago

C-Yassin commented 3 weeks ago

Distribution

Linux Mint 22 Wilma

Package version

6.2.9

Graphics hardware in use

Intel 3rd Gen Core processor Graphics

Frequency

Always

Bug description

Hello everyone! Why the mixed theme and the light theme have the same name? i think it's a bug, it causes me troubles when making my app

cmd = ['gsettings', 'get', 'org.cinnamon.desktop.interface', 'gtk-theme']
        result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)

        # Get the theme name and convert to lowercase
        theme = result.stdout.strip().lower()

both the light and mixed one output [code]'mint-y-aqua'[/code] except the dark theme which does good 'mint-y-dark-aqua'

Steps to reproduce

cmd = ['gsettings', 'get', 'org.cinnamon.desktop.interface', 'gtk-theme']
        result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)

        # Get the theme name and convert to lowercase
        theme = result.stdout.strip().lower()

Expected behavior

Mixed theme should output 'mint-y-mixed-aqua'

Additional information

No response

JosephMcc commented 3 weeks ago

This isn't a bug. There are no themes name -mixed. This is just a combination of light and dark themes and the dark mode set to "Let application decide". So you will get a mix of light and dark applications.

C-Yassin commented 3 weeks ago

If that the case, how to differentiate between them.

C-Yassin commented 3 weeks ago

Or just how to know the user selected the "mixed" option?

C-Yassin commented 3 weeks ago

i fixed it using this. Thank you tho!

def is_dark_mode_enabled_linux_mint(self):

Get the current theme name

theme_cmd = ["gsettings", "get", "org.cinnamon.theme", "name"]
theme_result = subprocess.run(theme_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)

if theme_result.returncode != 0:
    return "dark"  

theme_name = theme_result.stdout.strip().replace("'", "")  # Remove any single quotes

# Construct the path to the theme's CSS file
theme_path = f"/usr/share/themes/{theme_name}/cinnamon/cinnamon.css"

# Run grep command to check for the dark mode color
cmd = ["grep", "-i", "background-color: *#2f2f2f", theme_path]
result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)

# Get the output of the grep command
theme_check = result.stdout.strip().lower()

# Check if the grep command returned any result
if not theme_check:
    return "light"
else:
    return "dark"