mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
Merge pull request #609 from lonerOrz/feat/parseJson
feat(custom-button): Add JSON parsing support
This commit is contained in:
@@ -15,6 +15,7 @@ ColumnLayout {
|
||||
|
||||
property string valueIcon: widgetData.icon !== undefined ? widgetData.icon : widgetMetadata.icon
|
||||
property bool valueTextStream: widgetData.textStream !== undefined ? widgetData.textStream : widgetMetadata.textStream
|
||||
property bool valueParseJson: widgetData.parseJson !== undefined ? widgetData.parseJson : widgetMetadata.parseJson
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, widgetData || {})
|
||||
@@ -25,6 +26,7 @@ ColumnLayout {
|
||||
settings.textCommand = textCommandInput.text
|
||||
settings.textCollapse = textCollapseInput.text
|
||||
settings.textStream = valueTextStream
|
||||
settings.parseJson = valueParseJson
|
||||
settings.textIntervalMs = parseInt(textIntervalInput.text || textIntervalInput.placeholderText, 10)
|
||||
return settings
|
||||
}
|
||||
@@ -101,6 +103,14 @@ ColumnLayout {
|
||||
onToggled: checked => valueTextStream = checked
|
||||
}
|
||||
|
||||
NToggle {
|
||||
id: parseJsonInput
|
||||
label: I18n.tr("bar.widget-settings.custom-button.parse-json.label", "Parse output as JSON")
|
||||
description: I18n.tr("bar.widget-settings.custom-button.parse-json.description", "Parse the command output as a JSON object to dynamically set text and icon.")
|
||||
checked: valueParseJson
|
||||
onToggled: checked => valueParseJson = checked
|
||||
}
|
||||
|
||||
NTextInput {
|
||||
id: textCommandInput
|
||||
Layout.fillWidth: true
|
||||
|
||||
Reference in New Issue
Block a user