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
|
|
@ -3,39 +3,40 @@ import Quickshell
|
|||
import Quickshell.Io
|
||||
import "." as M
|
||||
import "../services" as S
|
||||
import "../applets" as C
|
||||
|
||||
M.BarIcon {
|
||||
M.BarModule {
|
||||
id: root
|
||||
icon: "\uF011"
|
||||
tooltip: "Power menu"
|
||||
|
||||
required property var bar
|
||||
|
||||
Process {
|
||||
id: runner
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
menuLoader.active = !menuLoader.active;
|
||||
M.TooltipState.visible = false;
|
||||
}
|
||||
M.BarIcon {
|
||||
icon: "\uF011"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
LazyLoader {
|
||||
id: menuLoader
|
||||
active: false
|
||||
M.PowerMenu {
|
||||
M.HoverPanel {
|
||||
id: hoverPanel
|
||||
showPanel: root._showPanel
|
||||
screen: QsWindow.window?.screen ?? null
|
||||
anchorItem: root
|
||||
accentColor: root.accentColor
|
||||
panelNamespace: "nova-power"
|
||||
panelTitle: "Power"
|
||||
contentWidth: 180
|
||||
onDismissed: root.dismissPanel()
|
||||
|
||||
C.PowerApplet {
|
||||
width: hoverPanel.contentWidth
|
||||
accentColor: root.accentColor
|
||||
screen: root.bar.screen
|
||||
anchorX: root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0)
|
||||
onDismissed: menuLoader.active = false
|
||||
onRunCommand: cmd => {
|
||||
runner.command = cmd;
|
||||
runner.running = true;
|
||||
}
|
||||
onDismiss: root.dismissPanel()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue