nova-shell/modules/Bar.qml

135 lines
3.9 KiB
QML

import QtQuick
import QtQuick.Layouts
import Quickshell
import Quickshell.Wayland
import "." as M
PanelWindow {
id: bar
required property var screen
color: "transparent"
WlrLayershell.layer: WlrLayer.Bottom
anchors {
top: true
left: true
right: true
}
implicitHeight: M.Theme.barHeight
exclusiveZone: implicitHeight
Rectangle {
anchors.fill: parent
color: M.Theme.base00
opacity: M.Theme.barOpacity
}
Rectangle {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: 3
gradient: Gradient {
orientation: Gradient.Horizontal
GradientStop { position: 0; color: M.Theme.base0C }
GradientStop { position: 1; color: M.Theme.base09 }
}
}
Item {
anchors.fill: parent
anchors.leftMargin: M.Theme.barPadding
anchors.rightMargin: M.Theme.barPadding
// ---- center (declared first so left/right can anchor to it) ----
RowLayout {
id: centerSection
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
spacing: M.Theme.barSpacing
M.BarGroup {
borderColor: M.Theme.base0D
M.Clock { visible: M.Modules.clock.enable }
M.Notifications { visible: M.Modules.notifications.enable }
}
}
// ---- left ----
RowLayout {
anchors.left: parent.left
anchors.right: centerSection.left
anchors.verticalCenter: parent.verticalCenter
spacing: M.Theme.barSpacing
M.BarGroup {
borderColor: M.Theme.base0D
M.Workspaces { bar: bar; visible: M.Modules.workspaces.enable }
}
M.BarGroup {
borderColor: M.Theme.base0D
M.Tray { bar: bar; visible: M.Modules.tray.enable }
}
M.BarGroup {
borderColor: M.Theme.base0D
M.WindowTitle {
Layout.maximumWidth: 400
visible: M.Modules.windowTitle.enable
}
}
Item { Layout.fillWidth: true }
}
// ---- right ----
RowLayout {
anchors.left: centerSection.right
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
spacing: M.Theme.barSpacing
Item { Layout.fillWidth: true }
// Media
M.BarGroup {
borderColor: M.Theme.base0E
M.Mpris { bar: bar }
M.Volume { visible: M.Modules.volume.enable }
}
// Connectivity
M.BarGroup {
borderColor: M.Theme.base0D
M.Network { visible: M.Modules.network.enable }
M.Bluetooth {}
}
// Controls
M.BarGroup {
borderColor: M.Theme.base0A
M.Backlight {}
M.PowerProfile { visible: M.Modules.powerProfile.enable }
M.IdleInhibitor { visible: M.Modules.idleInhibitor.enable }
}
// Stats
M.BarGroup {
borderColor: M.Theme.base08
M.Cpu { visible: M.Modules.cpu.enable }
M.Memory { visible: M.Modules.memory.enable }
M.Temperature { visible: M.Modules.temperature.enable }
M.Weather { visible: M.Modules.weather.enable }
M.Disk { visible: M.Modules.disk.enable }
}
// Power
M.BarGroup {
borderColor: M.Theme.base08
M.Battery {}
M.Power { bar: bar; visible: M.Modules.power.enable }
}
}
}
}