Skip to content
3 changes: 3 additions & 0 deletions quickshell/Common/SettingsData.qml
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,9 @@ Singleton {
property bool updaterUseCustomCommand: false
property string updaterCustomCommand: ""
property string updaterTerminalAdditionalParams: ""
property bool updaterShowLatestNews: false
property string updaterLatestNewsUrl: ""
property string updaterLatestNewsRegex: ""

property string displayNameMode: "system"
property var screenPreferences: ({})
Expand Down
3 changes: 3 additions & 0 deletions quickshell/Common/settings/SettingsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ var SPEC = {
updaterUseCustomCommand: { def: false },
updaterCustomCommand: { def: "" },
updaterTerminalAdditionalParams: { def: "" },
updaterShowLatestNews: { def: false },
updaterLatestNewsUrl: { def: "" },
updaterLatestNewsRegex: { def: "" },

displayNameMode: { def: "system" },
screenPreferences: { def: {} },
Expand Down
109 changes: 109 additions & 0 deletions quickshell/Modules/Settings/SystemUpdaterTab.qml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,115 @@ Item {
}
}
}

SettingsToggleRow {
text: I18n.tr("Show Latest News")
description: I18n.tr("Show your distro's latest news")
checked: SettingsData.updaterShowLatestNews
onToggled: checked => {
SettingsData.set("updaterShowLatestNews", checked);
}
}

FocusScope {
width: parent.width - Theme.spacingM * 2
height: latestNewsUrlColumn.implicitHeight
anchors.left: parent.left
anchors.leftMargin: Theme.spacingM

Column {
id: latestNewsUrlColumn
width: parent.width
spacing: Theme.spacingXS

StyledText {
text: I18n.tr("Custom feed to parse")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}

DankTextField {
id: updaterLatestNewsFeed
width: parent.width
height: 48
placeholderText: "https://archlinux.org/feeds/news/"
backgroundColor: Theme.withAlpha(Theme.surfaceContainerHighest, Theme.popupTransparency)
normalBorderColor: Theme.outlineMedium
focusedBorderColor: Theme.primary

Component.onCompleted: {
if (SettingsData.updaterLatestNewsUrl) {
text = SettingsData.updaterLatestNewsUrl;
}
}

onTextEdited: SettingsData.set("updaterLatestNewsUrl", text.trim())

MouseArea {
anchors.fill: parent
onPressed: mouse => {
updaterLatestNewsFeed.forceActiveFocus();
mouse.accepted = false;
}
}
}
}
}

FocusScope {
width: parent.width - Theme.spacingM * 2
implicitHeight: latestNewsRegexColumn.implicitHeight
anchors.left: parent.left
anchors.leftMargin: Theme.spacingM

Column {
id: latestNewsRegexColumn
width: parent.width
spacing: Theme.spacingXS

StyledText {
width: parent.width
text: I18n.tr("Custom feed regex")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}

DankTextField {
id: updaterLatestNewsRegex
width: parent.width
height: 48
placeholderText: "<item>\s*<title>([^<]+)<\/title>\s*<link>([^<]+)<\/link>\s*<description>([\s\S]*?)<\/description>[\s\S]*?<pubDate>([^<]+)<\/pubDate>"
backgroundColor: Theme.withAlpha(Theme.surfaceContainerHighest, Theme.popupTransparency)
normalBorderColor: Theme.outlineMedium
focusedBorderColor: Theme.primary

Component.onCompleted: {
if (SettingsData.updaterLatestNewsRegex) {
text = SettingsData.updaterLatestNewsRegex;
}
}

onTextEdited: SettingsData.set("updaterLatestNewsRegex", text.trim())

MouseArea {
anchors.fill: parent
onPressed: mouse => {
updaterLatestNewsRegex.forceActiveFocus();
mouse.accepted = false;
}
}
}

StyledText {
width: parent.width
text: I18n.tr("Don't include the regex delimeters and flags. It will use a global flag by default. It must produce 4 matches in this exact order: title, description, link, pubDate")
font.pixelSize: Theme.fontSizeSmall
font.italic: true
color: Theme.surfaceVariantText
opacity: 0.7
}
}
}
}
}
}
Expand Down
Loading