fix: resolve Obsidian theming overrides with complete CSS variables, container selectors, and mtime touch reloading
This commit is contained in:
parent
9c628e28ec
commit
8b80fe1d38
@ -1459,7 +1459,7 @@ def sync_obsidian(bg, surface, current_line, fg, accent, sub_accent, is_dark):
|
||||
|
||||
# CSS Template for Obsidian Vaults
|
||||
obsidian_css = f"""/* Auto-generated by Quickshell Theme Engine */
|
||||
.theme-dark, .theme-light, :root, body {{
|
||||
body, .theme-dark, .theme-light, :root, html {{
|
||||
--bg-primary: {bg} !important;
|
||||
--bg-primary-alt: {surface} !important;
|
||||
--bg-secondary: {surface} !important;
|
||||
@ -1471,7 +1471,9 @@ def sync_obsidian(bg, surface, current_line, fg, accent, sub_accent, is_dark):
|
||||
--background-secondary-alt: {current_line} !important;
|
||||
--background-modifier-border: {current_line} !important;
|
||||
--background-modifier-border-hover: {accent} !important;
|
||||
--background-modifier-border-focus: {accent} !important;
|
||||
--background-modifier-form-field: {surface} !important;
|
||||
--background-modifier-form-field-highlighted: {current_line} !important;
|
||||
|
||||
--text-normal: {fg} !important;
|
||||
--text-muted: {fg} !important;
|
||||
@ -1483,18 +1485,29 @@ def sync_obsidian(bg, surface, current_line, fg, accent, sub_accent, is_dark):
|
||||
|
||||
--text-accent: {accent} !important;
|
||||
--text-accent-hover: {sub_accent} !important;
|
||||
|
||||
--color-red: #ff9580 !important;
|
||||
--color-orange: #ffca80 !important;
|
||||
--color-yellow: #ffff80 !important;
|
||||
--color-green: #8aff80 !important;
|
||||
--color-cyan: #80ffea !important;
|
||||
--color-blue: {accent} !important;
|
||||
--color-purple: {accent} !important;
|
||||
--color-pink: {sub_accent} !important;
|
||||
|
||||
--nav-item-color-active: {accent} !important;
|
||||
--nav-item-background-active: {surface} !important;
|
||||
--tab-text-color-active: {accent} !important;
|
||||
--tab-container-background: {bg} !important;
|
||||
|
||||
--bold-color: {accent} !important;
|
||||
--italic-color: {sub_accent} !important;
|
||||
--title-color: {fg} !important;
|
||||
--h1-color: {accent} !important;
|
||||
--h2-color: {sub_accent} !important;
|
||||
--h3-color: {fg} !important;
|
||||
--h4-color: {fg} !important;
|
||||
--h5-color: {fg} !important;
|
||||
--h3-color: #80ffea !important;
|
||||
--h4-color: #8aff80 !important;
|
||||
--h5-color: #ffca80 !important;
|
||||
--h6-color: {fg} !important;
|
||||
|
||||
--code-normal: {accent} !important;
|
||||
@ -1505,6 +1518,17 @@ def sync_obsidian(bg, surface, current_line, fg, accent, sub_accent, is_dark):
|
||||
--titlebar-background: {bg} !important;
|
||||
--titlebar-background-focused: {bg} !important;
|
||||
}}
|
||||
|
||||
.app-container, .workspace, .workspace-split, .workspace-leaf, .workspace-leaf-content,
|
||||
.view-header, .view-content, .markdown-source-view, .cm-editor, .cm-scroller, .cm-content,
|
||||
.nav-files-container, .workspace-ribbon {{
|
||||
background-color: {bg} !important;
|
||||
color: {fg} !important;
|
||||
}}
|
||||
|
||||
.sidebar-toggle-button, .workspace-ribbon, .nav-folder-title, .nav-file-title, .view-header {{
|
||||
background-color: {surface} !important;
|
||||
}}
|
||||
"""
|
||||
|
||||
vault_dirs = set()
|
||||
@ -1516,6 +1540,8 @@ def sync_obsidian(bg, surface, current_line, fg, accent, sub_accent, is_dark):
|
||||
os.path.join(home, 'Obsidian'),
|
||||
os.path.join(home, 'Vaults'),
|
||||
os.path.join(home, 'Notes'),
|
||||
os.path.join(home, 'studies'),
|
||||
os.path.join(home, 'Documents', 'studies'),
|
||||
os.path.join(home, '.var', 'app', 'md.obsidian.Obsidian', 'config', 'obsidian'),
|
||||
os.path.join(home, '.config', 'obsidian')
|
||||
]
|
||||
@ -1580,12 +1606,15 @@ def sync_obsidian(bg, surface, current_line, fg, accent, sub_accent, is_dark):
|
||||
|
||||
if 'quickshell-theme' not in enabled_snippets:
|
||||
enabled_snippets.append('quickshell-theme')
|
||||
app_data['enabledCssSnippets'] = enabled_snippets
|
||||
|
||||
app_data['enabledCssSnippets'] = enabled_snippets
|
||||
app_data['baseOption'] = 'dark' if is_dark else 'light'
|
||||
|
||||
with open(app_file, 'w', encoding='utf-8') as f:
|
||||
json.dump(app_data, f, indent=2)
|
||||
|
||||
# Touch appearance.json to trigger Obsidian live snippet reload
|
||||
os.utime(app_file, None)
|
||||
except Exception: pass
|
||||
|
||||
def main():
|
||||
|
||||
Loading…
Reference in New Issue
Block a user