refactor: unified BarModule base component, click-to-open panels, remove pinning
This commit is contained in:
parent
034f0b6d85
commit
26476dc930
33 changed files with 273 additions and 517 deletions
|
|
@ -4,12 +4,12 @@ import "." as M
|
|||
import "../services" as S
|
||||
import "../applets" as C
|
||||
|
||||
M.PinnableSection {
|
||||
M.BarModule {
|
||||
id: root
|
||||
spacing: S.Theme.moduleSpacing
|
||||
opacity: S.Modules.battery.enable && S.BatteryService.available ? 1 : 0
|
||||
visible: opacity > 0
|
||||
_panelHovered: hoverPanel.panelHovered
|
||||
tooltip: "Battery: " + Math.round(S.BatteryService.percent) + "%" + (S.BatteryService.charging ? " (charging)" : "")
|
||||
|
||||
property real _blinkOpacity: 1
|
||||
|
||||
|
|
@ -18,7 +18,6 @@ M.PinnableSection {
|
|||
minOpacity: 0.45
|
||||
}
|
||||
|
||||
// Bar widgets
|
||||
M.BarIcon {
|
||||
icon: {
|
||||
if (S.BatteryService.charging)
|
||||
|
|
@ -30,9 +29,6 @@ M.PinnableSection {
|
|||
opacity: root._blinkOpacity
|
||||
font.pixelSize: S.Theme.fontSize + 2
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
TapHandler {
|
||||
onTapped: root._pinned = !root._pinned
|
||||
}
|
||||
}
|
||||
M.BarLabel {
|
||||
label: Math.round(S.BatteryService.percent) + "%"
|
||||
|
|
@ -40,12 +36,8 @@ M.PinnableSection {
|
|||
color: S.BatteryService.stateColor
|
||||
opacity: root._blinkOpacity
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
TapHandler {
|
||||
onTapped: root._pinned = !root._pinned
|
||||
}
|
||||
}
|
||||
|
||||
// Hover panel
|
||||
M.HoverPanel {
|
||||
id: hoverPanel
|
||||
showPanel: root._showPanel
|
||||
|
|
@ -55,6 +47,7 @@ M.PinnableSection {
|
|||
panelNamespace: "nova-battery"
|
||||
panelTitle: "Battery"
|
||||
contentWidth: 240
|
||||
onDismissed: root.dismissPanel()
|
||||
|
||||
C.BatteryApplet {
|
||||
width: hoverPanel.contentWidth
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue