mirror of
https://github.com/imarkoff/Marble-shell-theme.git
synced 2025-09-17 16:57:56 -07:00
- Now "spacing" property is responsible for spacings in datemenu, not components with margins. Looks the same on 47 and 43; - Fixed styles mismatch on older GNOME versions; - Fixed notification buttons on older GNOME versions; - Fixed some buttons in login/unlock dialogs on older GNOME versions; - Fixed an issue where generate_file moved specific GNOME version assets to marble folder instead of copying them to temp folder;
33 lines
1.0 KiB
Python
33 lines
1.0 KiB
Python
import subprocess
|
|
|
|
def gnome_version() -> str | None:
|
|
"""
|
|
Get gnome-shell version
|
|
"""
|
|
|
|
try:
|
|
output = subprocess.check_output(['gnome-shell', '--version'], text=True).strip()
|
|
return output.split(' ')[2]
|
|
except subprocess.CalledProcessError:
|
|
return None
|
|
|
|
def apply_gnome_theme(theme=None) -> bool:
|
|
"""
|
|
Apply gnome-shell theme
|
|
:param theme: theme name
|
|
"""
|
|
|
|
try:
|
|
if theme is None:
|
|
current_theme = subprocess.check_output(['dconf', 'read', '/org/gnome/shell/extensions/user-theme/name'], text=True).strip().strip("'")
|
|
if current_theme.startswith("Marble"):
|
|
theme = current_theme
|
|
else:
|
|
return False
|
|
|
|
subprocess.run(['dconf', 'reset', '/org/gnome/shell/extensions/user-theme/name'], check=True)
|
|
subprocess.run(['dconf', 'write', '/org/gnome/shell/extensions/user-theme/name', f"'{theme}'"], check=True)
|
|
print(f"Theme '{theme}' applied.")
|
|
except subprocess.CalledProcessError:
|
|
return False
|
|
return True |