mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Merge branch 'main' of https://github.com/noctalia-dev/noctalia-shell
This commit is contained in:
@@ -339,7 +339,7 @@ hyprland)
|
||||
if grep -qE 'source\s*=\s*.*noctalia.*\.conf' "$CONFIG_FILE"; then
|
||||
echo "Theme already included, skipping modification."
|
||||
else
|
||||
# Only convert symlink when we actually need to write
|
||||
# Only convert symlink when we actually need to write (NixOS read-only symlinks)
|
||||
if [ -L "$CONFIG_FILE" ] && [ ! -w "$CONFIG_FILE" ]; then
|
||||
echo "Detected read-only symlink, converting to local file..."
|
||||
cp --remove-destination "$(readlink -f "$CONFIG_FILE")" "$CONFIG_FILE"
|
||||
@@ -372,7 +372,7 @@ sway)
|
||||
if grep -qE 'include\s+.*noctalia' "$CONFIG_FILE"; then
|
||||
echo "Theme already included, skipping modification."
|
||||
else
|
||||
# Only convert symlink when we actually need to write
|
||||
# Only convert symlink when we actually need to write (NixOS read-only symlinks)
|
||||
if [ -L "$CONFIG_FILE" ] && [ ! -w "$CONFIG_FILE" ]; then
|
||||
echo "Detected read-only symlink, converting to local file..."
|
||||
cp --remove-destination "$(readlink -f "$CONFIG_FILE")" "$CONFIG_FILE"
|
||||
@@ -453,10 +453,25 @@ mango)
|
||||
grep -E "^($COLOR_VARS)\s*=" "$conf_file" >>"$BACKUP_FILE"
|
||||
|
||||
# Remove color definitions from original file
|
||||
sed -i -E "/^($COLOR_VARS)\s*=/d" "$conf_file"
|
||||
if [ -L "$conf_file" ] && [ ! -w "$conf_file" ]; then
|
||||
# Read-only symlink (e.g. NixOS): convert to local file
|
||||
cp --remove-destination "$(readlink -f "$conf_file")" "$conf_file"
|
||||
chmod +w "$conf_file"
|
||||
sed -i -E "/^($COLOR_VARS)\s*=/d" "$conf_file"
|
||||
else
|
||||
# Edit the real file, preserving any writable symlink
|
||||
sed -i -E "/^($COLOR_VARS)\s*=/d" "$(readlink -f "$conf_file")"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Only convert symlink when we actually need to write
|
||||
if [ -L "$MAIN_CONFIG" ] && [ ! -w "$MAIN_CONFIG" ]; then
|
||||
echo "Detected read-only symlink, converting to local file..."
|
||||
cp --remove-destination "$(readlink -f "$MAIN_CONFIG")" "$MAIN_CONFIG"
|
||||
chmod +w "$MAIN_CONFIG"
|
||||
fi
|
||||
|
||||
# Add source line to main config
|
||||
if [ -f "$MAIN_CONFIG" ]; then
|
||||
echo "" >>"$MAIN_CONFIG"
|
||||
|
||||
@@ -58,17 +58,23 @@ def ensure_gtk_css_import(gtk_css: Path, colors_file: Path, label: str) -> bool:
|
||||
# Already has the import (flexible: allow optional whitespace / different quoting)
|
||||
if "noctalia.css" in content and "@import" in content:
|
||||
return True
|
||||
# Need to modify — convert symlink to regular file first
|
||||
# Need to modify — handle symlinks carefully
|
||||
target = gtk_css
|
||||
if gtk_css.is_symlink():
|
||||
resolved = gtk_css.resolve()
|
||||
gtk_css.unlink()
|
||||
gtk_css.write_text(resolved.read_text())
|
||||
if os.access(resolved, os.W_OK):
|
||||
# Writable symlink (e.g. dotfiles): edit the target directly
|
||||
target = resolved
|
||||
else:
|
||||
# Read-only symlink (e.g. NixOS): convert to local file
|
||||
gtk_css.unlink()
|
||||
gtk_css.write_text(resolved.read_text())
|
||||
# Append import to the end
|
||||
new_content = content.rstrip()
|
||||
if new_content and not new_content.endswith("\n"):
|
||||
new_content += "\n"
|
||||
new_content += "\n" + GTK_IMPORT + "\n"
|
||||
gtk_css.write_text(new_content)
|
||||
target.write_text(new_content)
|
||||
print(f"Appended {label} noctalia.css import to gtk.css")
|
||||
else:
|
||||
gtk_css.write_text(GTK_IMPORT + "\n")
|
||||
|
||||
@@ -1610,6 +1610,10 @@ Singleton {
|
||||
Settings.data.desktopWidgets.monitorWidgets = desktopWidgetsBackup;
|
||||
Logger.d("PluginService", "Restored desktop widget settings");
|
||||
|
||||
// Persist restored layout immediately to prevent race with file watcher reload
|
||||
// (the earlier disablePlugin write triggers a reload that can overwrite the restore)
|
||||
Settings.saveImmediate();
|
||||
|
||||
// Remove from updates list
|
||||
var updates = Object.assign({}, root.pluginUpdates);
|
||||
delete updates[pluginId];
|
||||
@@ -1628,6 +1632,7 @@ Singleton {
|
||||
|
||||
// Restore desktop widget settings even on failure
|
||||
Settings.data.desktopWidgets.monitorWidgets = desktopWidgetsBackup;
|
||||
Settings.saveImmediate();
|
||||
|
||||
if (callback)
|
||||
callback(false, error);
|
||||
|
||||
Reference in New Issue
Block a user