Skip to content

Commit 01a758b

Browse files
authored
Merge pull request #612 from Astinator/main
feat(arch-updater): Vertical bar support, toggles for tooltip/bold new version column
2 parents c2afb4c + 2fa6efa commit 01a758b

7 files changed

Lines changed: 174 additions & 64 deletions

File tree

arch-updater/BarWidget.qml

Lines changed: 107 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ Item {
4242
readonly property color iconColor: enableColorization ? Color.resolveColorKey(iconColorKey) : Color.mPrimary
4343

4444
// Content dimensions (visual capsule size)
45-
readonly property real contentWidth: content.implicitWidth + Style.marginM * 2
46-
readonly property real contentHeight: capsuleHeight
45+
readonly property real contentWidth: isBarVertical ? capsuleHeight : layout.implicitWidth + Style.marginM * 2
46+
readonly property real contentHeight: isBarVertical ? layout.implicitHeight + Style.marginM * 2 : capsuleHeight
4747

4848
// Widget dimensions (extends to full bar height for better click area)
4949
implicitWidth: contentWidth
@@ -67,54 +67,113 @@ Item {
6767
radius: Style.radiusL
6868
border.color: Style.capsuleBorderColor
6969
border.width: Style.capsuleBorderWidth
70-
71-
RowLayout { // Widget
72-
id: content
70+
Item {
71+
id: layout
7372
anchors.centerIn: parent
74-
spacing: Style.marginS
75-
NIcon { // Theme icon
76-
visible: !root.pluginApi.mainInstance.refreshing && root.customIconPath === "" && !root.useDistroLogo
77-
color: mouseArea.containsMouse ? Color.mOnHover : (root.pluginApi.mainInstance.noctaliaUpdate ? Color.mHover : root.iconColor)
78-
icon: (root.pluginApi.mainInstance.noctaliaUpdate | mouseArea.containsMouse) ? root.iconName + "-filled" : root.iconName
79-
}
80-
IconImage { // Custom file or distro logo
81-
visible: !root.pluginApi.mainInstance.refreshing && (root.useDistroLogo || root.customIconPath !== "")
82-
Layout.preferredWidth: root.capsuleHeight * 0.6
83-
Layout.preferredHeight: root.capsuleHeight * 0.6
84-
source: {
85-
if (root.useDistroLogo) return HostService.osLogo
86-
if (root.customIconPath !== "") return root.customIconPath.startsWith("file://") ? root.customIconPath : "file://" + root.customIconPath
87-
return ""
73+
implicitWidth: contentHorizontal.visible ? contentHorizontal.implicitWidth : contentVertical.implicitWidth
74+
implicitHeight: contentHorizontal.visible ? contentHorizontal.implicitHeight : contentVertical.implicitHeight
75+
76+
RowLayout { // Horizontal Widget
77+
id: contentHorizontal
78+
visible: !root.isBarVertical
79+
anchors.centerIn: parent
80+
spacing: Style.marginS
81+
NIcon { // Theme icon
82+
visible: !root.pluginApi.mainInstance.refreshing && root.customIconPath === "" && !root.useDistroLogo
83+
color: mouseArea.containsMouse ? Color.mOnHover : (root.pluginApi.mainInstance.noctaliaUpdate ? Color.mHover : root.iconColor)
84+
icon: (root.pluginApi.mainInstance.noctaliaUpdate | mouseArea.containsMouse) ? root.iconName + "-filled" : root.iconName
8885
}
89-
smooth: true
90-
asynchronous: true
91-
layer.enabled: root.enableColorization && (root.useDistroLogo || root.customIconPath !== "")
92-
layer.effect: ShaderEffect {
93-
property color targetColor: mouseArea.containsMouse ? Color.mOnHover : root.iconColor
94-
property real colorizeMode: 2.0
95-
fragmentShader: Qt.resolvedUrl(Quickshell.shellDir + "/Shaders/qsb/appicon_colorize.frag.qsb")
86+
IconImage { // Custom file or distro logo
87+
visible: !root.pluginApi.mainInstance.refreshing && (root.useDistroLogo || root.customIconPath !== "")
88+
Layout.preferredWidth: root.capsuleHeight * 0.6
89+
Layout.preferredHeight: root.capsuleHeight * 0.6
90+
source: {
91+
if (root.useDistroLogo) return HostService.osLogo
92+
if (root.customIconPath !== "") return root.customIconPath.startsWith("file://") ? root.customIconPath : "file://" + root.customIconPath
93+
return ""
94+
}
95+
smooth: true
96+
asynchronous: true
97+
layer.enabled: root.enableColorization && (root.useDistroLogo || root.customIconPath !== "")
98+
layer.effect: ShaderEffect {
99+
property color targetColor: mouseArea.containsMouse ? Color.mOnHover : root.iconColor
100+
property real colorizeMode: 2.0
101+
fragmentShader: Qt.resolvedUrl(Quickshell.shellDir + "/Shaders/qsb/appicon_colorize.frag.qsb")
102+
}
96103
}
97-
}
98-
NIcon { // Loading spinner
99-
icon: "loader"
100-
color: mouseArea.containsMouse ? Color.mOnHover : Color.mOnSurfaceVariant
101-
visible: root.pluginApi.mainInstance.refreshing
102-
103-
RotationAnimator on rotation {
104-
running: root.pluginApi.mainInstance.refreshing
105-
from: 0
106-
to: 360
107-
duration: 1000
108-
loops: Animation.Infinite
104+
NIcon { // Loading spinner
105+
icon: "loader"
106+
color: mouseArea.containsMouse ? Color.mOnHover : Color.mOnSurfaceVariant
107+
visible: root.pluginApi.mainInstance.refreshing
108+
109+
RotationAnimator on rotation {
110+
running: root.pluginApi.mainInstance.refreshing
111+
from: 0
112+
to: 360
113+
duration: 1000
114+
loops: Animation.Infinite
115+
}
116+
}
117+
NText { // Count
118+
visible: !root.pluginApi.mainInstance.refreshing
119+
text: (root.pluginApi.mainInstance.updateCount + root.pluginApi.mainInstance.flatpakCount).toString()
120+
color: mouseArea.containsMouse ? Color.mOnHover : (root.pluginApi.mainInstance.noctaliaUpdate ? Color.mSecondary : Color.mOnSurface)
121+
pointSize: root.barFontSize
122+
applyUiScale: false
123+
font.weight: root.boldText ? Font.Bold : Font.Normal
109124
}
110125
}
111-
NText { // Count
112-
visible: !root.pluginApi.mainInstance.refreshing
113-
text: (root.pluginApi.mainInstance.updateCount + root.pluginApi.mainInstance.flatpakCount).toString()
114-
color: mouseArea.containsMouse ? Color.mOnHover : (root.pluginApi.mainInstance.noctaliaUpdate ? Color.mSecondary : Color.mOnSurface)
115-
pointSize: root.barFontSize
116-
applyUiScale: false
117-
font.weight: root.boldText ? Font.Bold : Font.Normal
126+
127+
128+
ColumnLayout { // Vertical Widget
129+
id: contentVertical
130+
visible: root.isBarVertical
131+
anchors.centerIn: parent
132+
spacing: Style.marginS
133+
NText { // Count
134+
visible: !root.pluginApi.mainInstance.refreshing
135+
text: (root.pluginApi.mainInstance.updateCount + root.pluginApi.mainInstance.flatpakCount).toString()
136+
color: mouseArea.containsMouse ? Color.mOnHover : (root.pluginApi.mainInstance.noctaliaUpdate ? Color.mSecondary : Color.mOnSurface)
137+
pointSize: root.barFontSize
138+
applyUiScale: false
139+
font.weight: root.boldText ? Font.Bold : Font.Normal
140+
}
141+
NIcon { // Theme icon
142+
visible: !root.pluginApi.mainInstance.refreshing && root.customIconPath === "" && !root.useDistroLogo
143+
color: mouseArea.containsMouse ? Color.mOnHover : (root.pluginApi.mainInstance.noctaliaUpdate ? Color.mHover : root.iconColor)
144+
icon: (root.pluginApi.mainInstance.noctaliaUpdate | mouseArea.containsMouse) ? root.iconName + "-filled" : root.iconName
145+
}
146+
IconImage { // Custom file or distro logo
147+
visible: !root.pluginApi.mainInstance.refreshing && (root.useDistroLogo || root.customIconPath !== "")
148+
Layout.preferredWidth: root.capsuleHeight * 0.6
149+
Layout.preferredHeight: root.capsuleHeight * 0.6
150+
source: {
151+
if (root.useDistroLogo) return HostService.osLogo
152+
if (root.customIconPath !== "") return root.customIconPath.startsWith("file://") ? root.customIconPath : "file://" + root.customIconPath
153+
return ""
154+
}
155+
smooth: true
156+
asynchronous: true
157+
layer.enabled: root.enableColorization && (root.useDistroLogo || root.customIconPath !== "")
158+
layer.effect: ShaderEffect {
159+
property color targetColor: mouseArea.containsMouse ? Color.mOnHover : root.iconColor
160+
property real colorizeMode: 2.0
161+
fragmentShader: Qt.resolvedUrl(Quickshell.shellDir + "/Shaders/qsb/appicon_colorize.frag.qsb")
162+
}
163+
}
164+
NIcon { // Loading spinner
165+
icon: "loader"
166+
color: mouseArea.containsMouse ? Color.mOnHover : Color.mOnSurfaceVariant
167+
visible: root.pluginApi.mainInstance.refreshing
168+
169+
RotationAnimator on rotation {
170+
running: root.pluginApi.mainInstance.refreshing
171+
from: 0
172+
to: 360
173+
duration: 1000
174+
loops: Animation.Infinite
175+
}
176+
}
118177
}
119178
}
120179
}
@@ -183,7 +242,9 @@ Item {
183242
}
184243
onEntered: {
185244
// Tooltip shows available updates for both system and flatpak
186-
TooltipService.show(root, (root.pluginApi.mainInstance.noctaliaUpdate ? pluginApi.tr("tooltip.noctaliaUpdates") : pluginApi.tr("tooltip.availableUpdates")) + "\n---------------\n" + (root.tooltipTextTrimmed !== root.tooltipText ? root.tooltipTextTrimmed + "\n..." : root.tooltipTextTrimmed), BarService.getTooltipDirection())
245+
if (pluginApi.pluginSettings.tooltip ?? pluginApi.manifest.metadata.defaultSettings.tooltip) {
246+
TooltipService.show(root, (root.pluginApi.mainInstance.noctaliaUpdate ? pluginApi.tr("tooltip.noctaliaUpdates") : pluginApi.tr("tooltip.availableUpdates")) + "\n---------------\n" + (root.tooltipTextTrimmed !== root.tooltipText ? root.tooltipTextTrimmed + "\n..." : root.tooltipTextTrimmed), BarService.getTooltipDirection(root.screen?.name))
247+
}
187248
}
188249

189250
onExited: {

arch-updater/DesktopWidget.qml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,15 @@ DraggableDesktopWidget {
9292
width: tableView.width
9393
spacing: Style.marginS
9494

95-
NText {
95+
NText { // Name
9696
Layout.preferredWidth: 0.4 * root.tableContentWidth
9797
text: modelData.name
9898
pointSize: Style.fontSizeM
9999
color: modelData.isFlatpak ? Color.mTertiary : Color.mSecondary
100100
elide: Text.ElideRight
101101
maximumLineCount: 1
102102
}
103-
NText {
103+
NText { // Old Version
104104
Layout.preferredWidth: 0.3 * root.tableContentWidth
105105
text: modelData.oldVer
106106
pointSize: Style.fontSizeM
@@ -109,18 +109,17 @@ DraggableDesktopWidget {
109109
elide: Text.ElideRight
110110
maximumLineCount: 1
111111
}
112-
NText {
112+
NText { // New Version
113113
Layout.preferredWidth: 0.3 * root.tableContentWidth
114114
text: modelData.newVer
115115
pointSize: Style.fontSizeM
116+
font.weight: (pluginApi.pluginSettings.boldVer ?? pluginApi.manifest.metadata.defaultSettings.boldVer) ? Font.Bold : Font.Normal
116117
color: modelData.isFlatpak ? Color.mTertiary : Color.mSecondary
117118
horizontalAlignment: Text.AlignHCenter
118119
elide: Text.ElideRight
119120
maximumLineCount: 1
120121
}
121122
}
122-
123-
ScrollBar.vertical: ScrollBar {}
124123
}
125124
}
126125

@@ -164,6 +163,7 @@ DraggableDesktopWidget {
164163
onClicked: (mouse) => {
165164
if (mouse.button === Qt.LeftButton) {
166165
Logger.d("Update Widget", "Refreshing from desktop widget...")
166+
mouseArea.visible = false
167167
root.pluginApi.mainInstance.refresh()
168168
}
169169
else if (mouse.button === Qt.MiddleButton) {

arch-updater/Panel.qml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ Item {
3838
RowLayout {
3939
Layout.fillWidth: true
4040
Layout.leftMargin: Style.marginS
41-
Layout.rightMargin: Style.marginS
4241
spacing: Style.marginS
4342

4443
NText {
@@ -87,15 +86,15 @@ Item {
8786
width: tableView.width
8887
spacing: Style.marginS
8988

90-
NText {
89+
NText { // Name
9190
Layout.preferredWidth: 0.4 * root.tableContentWidth
9291
text: modelData.name
9392
pointSize: Style.fontSizeM
9493
color: modelData.isFlatpak ? Color.mTertiary : Color.mSecondary
9594
elide: Text.ElideRight
9695
maximumLineCount: 1
9796
}
98-
NText {
97+
NText { // Old Version
9998
Layout.preferredWidth: 0.3 * root.tableContentWidth
10099
text: modelData.oldVer
101100
pointSize: Style.fontSizeM
@@ -104,24 +103,23 @@ Item {
104103
elide: Text.ElideRight
105104
maximumLineCount: 1
106105
}
107-
NText {
106+
NText { // New Version
108107
Layout.preferredWidth: 0.3 * root.tableContentWidth
109108
text: modelData.newVer
110109
pointSize: Style.fontSizeM
110+
font.weight: (pluginApi.pluginSettings.boldVer ?? pluginApi.manifest.metadata.defaultSettings.boldVer) ? Font.Bold : Font.Normal
111111
color: modelData.isFlatpak ? Color.mTertiary : Color.mSecondary
112112
horizontalAlignment: Text.AlignHCenter
113113
elide: Text.ElideRight
114114
maximumLineCount: 1
115115
}
116116
}
117-
118-
ScrollBar.vertical: ScrollBar {}
119117
}
120118
}
121119

122120
// Footer
123121
RowLayout {
124-
Layout.fillWidth: true
122+
spacing: Style.marginL
125123
NButton {
126124
Layout.fillWidth: true
127125
text: pluginApi?.tr("panel.refresh")
@@ -130,7 +128,6 @@ Item {
130128
root.pluginApi.mainInstance.refresh()
131129
}
132130
}
133-
Item { width: Style.marginM }
134131
NButton {
135132
Layout.fillWidth: true
136133
text: pluginApi?.tr("panel.update")
@@ -140,7 +137,6 @@ Item {
140137
pluginApi.closePanel(pluginApi.panelOpenScreen)
141138
}
142139
}
143-
Item { width: Style.marginM }
144140
NIconButton {
145141
icon: "settings"
146142
onClicked: {

arch-updater/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ With optional Flatpak support, highlight for Noctalia updates, a refresh timer,
3737
Settings UI allows for editing commands and changing toggles
3838

3939
## Requirements
40-
- The default commands require `paru`, `checkupdates`, `flatpak` and `ghostty` but you can edit them
40+
- The default commands require `paru`, `pacman-contrib`, `flatpak` and `ghostty` to be installed
4141
- Designed for Arch, although commands can be edited so it may be possible to make it work on other distros
4242
- CPU (Optional)
4343

0 commit comments

Comments
 (0)