added adaptive quickshell
This commit is contained in:
1 parent
6eb56d2065
commit
5b33a73fd8
189 files changed
+8678
-15
No files matched your search
@@ -0,0 +1,138 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Services.SystemTray
|
||||
import "services"
|
||||
import "components"
|
||||
|
||||
PanelWindow {
|
||||
id: bar
|
||||
signal navigate(string name)
|
||||
readonly property string mode: Preferences.modeFor(screen)
|
||||
anchors { top: true; left: true; right: true }
|
||||
implicitHeight: mode === "desktop" ? 56 : 52
|
||||
color: Theme.surfaceLow
|
||||
WlrLayershell.namespace: "adaptive-bar"
|
||||
SystemClock { id: clock; precision: SystemClock.Minutes }
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 8
|
||||
anchors.rightMargin: 8
|
||||
spacing: 4
|
||||
ActionButton { text: bar.mode === "phone" ? "☰" : "◈ Приложения"; onClicked: bar.navigate("launcher") }
|
||||
Repeater {
|
||||
model: bar.mode === "desktop" ? Hyprland.workspaces : null
|
||||
ActionButton {
|
||||
required property var modelData
|
||||
visible: modelData.id > 0 && (!modelData.monitor || modelData.monitor.name === bar.screen.name)
|
||||
text: modelData.name
|
||||
checked: modelData.active
|
||||
onClicked: modelData.activate()
|
||||
}
|
||||
}
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
visible: bar.mode === "desktop"
|
||||
text: Hyprland.activeToplevel?.title || ""
|
||||
color: Theme.foreground
|
||||
elide: Text.ElideRight
|
||||
textFormat: Text.PlainText
|
||||
}
|
||||
Item { Layout.fillWidth: true; visible: bar.mode !== "desktop" }
|
||||
Repeater {
|
||||
model: bar.mode === "desktop" ? SystemTray.items : null
|
||||
ActionButton {
|
||||
required property var modelData
|
||||
implicitWidth: 48
|
||||
text: ""
|
||||
Image { anchors.centerIn: parent; width: 24; height: 24; source: modelData.icon }
|
||||
onClicked: modelData.onlyMenu ? modelData.display(bar, 0, bar.height) : modelData.activate()
|
||||
onPressAndHold: modelData.display(bar, 0, bar.height)
|
||||
}
|
||||
}
|
||||
// One unified status surface, not a pill containing multiple pill buttons.
|
||||
// The previous nested ActionButtons caused overlapping circles at small widths.
|
||||
Rectangle {
|
||||
id: statusSurface
|
||||
visible: bar.mode === "desktop"
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.preferredHeight: 38
|
||||
Layout.preferredWidth: statusContent.implicitWidth + 24
|
||||
radius: 19
|
||||
color: statusMouse.containsMouse ? Theme.surfaceHigh : Theme.surface
|
||||
border.width: 1
|
||||
border.color: Theme.outline
|
||||
|
||||
Behavior on color { ColorAnimation { duration: Theme.duration } }
|
||||
RowLayout {
|
||||
id: statusContent
|
||||
anchors.centerIn: parent
|
||||
spacing: 10
|
||||
Text {
|
||||
visible: Hardware.wiredPresent || Hardware.wifiPresent
|
||||
text: Hardware.wiredPresent ? "⇄" : "◉"
|
||||
font.pixelSize: 16
|
||||
color: Theme.foreground
|
||||
Accessible.name: Hardware.wiredPresent ? Hardware.ethernetSummary : "Wi-Fi"
|
||||
}
|
||||
Text {
|
||||
visible: Hardware.sink !== null
|
||||
text: Hardware.sink?.audio?.muted ? "◌" : "♫"
|
||||
font.pixelSize: 15
|
||||
color: Theme.foreground
|
||||
}
|
||||
Repeater {
|
||||
model: Hardware.batteries
|
||||
Text {
|
||||
required property var modelData
|
||||
text: Math.round(modelData.percentage * 100) + "%"
|
||||
color: Theme.foreground
|
||||
font.pixelSize: 12
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
visible: Hardware.wiredPresent || Hardware.wifiPresent || Hardware.sink !== null || Hardware.batteries.length > 0
|
||||
width: 1
|
||||
height: 18
|
||||
color: Theme.outline
|
||||
opacity: 0.45
|
||||
}
|
||||
Text {
|
||||
text: Qt.formatDateTime(clock.date, "HH:mm")
|
||||
color: Theme.foreground
|
||||
font.pixelSize: 14
|
||||
font.weight: Font.DemiBold
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
id: statusMouse
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: bar.navigate("quick")
|
||||
}
|
||||
}
|
||||
ActionButton {
|
||||
visible: bar.mode !== "desktop" && (Hardware.wiredPresent || Hardware.wifiPresent)
|
||||
text: "◉"
|
||||
onClicked: bar.navigate("quick")
|
||||
}
|
||||
ActionButton {
|
||||
visible: bar.mode !== "desktop"
|
||||
text: Qt.formatDateTime(clock.date, "HH:mm")
|
||||
onClicked: bar.navigate("quick")
|
||||
}
|
||||
ActionButton {
|
||||
implicitWidth: 42
|
||||
implicitHeight: 38
|
||||
text: Notifications.items.length > 0 ? "● " + Notifications.items.length : "◌"
|
||||
Accessible.name: "Уведомления"
|
||||
onClicked: bar.navigate("notifications")
|
||||
}
|
||||
ActionButton { visible: bar.mode === "desktop"; implicitWidth: 42; implicitHeight: 38; text: "⚙"; Accessible.name: "Настройки"; onClicked: bar.navigate("settings") }
|
||||
ActionButton { visible: bar.mode === "desktop"; implicitWidth: 42; implicitHeight: 38; text: "⏻"; Accessible.name: "Питание"; onClicked: bar.navigate("power") }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user