💅 style(colors): update color scheme in config/hypr/colors.conf and styles/colors.css
This commit is contained in:
9 files changed
+532
-336
No files matched your search
@@ -10,31 +10,6 @@ import utils.icons as icons
|
||||
from fabric.utils import get_relative_path
|
||||
|
||||
|
||||
def load_launcher_config(config_path: str) -> Dict:
|
||||
"""Load trigger configuration from JSON file"""
|
||||
config = {"launcher_config": {}, "settings": {}}
|
||||
|
||||
if os.path.exists(config_path):
|
||||
try:
|
||||
with open(config_path, "r", encoding="utf-8") as f:
|
||||
config = json.load(f)
|
||||
except Exception as e:
|
||||
print(f"Error loading trigger config: {e}")
|
||||
|
||||
return config
|
||||
|
||||
|
||||
def save_launcher_config(config_path: str, config: Dict) -> bool:
|
||||
"""Save trigger configuration to JSON file"""
|
||||
try:
|
||||
os.makedirs(os.path.dirname(config_path), exist_ok=True)
|
||||
with open(config_path, "w", encoding="utf-8") as f:
|
||||
json.dump(config, f, indent=2, ensure_ascii=False)
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"Error saving trigger config: {e}")
|
||||
return False
|
||||
|
||||
|
||||
class TriggerConfig:
|
||||
def __init__(self, config_path: str = None):
|
||||
@@ -42,17 +17,29 @@ class TriggerConfig:
|
||||
config_path = get_relative_path("../../config/launcher.json")
|
||||
|
||||
self.config_path = config_path
|
||||
self.config = load_launcher_config(config_path)
|
||||
|
||||
# Load configuration from JSON file
|
||||
config = {"launcher_config": {}, "settings": {}}
|
||||
if os.path.exists(config_path):
|
||||
try:
|
||||
with open(config_path, "r", encoding="utf-8") as f:
|
||||
config = json.load(f)
|
||||
except Exception as e:
|
||||
print(f"Error loading trigger config: {e}")
|
||||
|
||||
self.config = config
|
||||
self.launcher_config = self.config.get("launcher_config", {})
|
||||
self.settings = self.config.get("settings", {})
|
||||
|
||||
if not self.launcher_config:
|
||||
self._create_default_config()
|
||||
# Initialize settings with defaults
|
||||
default_settings = {
|
||||
"max_examples_shown": 2,
|
||||
"default_icon": "apps",
|
||||
"fallback_example_template": "{trigger} <search>",
|
||||
"config_version": "1.0",
|
||||
}
|
||||
self.settings = {**default_settings, **self.config.get("settings", {})}
|
||||
|
||||
|
||||
def save_config(self) -> bool:
|
||||
self.config["launcher_config"] = self.launcher_config
|
||||
self.config["settings"] = self.settings
|
||||
return save_launcher_config(self.config_path, self.config)
|
||||
|
||||
def get_trigger_examples(self, trigger: str) -> List[str]:
|
||||
examples = self.launcher_config.get(trigger, {}).get("examples", [])
|
||||
@@ -77,59 +64,8 @@ class TriggerConfig:
|
||||
def get_all_triggers(self) -> Dict[str, Dict[str, Any]]:
|
||||
return self.launcher_config.copy()
|
||||
|
||||
def add_trigger(
|
||||
self,
|
||||
trigger: str,
|
||||
examples: List[str],
|
||||
icon: str = None,
|
||||
description: str = None,
|
||||
) -> bool:
|
||||
try:
|
||||
self.launcher_config[trigger] = {
|
||||
"examples": examples,
|
||||
"icon": icon or self.settings.get("default_icon", "system-search"),
|
||||
"description": description or f"{trigger} - Custom trigger",
|
||||
}
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"Error adding trigger {trigger}: {e}")
|
||||
return False
|
||||
|
||||
def remove_trigger(self, trigger: str) -> bool:
|
||||
try:
|
||||
if trigger in self.launcher_config:
|
||||
del self.launcher_config[trigger]
|
||||
return True
|
||||
return False
|
||||
except Exception as e:
|
||||
print(f"Error removing trigger {trigger}: {e}")
|
||||
return False
|
||||
|
||||
def get_max_examples_shown(self) -> int:
|
||||
return self.settings.get("max_examples_shown", 2)
|
||||
|
||||
def _create_default_config(self):
|
||||
self.launcher_config = {
|
||||
"app": {
|
||||
"examples": ["app firefox", "app chrome", "app terminal"],
|
||||
"icon": "apps",
|
||||
"description": "Applications - Launch installed applications",
|
||||
},
|
||||
"calc": {
|
||||
"examples": ["calc 2+2", "calc sqrt(16)", "calc pi*2"],
|
||||
"icon": "calculator",
|
||||
"description": "Calculator - Perform mathematical calculations",
|
||||
},
|
||||
"file": {
|
||||
"examples": ["file document.pdf", "file *.py", "file config"],
|
||||
"icon": "file",
|
||||
"description": "Files - Search for files and documents",
|
||||
},
|
||||
}
|
||||
|
||||
self.settings = {
|
||||
"max_examples_shown": 2,
|
||||
"default_icon": "apps",
|
||||
"fallback_example_template": "{trigger} <search>",
|
||||
"config_version": "1.0",
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user