mirror of
https://github.com/caelestia-dots/cli.git
synced 2026-06-10 01:09:28 -05:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c930bd2604 | |||
| cc155cf432 | |||
| 6e59149fbf | |||
| 8d2b737f15 | |||
| 4bcd42f482 | |||
| 51cecd481c | |||
| c9312f3928 | |||
| bfaf4fc373 |
Generated
+10
-10
@@ -9,11 +9,11 @@
|
||||
"quickshell": "quickshell"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1772330657,
|
||||
"narHash": "sha256-cWblprYsDUeAWA57xAqxIjNxXvDI/rqYn6TFp2OPi/k=",
|
||||
"lastModified": 1772962569,
|
||||
"narHash": "sha256-ctRw4pVgx0IYKfA2hy90Ku37pnVX2T4q57UWp+l69fs=",
|
||||
"owner": "caelestia-dots",
|
||||
"repo": "shell",
|
||||
"rev": "278fd4a4ed1bfb42c3fe197ff38b587539c012aa",
|
||||
"rev": "e183599ce9e2c8d30a14631d53eb9947220c0812",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -24,11 +24,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1772198003,
|
||||
"narHash": "sha256-I45esRSssFtJ8p/gLHUZ1OUaaTaVLluNkABkk6arQwE=",
|
||||
"lastModified": 1772773019,
|
||||
"narHash": "sha256-E1bxHxNKfDoQUuvriG71+f+s/NT0qWkImXsYZNFFfCs=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "dd9b079222d43e1943b6ebd802f04fd959dc8e61",
|
||||
"rev": "aca4d95fce4914b3892661bcb80b8087293536c6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -46,11 +46,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1771926182,
|
||||
"narHash": "sha256-QbXuSLhiSxOq6ydBL3+KGe1aiYWBW+e3J6qjJZaRMq0=",
|
||||
"lastModified": 1772925576,
|
||||
"narHash": "sha256-mMoiXABDtkSJxCYDrkhJ/TrrJf5M46oUfIlJvv2gkZ0=",
|
||||
"ref": "refs/heads/master",
|
||||
"rev": "cddb4f061bab495f4473ca5f2c571b6c710efef7",
|
||||
"revCount": 744,
|
||||
"rev": "15a84097653593dd15fad59a56befc2b7bdc270d",
|
||||
"revCount": 750,
|
||||
"type": "git",
|
||||
"url": "https://git.outfoxxed.me/outfoxxed/quickshell"
|
||||
},
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
[Appearance]
|
||||
color_scheme_path={{ $config }}/colors/caelestia.colors
|
||||
custom_palette=true
|
||||
icon_theme=Papirus-{{ $mode }}
|
||||
standard_dialogs=default
|
||||
style=Darkly
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"theme": {
|
||||
"colorScheme": "~/.config/qtengine/caelestia.colors",
|
||||
"iconTheme": "Papirus-{{ $mode }}",
|
||||
"style": "Darkly",
|
||||
"font": {
|
||||
"family": "Sans Serif",
|
||||
"size": 12,
|
||||
"weight": -1
|
||||
},
|
||||
"fontFixed": {
|
||||
"family": "Monospace",
|
||||
"size": 12,
|
||||
"weight": -1
|
||||
}
|
||||
},
|
||||
"misc": {
|
||||
"menusHaveIcons": true,
|
||||
"singleClickActivate": false,
|
||||
"shortcutsForContextMenus": true
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
from pathlib import Path
|
||||
import json
|
||||
import re
|
||||
import shutil
|
||||
@@ -6,6 +5,7 @@ import subprocess
|
||||
import time
|
||||
from argparse import Namespace
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
from caelestia.utils.notify import close_notification, notify
|
||||
from caelestia.utils.paths import recording_notif_path, recording_path, recordings_dir, user_config_path
|
||||
|
||||
@@ -140,7 +140,10 @@ class Command:
|
||||
monitor_x = monitor.get("x")
|
||||
monitor_y = monitor.get("y")
|
||||
|
||||
if not all(isinstance(x, (int, float)) for x in [monitor_height, monitor_width, monitor_scale, monitor_x, monitor_y]):
|
||||
if not all(
|
||||
isinstance(x, (int, float))
|
||||
for x in [monitor_height, monitor_width, monitor_scale, monitor_x, monitor_y]
|
||||
):
|
||||
return
|
||||
|
||||
monitor_height = monitor_height / monitor_scale
|
||||
|
||||
@@ -12,9 +12,11 @@ def log_exception(func):
|
||||
Used by the `apply_()` functions so that an exception, when applying
|
||||
a theme, does not prevent the other themes from being applied.
|
||||
"""
|
||||
|
||||
def wrapper(*args, **kwargs):
|
||||
try:
|
||||
func(*args, **kwargs)
|
||||
except Exception as e:
|
||||
log_message(f'Error during execution of "{func.__name__}()": {str(e)}')
|
||||
|
||||
return wrapper
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import fcntl
|
||||
import json
|
||||
import re
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
import tempfile
|
||||
import shutil
|
||||
import fcntl
|
||||
import sys
|
||||
import subprocess
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
from caelestia.utils.colour import get_dynamic_colours
|
||||
from caelestia.utils.logging import log_exception
|
||||
@@ -117,6 +116,7 @@ def write_file(path: Path, content: str) -> None:
|
||||
f.flush()
|
||||
shutil.move(f.name, path)
|
||||
|
||||
|
||||
@log_exception
|
||||
def apply_terms(sequences: str) -> None:
|
||||
state = c_state_dir / "sequences.txt"
|
||||
@@ -129,6 +129,7 @@ def apply_terms(sequences: str) -> None:
|
||||
try:
|
||||
# Use non-blocking write with timeout to prevent hangs
|
||||
import os
|
||||
|
||||
fd = os.open(str(pt), os.O_WRONLY | os.O_NONBLOCK | os.O_NOCTTY)
|
||||
try:
|
||||
os.write(fd, sequences.encode())
|
||||
@@ -155,6 +156,7 @@ def apply_discord(scss: str) -> None:
|
||||
for client in "Equicord", "Vencord", "BetterDiscord", "equibop", "vesktop", "legcord":
|
||||
write_file(config_dir / client / "themes/caelestia.theme.css", conf)
|
||||
|
||||
|
||||
@log_exception
|
||||
def apply_pandora(colours: dict[str, str], mode: str) -> None:
|
||||
template = gen_replace(colours, templates_dir / "pandora.json", hash=True)
|
||||
@@ -197,11 +199,7 @@ def apply_htop(colours: dict[str, str]) -> None:
|
||||
def sync_papirus_colors(hex_color: str) -> None:
|
||||
"""Sync Papirus folder icon colors using hue/saturation analysis"""
|
||||
try:
|
||||
result = subprocess.run(
|
||||
["which", "papirus-folders"],
|
||||
capture_output=True,
|
||||
check=False
|
||||
)
|
||||
result = subprocess.run(["which", "papirus-folders"], capture_output=True, check=False)
|
||||
if result.returncode != 0:
|
||||
return
|
||||
except Exception:
|
||||
@@ -247,7 +245,7 @@ def sync_papirus_colors(hex_color: str) -> None:
|
||||
["sudo", "-n", "papirus-folders", "-C", color, "-u"],
|
||||
stderr=subprocess.DEVNULL,
|
||||
stdout=subprocess.DEVNULL,
|
||||
start_new_session=True
|
||||
start_new_session=True,
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
@@ -322,29 +320,12 @@ def apply_gtk(colours: dict[str, str], mode: str) -> None:
|
||||
|
||||
@log_exception
|
||||
def apply_qt(colours: dict[str, str], mode: str) -> None:
|
||||
template = gen_replace(colours, templates_dir / f"qt{mode}.colors", hash=True)
|
||||
write_file(config_dir / "qt5ct/colors/caelestia.colors", template)
|
||||
write_file(config_dir / "qt6ct/colors/caelestia.colors", template)
|
||||
colours = gen_replace(colours, templates_dir / f"qt{mode}.colors", hash=True)
|
||||
write_file(config_dir / "qtengine/caelestia.colors", colours)
|
||||
|
||||
qtct = (templates_dir / "qtct.conf").read_text()
|
||||
qtct = qtct.replace("{{ $mode }}", mode.capitalize())
|
||||
|
||||
for ver in 5, 6:
|
||||
conf = qtct.replace("{{ $config }}", str(config_dir / f"qt{ver}ct"))
|
||||
|
||||
if ver == 5:
|
||||
conf += """
|
||||
[Fonts]
|
||||
fixed="Monospace,12,-1,5,50,0,0,0,0,0"
|
||||
general="Sans Serif,12,-1,5,50,0,0,0,0,0"
|
||||
"""
|
||||
else:
|
||||
conf += """
|
||||
[Fonts]
|
||||
fixed="Monospace,12,-1,5,400,0,0,0,0,0,0,0,0,0,0,1"
|
||||
general="Sans Serif,12,-1,5,400,0,0,0,0,0,0,0,0,0,0,1"
|
||||
"""
|
||||
write_file(config_dir / f"qt{ver}ct/qt{ver}ct.conf", conf)
|
||||
config = (templates_dir / "qtengine.json").read_text()
|
||||
config = config.replace("{{ $mode }}", mode.capitalize())
|
||||
write_file(config_dir / "qtengine/config.json", config)
|
||||
|
||||
|
||||
@log_exception
|
||||
@@ -380,7 +361,7 @@ def apply_colours(colours: dict[str, str], mode: str) -> None:
|
||||
c_state_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
try:
|
||||
with open(lock_file, 'w') as lock_fd:
|
||||
with open(lock_file, "w") as lock_fd:
|
||||
try:
|
||||
fcntl.flock(lock_fd.fileno(), fcntl.LOCK_EX | fcntl.LOCK_NB)
|
||||
except BlockingIOError:
|
||||
|
||||
@@ -96,6 +96,7 @@ def get_smart_opts(wall: Path, cache: Path) -> str:
|
||||
|
||||
|
||||
def get_colours_for_wall(wall: Path | str, no_smart: bool) -> None:
|
||||
wall = Path(wall)
|
||||
scheme = get_scheme()
|
||||
cache = wallpapers_cache_dir / compute_hash(wall)
|
||||
|
||||
@@ -124,6 +125,7 @@ def get_colours_for_wall(wall: Path | str, no_smart: bool) -> None:
|
||||
"colours": get_colours_for_image(get_thumb(wall, cache), scheme),
|
||||
}
|
||||
|
||||
|
||||
def convert_gif(wall: Path) -> Path:
|
||||
cache = wallpapers_cache_dir / compute_hash(wall)
|
||||
output_path = cache / "first_frame.png"
|
||||
@@ -142,7 +144,6 @@ def convert_gif(wall: Path) -> Path:
|
||||
return output_path
|
||||
|
||||
|
||||
|
||||
def set_wallpaper(wall: Path | str, no_smart: bool) -> None:
|
||||
# Make path absolute
|
||||
wall = Path(wall).resolve()
|
||||
|
||||
Reference in New Issue
Block a user