[api] refactoring: custom themes dir for root user is now /usr/share/bauh/themes

This commit is contained in:
Vinicius Moreira
2021-11-25 15:57:59 -03:00
parent 985657987f
commit 25c9ed9fa3
4 changed files with 5 additions and 4 deletions

View File

@@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- configuration: `/etc/bauh` - configuration: `/etc/bauh`
- temp dir: `/tmp/bauh@root` (`/tmp/bauh@$USER` for non root users) - temp dir: `/tmp/bauh@root` (`/tmp/bauh@$USER` for non root users)
- autostart: `/etc/xdg/autostart` (only used by the Web gem at the moment) - autostart: `/etc/xdg/autostart` (only used by the Web gem at the moment)
- custom themes: `/usr/share/bauh/themes`
- UI - UI
- settings panel: - settings panel:

View File

@@ -416,7 +416,7 @@ boot:
#### <a name="custom_themes">Custom themes</a> #### <a name="custom_themes">Custom themes</a>
- Custom themes can be provided by adding their files at `~/.local/share/bauh/themes` (sub-folders are allowed). - Custom themes can be provided by adding their files at `~/.local/share/bauh/themes` (or `/usr/share/bauh/themes` for **root**). Sub-folders are allowed.
- Themes are composed by 2 required and 1 optional files sharing the same name: - Themes are composed by 2 required and 1 optional files sharing the same name:
- `my_theme.qss`: file with the qss rules. Full example: [light.qss](https://github.com/vinifmor/bauh/blob/master/bauh/view/resources/style/light/light.qss) - `my_theme.qss`: file with the qss rules. Full example: [light.qss](https://github.com/vinifmor/bauh/blob/master/bauh/view/resources/style/light/light.qss)
- `my_theme.meta`: file defining the theme's data. Full example: [light.meta](https://github.com/vinifmor/bauh/blob/master/bauh/view/resources/style/light/light.meta) - `my_theme.meta`: file defining the theme's data. Full example: [light.meta](https://github.com/vinifmor/bauh/blob/master/bauh/view/resources/style/light/light.meta)

View File

@@ -6,7 +6,7 @@ from bauh.api import user
CACHE_PATH = f'/var/cache/{__app_name__}' if user.is_root() else f'{Path.home()}/.cache/{__app_name__}' CACHE_PATH = f'/var/cache/{__app_name__}' if user.is_root() else f'{Path.home()}/.cache/{__app_name__}'
CONFIG_DIR = f'/etc/{__app_name__}' if user.is_root() else f'{Path.home()}/.config/{__app_name__}' CONFIG_DIR = f'/etc/{__app_name__}' if user.is_root() else f'{Path.home()}/.config/{__app_name__}'
USER_THEMES_PATH = '{}/.local/share/bauh/themes'.format(str(Path.home())) USER_THEMES_DIR = f'/usr/share/{__app_name__}/themes' if user.is_root() else f'{Path.home()}/.local/share/{__app_name__}/themes'
DESKTOP_ENTRIES_DIR = '{}/.local/share/applications'.format(str(Path.home())) DESKTOP_ENTRIES_DIR = '{}/.local/share/applications'.format(str(Path.home()))
TEMP_DIR = f'/tmp/{__app_name__}@{getuser()}' TEMP_DIR = f'/tmp/{__app_name__}@{getuser()}'
LOGS_DIR = f'{TEMP_DIR}/logs' LOGS_DIR = f'{TEMP_DIR}/logs'

View File

@@ -3,7 +3,7 @@ import os
import re import re
from typing import Optional, Dict, Tuple, Set from typing import Optional, Dict, Tuple, Set
from bauh.api.paths import USER_THEMES_PATH from bauh.api.paths import USER_THEMES_DIR
from bauh.view.util import resource from bauh.view.util import resource
from bauh.view.util.translation import I18n from bauh.view.util.translation import I18n
@@ -114,7 +114,7 @@ def read_default_themes() -> Dict[str, str]:
def read_user_themes() -> Dict[str, str]: def read_user_themes() -> Dict[str, str]:
return {f: f for f in glob.glob('{}/**/*.qss'.format(USER_THEMES_PATH), recursive=True)} return {f: f for f in glob.glob('{}/**/*.qss'.format(USER_THEMES_DIR), recursive=True)}
def read_all_themes_metadata() -> Set[ThemeMetadata]: def read_all_themes_metadata() -> Set[ThemeMetadata]: