227 lines
5.8 KiB
QML
227 lines
5.8 KiB
QML
import Quickshell
|
|
import Quickshell.Hyprland
|
|
import Quickshell.Networking
|
|
import Quickshell.Io
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
|
|
Variants {
|
|
model: Quickshell.screens
|
|
PanelWindow {
|
|
anchors.top: true
|
|
anchors.left: true
|
|
anchors.bottom: true
|
|
width: BarSettings.barWidth
|
|
color: BarSettings.barBg
|
|
|
|
SystemClock {
|
|
id: clock
|
|
precision: SystemClock.Seconds
|
|
}
|
|
|
|
Timer {
|
|
interval: 5000
|
|
running: true
|
|
repeat: true
|
|
onTriggered: {
|
|
cpu_proc.running = true;
|
|
gpu_proc.running = true;
|
|
}
|
|
}
|
|
|
|
Process {
|
|
id: cpu_proc
|
|
command: ["hmon", "cpu"]
|
|
running: true
|
|
stdout: StdioCollector {
|
|
onStreamFinished: cpu_text.text = text
|
|
}
|
|
}
|
|
|
|
Process {
|
|
id: gpu_proc
|
|
command: ["hmon", "gpu"]
|
|
running: true
|
|
stdout: StdioCollector {
|
|
onStreamFinished: gpu_text.text = text
|
|
}
|
|
}
|
|
|
|
ColumnLayout {
|
|
id: workspaces
|
|
width: parent.width
|
|
anchors {
|
|
horizontalCenter: parent.horizontalCenter
|
|
}
|
|
|
|
height: 130
|
|
spacing: 1
|
|
|
|
Repeater {
|
|
model: 6
|
|
|
|
InfoBox {
|
|
property var ws: Hyprland.workspaces.values.find(w => w.id === index + 1)
|
|
property var isActive: Hyprland.focusedWorkspace?.id === (index + 1)
|
|
property var isUrgent: ws?.urgent ?? false
|
|
|
|
color: isActive ? BarSettings.infoBoxActive : isUrgent ? BarSettings.infoBoxUrgent : BarSettings.infoBoxBg
|
|
|
|
InfoText {
|
|
id: seconds_text
|
|
text: index + 1
|
|
color: parent.isActive ? BarSettings.infoTextActiveFg : BarSettings.infoTextFg
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
onClicked: Hyprland.dispatch("workspace " + (index + 1))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Separator {}
|
|
|
|
InfoBox {
|
|
InfoText {
|
|
text: "c"
|
|
}
|
|
}
|
|
|
|
InfoBox {
|
|
InfoText {
|
|
id: cpu_text
|
|
}
|
|
}
|
|
|
|
InfoBox {
|
|
InfoText {
|
|
text: "g"
|
|
}
|
|
}
|
|
|
|
InfoBox {
|
|
InfoText {
|
|
id: gpu_text
|
|
}
|
|
}
|
|
|
|
Separator {}
|
|
|
|
InfoBox {
|
|
InfoText {
|
|
text: "ᛒ"
|
|
font.pixelSize: 15
|
|
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
onClicked: Quickshell.execDetached("blueberry")
|
|
cursorShape: Qt.PointingHandCursor
|
|
}
|
|
}
|
|
}
|
|
|
|
InfoBox {
|
|
InfoText {
|
|
text: "🕪"
|
|
font.pixelSize: 13
|
|
}
|
|
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
onClicked: Quickshell.execDetached("pavucontrol")
|
|
cursorShape: Qt.PointingHandCursor
|
|
}
|
|
}
|
|
|
|
Separator {}
|
|
|
|
InfoBox {
|
|
InfoText {
|
|
text: Networking.connectivity == 4 ? "🌍" : "🚫"
|
|
NetworkClick {}
|
|
}
|
|
}
|
|
|
|
InfoBox {
|
|
InfoText {
|
|
text: Networking.devices.values.find(n => n.type == 2).connected ? "🖧" : "🚫"
|
|
NetworkClick {}
|
|
}
|
|
}
|
|
|
|
InfoBox {
|
|
InfoText {
|
|
text: Networking.devices.values.find(n => n.type == 1).connected ? "ᯤ" : "🚫"
|
|
NetworkClick {}
|
|
}
|
|
}
|
|
}
|
|
|
|
ColumnLayout {
|
|
anchors {
|
|
bottom: parent.bottom
|
|
horizontalCenter: parent.horizontalCenter
|
|
bottomMargin: 8
|
|
}
|
|
|
|
spacing: 5
|
|
|
|
InfoBox {
|
|
InfoText {
|
|
text: "vpn"
|
|
font.pixelSize: 10
|
|
}
|
|
}
|
|
|
|
InfoBox {
|
|
InfoText {
|
|
text: "on"
|
|
font.pixelSize: 10
|
|
color: "green"
|
|
}
|
|
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
onClicked: Quickshell.execDetached(["kitty", "-e", "vpn_on"])
|
|
cursorShape: Qt.PointingHandCursor
|
|
}
|
|
}
|
|
|
|
InfoBox {
|
|
InfoText {
|
|
text: "off"
|
|
font.pixelSize: 10
|
|
color: "brown"
|
|
}
|
|
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
onClicked: Quickshell.execDetached(["kitty", "-e", "vpn_off"])
|
|
cursorShape: Qt.PointingHandCursor
|
|
}
|
|
}
|
|
|
|
Separator {}
|
|
|
|
Repeater {
|
|
model: Qt.formatDateTime(clock.date, "hh:mm").split(":")
|
|
InfoBox {
|
|
InfoText {
|
|
text: modelData
|
|
}
|
|
}
|
|
}
|
|
|
|
InfoBox {
|
|
color: "black"
|
|
InfoText {
|
|
property var ss: Qt.formatDateTime(clock.date, "ss")
|
|
|
|
text: ss
|
|
color: "white"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|