update
This commit is contained in:
@@ -6,7 +6,7 @@ import qs.Commons
|
||||
import qs.Widgets
|
||||
import qs.Services.UI
|
||||
|
||||
Rectangle {
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property var pluginApi: null
|
||||
@@ -18,14 +18,6 @@ Rectangle {
|
||||
readonly property string barPosition: Settings.data.bar.position
|
||||
readonly property bool isVertical: barPosition === "left" || barPosition === "right"
|
||||
|
||||
implicitWidth: isVertical ? Style.capsuleHeight : layout.implicitWidth + Style.marginS * 2
|
||||
implicitHeight: isVertical ? layout.implicitHeight + Style.marginS * 2 : Style.capsuleHeight
|
||||
|
||||
color: root.hovered ? Color.mHover : Style.capsuleColor
|
||||
radius: Style.radiusM
|
||||
border.color: Style.capsuleBorderColor
|
||||
border.width: Style.capsuleBorderWidth
|
||||
|
||||
property string currentIconName: pluginApi?.pluginSettings?.currentIconName || pluginApi?.manifest?.metadata?.defaultSettings?.currentIconName
|
||||
property bool hideOnZero: pluginApi?.pluginSettings.hideOnZero || pluginApi?.manifest?.metadata.defaultSettings?.hideOnZero
|
||||
readonly property bool isVisible: (root.pluginApi?.mainInstance?.updateCount > 0) || !root.hideOnZero
|
||||
@@ -33,57 +25,73 @@ Rectangle {
|
||||
// also set opacity to zero when invisible as we use opacity to hide the barWidgetLoader
|
||||
opacity: root.isVisible ? 1.0 : 0.0
|
||||
|
||||
readonly property real contentWidth: isVertical ? Style.capsuleHeight : layout.implicitWidth + Style.marginS * 2
|
||||
readonly property real contentHeight: isVertical ? layout.implicitHeight + Style.marginS * 2 : Style.capsuleHeight
|
||||
|
||||
implicitWidth: contentWidth
|
||||
implicitHeight: contentHeight
|
||||
|
||||
//
|
||||
// ------ Widget ------
|
||||
//
|
||||
Item {
|
||||
id: layout
|
||||
anchors.centerIn: parent
|
||||
Rectangle {
|
||||
id: visualCapsule
|
||||
x: Style.pixelAlignCenter(parent.width, width)
|
||||
y: Style.pixelAlignCenter(parent.height, height)
|
||||
width: root.contentWidth
|
||||
height: root.contentHeight
|
||||
color: root.hovered ? Color.mHover : Style.capsuleColor
|
||||
radius: Style.radiusM
|
||||
border.color: Style.capsuleBorderColor
|
||||
border.width: Style.capsuleBorderWidth
|
||||
|
||||
implicitWidth: grid.implicitWidth
|
||||
implicitHeight: grid.implicitHeight
|
||||
Item {
|
||||
id: layout
|
||||
anchors.centerIn: parent
|
||||
|
||||
GridLayout {
|
||||
id: grid
|
||||
columns: root.isVertical ? 1 : 2
|
||||
rowSpacing: Style.marginS
|
||||
columnSpacing: Style.marginS
|
||||
implicitWidth: grid.implicitWidth
|
||||
implicitHeight: grid.implicitHeight
|
||||
|
||||
NIcon {
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
icon: root.currentIconName
|
||||
color: root.hovered ? Color.mOnHover : Color.mOnSurface
|
||||
}
|
||||
GridLayout {
|
||||
id: grid
|
||||
columns: root.isVertical ? 1 : 2
|
||||
rowSpacing: Style.marginS
|
||||
columnSpacing: Style.marginS
|
||||
|
||||
NText {
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
text: root.pluginApi?.mainInstance?.updateCount.toString()
|
||||
color: root.hovered ? Color.mOnHover : Color.mOnSurface
|
||||
pointSize: Style.barFontSize
|
||||
NIcon {
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
icon: root.currentIconName
|
||||
color: root.hovered ? Color.mOnHover : Color.mOnSurface
|
||||
}
|
||||
|
||||
NText {
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
text: root.pluginApi?.mainInstance?.updateCount.toString()
|
||||
color: root.hovered ? Color.mOnHover : Color.mOnSurface
|
||||
pointSize: Style.barFontSize
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: root.pluginApi?.mainInstance?.updateCount > 0 ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: root.pluginApi?.mainInstance?.updateCount > 0 ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
|
||||
onClicked: {
|
||||
if (root.pluginApi?.mainInstance?.updateCount > 0)
|
||||
root.pluginApi?.mainInstance?.startDoSystemUpdate();
|
||||
}
|
||||
onClicked: {
|
||||
if (root.pluginApi?.mainInstance?.updateCount > 0)
|
||||
root.pluginApi?.mainInstance?.startDoSystemUpdate();
|
||||
}
|
||||
|
||||
onEntered: {
|
||||
root.hovered = true;
|
||||
buildTooltip();
|
||||
}
|
||||
|
||||
onEntered: {
|
||||
root.hovered = true;
|
||||
buildTooltip();
|
||||
}
|
||||
|
||||
onExited: {
|
||||
root.hovered = false;
|
||||
TooltipService.hide();
|
||||
}
|
||||
onExited: {
|
||||
root.hovered = false;
|
||||
TooltipService.hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ Configure the plugin in Noctalia settings:
|
||||
|
||||
- **Noctalia Shell**: 3.6.0 or later.
|
||||
- **Update backend**: one of the supported package managers defined in `updaterConfigs.json` (recommended, but not required).
|
||||
- **Paru/Yay**: Default `updaterConfigs.json` requires `checkupdates`
|
||||
|
||||
## Technical Details
|
||||
|
||||
|
||||
@@ -70,16 +70,26 @@ ColumnLayout {
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginL
|
||||
ColumnLayout {
|
||||
spacing: Style.marginM
|
||||
|
||||
NLabel {
|
||||
label: pluginApi?.tr("settings.updateInterval.label")
|
||||
description: pluginApi?.tr("settings.updateInterval.desc")
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginM
|
||||
|
||||
NLabel {
|
||||
label: pluginApi?.tr("settings.updateInterval.label")
|
||||
description: pluginApi?.tr("settings.updateInterval.desc")
|
||||
}
|
||||
|
||||
NText {
|
||||
text: root.updateIntervalMinutes.toString().padStart(3, " ") + " minutes"
|
||||
color: Settings.data.colorSchemes.darkMode ? Color.mOnSurface : Color.mOnPrimary
|
||||
}
|
||||
}
|
||||
|
||||
NSlider {
|
||||
Layout.fillWidth: true
|
||||
from: 5
|
||||
to: 300
|
||||
value: root.updateIntervalMinutes
|
||||
@@ -88,11 +98,6 @@ ColumnLayout {
|
||||
root.updateIntervalMinutes = value;
|
||||
}
|
||||
}
|
||||
|
||||
NText {
|
||||
text: root.updateIntervalMinutes.toString().padStart(3, " ") + " minutes"
|
||||
color: Settings.data.colorSchemes.darkMode ? Color.mOnSurface : Color.mOnPrimary
|
||||
}
|
||||
}
|
||||
|
||||
NDivider {
|
||||
@@ -145,28 +150,23 @@ ColumnLayout {
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
RowLayout {
|
||||
NText {
|
||||
Layout.fillWidth: true
|
||||
text: pluginApi?.tr("settings.currentNumUpdatesCmd.label")
|
||||
color: Settings.data.colorSchemes.darkMode ? Color.mSecondary : Color.mOnSecondary
|
||||
}
|
||||
NText {
|
||||
text: root.customCmdGetNumUpdates || pluginApi?.mainInstance?.updater.cmdGetNumUpdates || "NA"
|
||||
color: Settings.data.colorSchemes.darkMode ? Color.mTertiary : Color.mOnTertiary
|
||||
}
|
||||
NText {
|
||||
text: pluginApi?.tr("settings.currentNumUpdatesCmd.label")
|
||||
color: Settings.data.colorSchemes.darkMode ? Color.mSecondary : Color.mOnSecondary
|
||||
}
|
||||
NLabel {
|
||||
description: `> ${root.customCmdGetNumUpdates || pluginApi?.mainInstance?.updater.cmdGetNumUpdates || "NA"}`
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
NText {
|
||||
text: pluginApi?.tr("settings.currentUpdateCmd.label")
|
||||
color: Settings.data.colorSchemes.darkMode ? Color.mSecondary : Color.mOnSecondary
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
NText {
|
||||
Layout.fillWidth: true
|
||||
text: pluginApi?.tr("settings.currentUpdateCmd.label")
|
||||
color: Settings.data.colorSchemes.darkMode ? Color.mSecondary : Color.mOnSecondary
|
||||
}
|
||||
NText {
|
||||
text: root.customCmdDoSystemUpdate || pluginApi?.mainInstance?.updater.cmdDoSystemUpdate || "NA"
|
||||
color: Settings.data.colorSchemes.darkMode ? Color.mTertiary : Color.mOnTertiary
|
||||
}
|
||||
NLabel {
|
||||
description: `> ${root.customCmdDoSystemUpdate || pluginApi?.mainInstance?.updater.cmdDoSystemUpdate || "NA"}`
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"settings": {
|
||||
"changeIcon": {
|
||||
"label": "Ikon kiválasztása"
|
||||
},
|
||||
"currentCommands": {
|
||||
"label": "Jelenleg beállított parancsok"
|
||||
},
|
||||
"currentIconName": {
|
||||
"desc": "Jelenleg beállított ikon neve.",
|
||||
"label": "Ikonazonosító"
|
||||
},
|
||||
"currentNumUpdatesCmd": {
|
||||
"label": "Frissítések száma"
|
||||
},
|
||||
"currentUpdateCmd": {
|
||||
"label": "Rendszerfrissítés"
|
||||
},
|
||||
"customCmdDoSystemUpdate": {
|
||||
"desc": "A rendszerfrissítés végrehajtásához használt shell parancs.",
|
||||
"label": "Egyedi rendszerfrissítési parancs",
|
||||
"placeholder": "e.g., yay -Syu"
|
||||
},
|
||||
"customCmdGetNumUpdates": {
|
||||
"desc": "Shell parancs, amelynek egyetlen egész számot kell kiírnia, ami a rendelkezésre álló frissítések számát jelöli.",
|
||||
"label": "Egyéni frissítésszám parancs",
|
||||
"placeholder": "e.g., yay -Quq 2>/dev/null | wc -l"
|
||||
},
|
||||
"hideWidget": {
|
||||
"desc": "Akkor rejtse el a widgetet, ha a rendelkezésre álló frissítések száma 0.",
|
||||
"label": "Elrejtés nulla frissítés esetén"
|
||||
},
|
||||
"terminal": {
|
||||
"desc": "A rendszerfrissítés végrehajtásához használt terminálparancs. Opcionális: {} a frissítési parancshoz.",
|
||||
"label": "Terminálemulátor",
|
||||
"placeholder": "pl.: foot -e, hyprctl dispatch exec '[float] kitty -e {}'-plural"
|
||||
},
|
||||
"updateInterval": {
|
||||
"desc": "Lekérdezési időtartam a frissítések ellenőrzéséhez",
|
||||
"label": "Frissítések ellenőrzésének gyakorisága"
|
||||
}
|
||||
},
|
||||
"tooltip": {
|
||||
"noUpdatesAvailable": "Nincsenek észlelt frissítések",
|
||||
"updatesAvailable": "Kattintson a beállított rendszerfrissítési parancs futtatásához"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"settings": {
|
||||
"changeIcon": {
|
||||
"label": "Îkon Hilbijêre"
|
||||
},
|
||||
"currentCommands": {
|
||||
"label": "Niha emrên hatine sazkirin"
|
||||
},
|
||||
"currentIconName": {
|
||||
"desc": "Navê îkona ku niha hatiye vesazkirin.",
|
||||
"label": "Nasnameya Îkonê"
|
||||
},
|
||||
"currentNumUpdatesCmd": {
|
||||
"label": "Hejmara nûvekirinê"
|
||||
},
|
||||
"currentUpdateCmd": {
|
||||
"label": "Nûkirina sîstemê"
|
||||
},
|
||||
"customCmdDoSystemUpdate": {
|
||||
"desc": "Fermana şêlê ya ku ji bo pêkanîna nûvekirina pergalê tê bikaranîn.",
|
||||
"label": "Fermana Nûvekirina Sîstemê ya Xweser",
|
||||
"placeholder": "mînak, yay -Syu"
|
||||
},
|
||||
"customCmdGetNumUpdates": {
|
||||
"desc": "Fermana shellê ya ku divê yek hejmarek temam derxe ku hejmara nûvekirinên berdest nîşan dide.",
|
||||
"label": "Fermana Jimartinê ya Hejmara Nûvekirinê ya Xweser",
|
||||
"placeholder": "mînak, yay -Quq 2>/dev/null | wc -l"
|
||||
},
|
||||
"hideWidget": {
|
||||
"desc": "Demaşê widgetê gava jimara nûkirinên berdest 0 be.",
|
||||
"label": "Veşartin li ser Nûkirinên Sifir"
|
||||
},
|
||||
"terminal": {
|
||||
"desc": "Fermana termînalê ya ku ji bo pêkanîna fermana nûvekirina pergalê tê bikaranîn. Vebijêrkî: {} ji bo fermana nûvekirinê.",
|
||||
"label": "Emulatorê Termînalê",
|
||||
"placeholder": "mînak, foot -e, hyprctl dispatch exec '[float] kitty -e {}'"
|
||||
},
|
||||
"updateInterval": {
|
||||
"desc": "Demê dûrî ji bo kontrolên nûvekirinê",
|
||||
"label": "Demê Kontrolkirina Nûvekirinê"
|
||||
}
|
||||
},
|
||||
"tooltip": {
|
||||
"noUpdatesAvailable": "Tu nûvekirin hatin dîtin",
|
||||
"updatesAvailable": "Bitikîne da fermana nûkirina pergalê ya hatî vesazkirin bimeşîne"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"settings": {
|
||||
"changeIcon": {
|
||||
"label": "Wybierz ikonę"
|
||||
},
|
||||
"currentCommands": {
|
||||
"label": "Obecnie skonfigurowane polecenia"
|
||||
},
|
||||
"currentIconName": {
|
||||
"desc": "Aktualnie skonfigurowana nazwa ikony.",
|
||||
"label": "Identyfikator ikony"
|
||||
},
|
||||
"currentNumUpdatesCmd": {
|
||||
"label": "Liczba aktualizacji"
|
||||
},
|
||||
"currentUpdateCmd": {
|
||||
"label": "Aktualizacja systemu"
|
||||
},
|
||||
"customCmdDoSystemUpdate": {
|
||||
"desc": "Polecenie powłoki używane do przeprowadzania aktualizacji systemu.",
|
||||
"label": "Niestandardowe polecenie aktualizacji systemu",
|
||||
"placeholder": "np. yay -Syu"
|
||||
},
|
||||
"customCmdGetNumUpdates": {
|
||||
"desc": "Polecenie powłoki, które musi zwrócić pojedynczą liczbę całkowitą reprezentującą liczbę dostępnych aktualizacji.",
|
||||
"label": "Własna komenda aktualizująca liczbę",
|
||||
"placeholder": "np. yay -Quq 2>/dev/null | wc -l"
|
||||
},
|
||||
"hideWidget": {
|
||||
"desc": "Ukryj widżet, gdy liczba dostępnych aktualizacji wynosi 0.",
|
||||
"label": "Ukryj przy braku aktualizacji"
|
||||
},
|
||||
"terminal": {
|
||||
"desc": "Polecenie terminala używane do wykonywania polecenia aktualizacji systemu. Opcjonalne: {} dla polecenia aktualizacji.",
|
||||
"label": "Emulator terminala",
|
||||
"placeholder": "np. foot -e, hyprctl dispatch exec '[float] kitty -e {}'"
|
||||
},
|
||||
"updateInterval": {
|
||||
"desc": "Interwał odpytywania dla sprawdzania aktualizacji",
|
||||
"label": "Interwał sprawdzania aktualizacji"
|
||||
}
|
||||
},
|
||||
"tooltip": {
|
||||
"noUpdatesAvailable": "Nie wykryto aktualizacji",
|
||||
"updatesAvailable": "Kliknij, aby uruchomić skonfigurowane polecenie aktualizacji systemu"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"settings": {
|
||||
"changeIcon": {
|
||||
"label": "選取圖示"
|
||||
},
|
||||
"currentCommands": {
|
||||
"label": "現在所設定的指令"
|
||||
},
|
||||
"currentIconName": {
|
||||
"desc": "現在所設定的圖示名稱",
|
||||
"label": "圖示識別"
|
||||
},
|
||||
"currentNumUpdatesCmd": {
|
||||
"label": "更新數量"
|
||||
},
|
||||
"currentUpdateCmd": {
|
||||
"label": "系統更新"
|
||||
},
|
||||
"customCmdDoSystemUpdate": {
|
||||
"desc": "用來執行系統更新的 shell 指令",
|
||||
"label": "自訂系統更新指令",
|
||||
"placeholder": "例如: yay -Syu"
|
||||
},
|
||||
"customCmdGetNumUpdates": {
|
||||
"desc": "所使用的 shell 指令必須要輸出用來表示數量的整數值 (int)",
|
||||
"label": "自訂更新數量指令",
|
||||
"placeholder": "例如: yay -Quq 2>/dev/null | wc -l"
|
||||
},
|
||||
"hideWidget": {
|
||||
"desc": "當可以更新的套件數量是0時隱藏小工具",
|
||||
"label": "零更新時隱藏"
|
||||
},
|
||||
"terminal": {
|
||||
"desc": "用來執行系統更新指令用的終端機指令; 可選用: 以 {} 作為更新指令",
|
||||
"label": "終端機",
|
||||
"placeholder": "例如 foot -e, hyprctl dispatch exec '[float] kitty -e {}'"
|
||||
},
|
||||
"updateInterval": {
|
||||
"desc": "確認更新的時間間格",
|
||||
"label": "更新檢查間格"
|
||||
}
|
||||
},
|
||||
"tooltip": {
|
||||
"noUpdatesAvailable": "沒有偵測到更新",
|
||||
"updatesAvailable": "點擊以執行設定好的系統更新指令"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "update-count",
|
||||
"name": "Update Count",
|
||||
"version": "1.0.9",
|
||||
"version": "1.0.11",
|
||||
"minNoctaliaVersion": "3.6.0",
|
||||
"author": "BukoMoon",
|
||||
"license": "GPLv3",
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
[
|
||||
{
|
||||
"name": "yay",
|
||||
"cmdCheck": "command -v yay >/dev/null 2>&1",
|
||||
"cmdGetNumUpdates": "yay -Qu 2>/dev/null | wc -l",
|
||||
"cmdCheck": "command -v checkupdates >/dev/null 2>&1 && command -v yay >/dev/null 2>&1",
|
||||
"cmdGetNumUpdates": "(checkupdates 2>/dev/null; yay -Qua 2>/dev/null) | wc -l",
|
||||
"cmdDoSystemUpdate": "yay -Syu"
|
||||
},
|
||||
{
|
||||
"name": "paru",
|
||||
"cmdCheck": "command -v paru >/dev/null 2>&1",
|
||||
"cmdGetNumUpdates": "paru -Qu 2>/dev/null | wc -l",
|
||||
"cmdCheck": "command -v checkupdates >/dev/null 2>&1 && command -v paru >/dev/null 2>&1",
|
||||
"cmdGetNumUpdates": "(checkupdates 2>/dev/null; paru -Qua 2>/dev/null) | wc -l",
|
||||
"cmdDoSystemUpdate": "paru -Syu"
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user