mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
ColorSchemeTab: set walker theme to noctalia on template activation
This commit is contained in:
@@ -594,7 +594,7 @@
|
||||
"description-missing": "Erfordert die Installation von {app}"
|
||||
},
|
||||
"walker": {
|
||||
"description": "Schreibt {filepath}",
|
||||
"description": "Schreibt {filepath} und setzt das Theme auf noctalia",
|
||||
"description-missing": "Erfordert die Installation von {app}"
|
||||
},
|
||||
"discord": {
|
||||
|
||||
@@ -598,7 +598,7 @@
|
||||
"description-missing": "Requires {app} to be installed"
|
||||
},
|
||||
"walker": {
|
||||
"description": "Write {filepath}",
|
||||
"description": "Write {filepath} and set theme to noctalia",
|
||||
"description-missing": "Requires {app} to be installed"
|
||||
},
|
||||
"discord": {
|
||||
|
||||
@@ -594,7 +594,7 @@
|
||||
"description-missing": "Requiere que {app} esté instalado"
|
||||
},
|
||||
"walker": {
|
||||
"description": "Escribir {filepath}",
|
||||
"description": "Escribir {filepath} y establecer tema a noctalia",
|
||||
"description-missing": "Requiere que {app} esté instalado"
|
||||
},
|
||||
"discord": {
|
||||
|
||||
@@ -594,7 +594,7 @@
|
||||
"description-missing": "Nécessite que le lanceur {app} soit installé"
|
||||
},
|
||||
"walker": {
|
||||
"description": "Écrire {filepath}",
|
||||
"description": "Écrire {filepath} et définir le thème sur noctalia",
|
||||
"description-missing": "Nécessite que le lanceur {app} soit installé"
|
||||
},
|
||||
"discord": {
|
||||
|
||||
@@ -556,7 +556,7 @@
|
||||
"description-missing": "Requer que o {app} esteja instalado"
|
||||
},
|
||||
"walker": {
|
||||
"description": "Escrever {filepath}",
|
||||
"description": "Escrever {filepath} e definir tema como noctalia",
|
||||
"description-missing": "Requer que o {app} esteja instalado"
|
||||
},
|
||||
"discord": {
|
||||
|
||||
@@ -594,7 +594,7 @@
|
||||
"description-missing": "需要安装 {app}"
|
||||
},
|
||||
"walker": {
|
||||
"description": "写入 {filepath}",
|
||||
"description": "写入 {filepath} 并将主题设置为 noctalia",
|
||||
"description-missing": "需要安装 {app}"
|
||||
},
|
||||
"discord": {
|
||||
|
||||
@@ -101,7 +101,7 @@ Item {
|
||||
|
||||
SplitParser {
|
||||
id: textStdoutSplit
|
||||
onRead: (line) => root.parseDynamicContent(line)
|
||||
onRead: line => root.parseDynamicContent(line)
|
||||
}
|
||||
|
||||
StdioCollector {
|
||||
@@ -142,6 +142,7 @@ Item {
|
||||
_dynamicIcon = parsed.icon || ""
|
||||
return
|
||||
} catch (e) {
|
||||
|
||||
// Not a valid JSON, treat as plain text
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import qs.Commons
|
||||
import qs.Services
|
||||
@@ -669,10 +670,10 @@ ColumnLayout {
|
||||
NCheckbox {
|
||||
label: "Vicinae"
|
||||
description: ProgramCheckerService.vicinaeAvailable ? I18n.tr("settings.color-scheme.templates.programs.vicinae.description", {
|
||||
"filepath": "~/.local/share/vicinae/themes/matugen.toml"
|
||||
}) : I18n.tr("settings.color-scheme.templates.programs.vicinae.description-missing", {
|
||||
"app": "vicinae"
|
||||
})
|
||||
"filepath": "~/.local/share/vicinae/themes/matugen.toml"
|
||||
}) : I18n.tr("settings.color-scheme.templates.programs.vicinae.description-missing", {
|
||||
"app": "vicinae"
|
||||
})
|
||||
checked: Settings.data.templates.vicinae
|
||||
enabled: ProgramCheckerService.vicinaeAvailable
|
||||
opacity: ProgramCheckerService.vicinaeAvailable ? 1.0 : 0.6
|
||||
@@ -686,16 +687,61 @@ ColumnLayout {
|
||||
NCheckbox {
|
||||
label: "Walker"
|
||||
description: ProgramCheckerService.walkerAvailable ? I18n.tr("settings.color-scheme.templates.programs.walker.description", {
|
||||
"filepath": "~/.config/walker/style.css"
|
||||
}) : I18n.tr("settings.color-scheme.templates.programs.walker.description-missing", {
|
||||
"app": "walker"
|
||||
})
|
||||
"filepath": "~/.config/walker/style.css"
|
||||
}) : I18n.tr("settings.color-scheme.templates.programs.walker.description-missing", {
|
||||
"app": "walker"
|
||||
})
|
||||
checked: Settings.data.templates.walker
|
||||
enabled: ProgramCheckerService.walkerAvailable
|
||||
opacity: ProgramCheckerService.walkerAvailable ? 1.0 : 0.6
|
||||
onToggled: checked => {
|
||||
if (ProgramCheckerService.walkerAvailable) {
|
||||
Settings.data.templates.walker = checked
|
||||
if (checked) {
|
||||
// Update walker config.toml to use noctalia theme
|
||||
var configFile = Quickshell.env("HOME") + "/.config/walker/config.toml"
|
||||
var configDir = Quickshell.env("HOME") + "/.config/walker"
|
||||
var configFileEsc = configFile.replace(/'/g, "'\\''")
|
||||
var configDirEsc = configDir.replace(/'/g, "'\\''")
|
||||
|
||||
Logger.i("ColorSchemeTab", "Updating walker config:", configFile)
|
||||
Logger.d("ColorSchemeTab", "Config file path:", configFileEsc)
|
||||
Logger.d("ColorSchemeTab", "Config dir path:", configDirEsc)
|
||||
|
||||
// Remove existing theme line and insert new one at the top
|
||||
var script = "echo '[Walker Config] Starting update...' && "
|
||||
script += "mkdir -p '" + configDirEsc + "' && "
|
||||
script += "echo '[Walker Config] Directory created/verified' && "
|
||||
script += "if [ -f '" + configFileEsc + "' ]; then "
|
||||
script += "echo '[Walker Config] File exists, removing old theme line' && "
|
||||
script += "(grep -v '^theme[[:space:]]*=' '" + configFileEsc + "' > '" + configFileEsc + ".tmp' 2>/dev/null || cat '" + configFileEsc + "' > '" + configFileEsc + ".tmp') && "
|
||||
script += "mv '" + configFileEsc + ".tmp' '" + configFileEsc + "' && "
|
||||
script += "echo '[Walker Config] Removed old theme line'; "
|
||||
script += "else echo '[Walker Config] File does not exist, will create'; "
|
||||
script += "fi && "
|
||||
script += "echo 'theme = \"noctalia\"' | cat - '" + configFileEsc + "' > '" + configFileEsc + ".tmp' && "
|
||||
script += "mv '" + configFileEsc + ".tmp' '" + configFileEsc + "' && "
|
||||
script += "echo '[Walker Config] Inserted theme at top' && "
|
||||
script += "FINAL_THEME=$(grep '^theme' '" + configFileEsc + "' | head -1 2>/dev/null) && "
|
||||
script += "echo '[Walker Config] Final theme line: '$FINAL_THEME || echo '[Walker Config] ERROR: Theme line not found after update'"
|
||||
|
||||
Logger.d("ColorSchemeTab", "Executing script:", script)
|
||||
|
||||
// Execute script using execDetached
|
||||
Quickshell.execDetached(["sh", "-c", script])
|
||||
|
||||
// Verify the update after a short delay
|
||||
Qt.callLater(function () {
|
||||
var verifyScript = "grep '^theme' '" + configFileEsc + "' | head -1 2>/dev/null || echo 'NOT_FOUND'"
|
||||
var verifyProcessStr = "import QtQuick; import Quickshell.Io; Process { command: [\"sh\", \"-c\", \"" + verifyScript.replace(/"/g, '\\"') + "\"]; stdout: StdioCollector {} }"
|
||||
var verifyProcess = Qt.createQmlObject(verifyProcessStr, root, "walkerVerify")
|
||||
verifyProcess.exited.connect(function (exitCode) {
|
||||
Logger.i("ColorSchemeTab", "Walker theme verification:", verifyProcess.stdout.text || "NOT FOUND")
|
||||
verifyProcess.destroy()
|
||||
})
|
||||
verifyProcess.running = true
|
||||
})
|
||||
}
|
||||
AppThemeService.generate()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ Singleton {
|
||||
"hex_stripped": hex.replace(/^#/, "")
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// Generate container colors
|
||||
const primaryContainer = ColorsConvert.generateContainerColor(colors.mPrimary, isDarkMode)
|
||||
const secondaryContainer = ColorsConvert.generateContainerColor(colors.mSecondary, isDarkMode)
|
||||
@@ -238,7 +238,7 @@ Singleton {
|
||||
const onSurface = isStrict ? colors.mOnSurface : ColorsConvert.generateOnColor(colors.mSurface, isDarkMode)
|
||||
|
||||
// Generate surface variant (slightly different tone)
|
||||
const surfaceVariant = isStrict ? colors.mSurfaceVariant : ColorsConvert.adjustLightness(colors.mSurface, isDarkMode ? 5 : -3)
|
||||
const surfaceVariant = isStrict ? colors.mSurfaceVariant : ColorsConvert.adjustLightness(colors.mSurface, isDarkMode ? 5 : -3)
|
||||
const onSurfaceVariant = isStrict ? colors.mOnSurfaceVariant : ColorsConvert.generateOnColor(surfaceVariant, isDarkMode)
|
||||
|
||||
// Generate surface containers (progressive elevation)
|
||||
@@ -306,7 +306,6 @@ Singleton {
|
||||
const templatePath = `${Quickshell.shellDir}/Assets/MatugenTemplates/${config.input}`
|
||||
let script = ""
|
||||
|
||||
|
||||
const palette = generatePalette(colors, Settings.data.colorSchemes.darkMode, config.strict || false)
|
||||
|
||||
config.outputs.forEach(output => {
|
||||
|
||||
Reference in New Issue
Block a user