mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
SchemeDownloader: add support for spaces in names
This commit is contained in:
@@ -241,9 +241,14 @@ Popup {
|
||||
// Rate limit hit - try to use cache if available
|
||||
downloadError = I18n.tr("settings.color-scheme.download.error.rate-limit");
|
||||
Logger.w("ColorSchemeDownload", downloadError);
|
||||
if (schemesCacheAdapter.schemes && schemesCacheAdapter.schemes.length > 0) {
|
||||
availableSchemes = schemesCacheAdapter.schemes;
|
||||
Logger.i("ColorSchemeDownload", "Using cached schemes due to rate limit");
|
||||
if (typeof ShellState !== 'undefined' && ShellState.isLoaded) {
|
||||
const cacheData = ShellState.getColorSchemesList();
|
||||
const cachedSchemes = cacheData.schemes || [];
|
||||
if (cachedSchemes.length > 0) {
|
||||
availableSchemes = cachedSchemes;
|
||||
hasInitialData = true;
|
||||
Logger.i("ColorSchemeDownload", "Using cached schemes due to rate limit");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
downloadError = I18n.tr("settings.color-scheme.download.error.api-error", {
|
||||
@@ -740,7 +745,12 @@ Popup {
|
||||
enabled: !fetching && !downloading
|
||||
onClicked: {
|
||||
// Force refresh by clearing cache timestamp and fetching directly from API
|
||||
schemesCacheAdapter.timestamp = 0;
|
||||
if (typeof ShellState !== 'undefined' && ShellState.isLoaded) {
|
||||
ShellState.setColorSchemesList({
|
||||
schemes: [],
|
||||
timestamp: 0
|
||||
});
|
||||
}
|
||||
// Fetch directly from API to avoid cache check delay
|
||||
fetchAvailableSchemesFromAPI();
|
||||
}
|
||||
|
||||
@@ -329,6 +329,11 @@ Singleton {
|
||||
// ================================================================================
|
||||
// TERMINAL THEMES (predefined schemes use pre-rendered files)
|
||||
// ================================================================================
|
||||
function escapeShellPath(path) {
|
||||
// Escape single quotes by ending the quoted string, adding an escaped quote, and starting a new quoted string
|
||||
return "'" + path.replace(/'/g, "'\\''") + "'";
|
||||
}
|
||||
|
||||
function handleTerminalThemes(mode) {
|
||||
const commands = [];
|
||||
const homeDir = Quickshell.env("HOME");
|
||||
@@ -339,8 +344,8 @@ Singleton {
|
||||
const outputDir = outputPath.substring(0, outputPath.lastIndexOf('/'));
|
||||
const templatePath = getTerminalColorsTemplate(terminal, mode);
|
||||
|
||||
commands.push(`mkdir -p ${outputDir}`);
|
||||
commands.push(`cp -f ${templatePath} ${outputPath}`);
|
||||
commands.push(`mkdir -p ${escapeShellPath(outputDir)}`);
|
||||
commands.push(`cp -f ${escapeShellPath(templatePath)} ${escapeShellPath(outputPath)}`);
|
||||
commands.push(`${TemplateRegistry.colorsApplyScript} ${terminal}`);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user