2026-02-14 12:33:31 +01:00
|
|
|
pragma ComponentBehavior: Bound
|
|
|
|
|
import Quickshell
|
|
|
|
|
import Quickshell.Io
|
|
|
|
|
import Quickshell.Services.Pipewire
|
|
|
|
|
import Quickshell.Networking
|
|
|
|
|
import Quickshell.Services.UPower
|
|
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
import qs
|
|
|
|
|
import qs.reusables
|
|
|
|
|
import qs.settings
|
2026-02-15 13:50:23 +01:00
|
|
|
import "functions.js" as Fn
|
2026-02-14 12:33:31 +01:00
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: root
|
2026-02-15 13:50:23 +01:00
|
|
|
implicitWidth: statusLayout.implicitWidth + 20
|
2026-02-14 12:33:31 +01:00
|
|
|
implicitHeight: Settings.config.barHeight - 10
|
|
|
|
|
color: Colors.surfaceContainer
|
|
|
|
|
radius: implicitHeight / 2
|
2026-02-15 13:50:23 +01:00
|
|
|
required property var barWindow
|
|
|
|
|
required property var barContainer
|
|
|
|
|
required property var margin
|
2026-02-14 12:33:31 +01:00
|
|
|
property var sink: Pipewire.defaultAudioSink
|
|
|
|
|
property var sinkReady: Pipewire.defaultAudioSink.ready
|
|
|
|
|
property var bat: UPower.displayDevice
|
2026-02-15 13:50:23 +01:00
|
|
|
property var perc: UPower.displayDevice.percentage
|
|
|
|
|
property var vol: Math.floor(Pipewire.defaultAudioSink.audio.volume * 100)
|
2026-02-14 12:33:31 +01:00
|
|
|
Process {
|
|
|
|
|
id: lowBat
|
|
|
|
|
running: false
|
|
|
|
|
command: ["sh", "-c", "notify-send", "'Low battery!'", "'Plug in your device!'"]
|
|
|
|
|
}
|
2026-02-15 13:50:23 +01:00
|
|
|
PopupWindow {
|
|
|
|
|
id: batPopup
|
|
|
|
|
property string popupText
|
|
|
|
|
implicitWidth: root.width + 5
|
|
|
|
|
implicitHeight: 30
|
|
|
|
|
anchor.window: root.barWindow
|
|
|
|
|
anchor.rect.y: root.barContainer.height + 5
|
|
|
|
|
anchor.rect.x: root.barContainer.width - root.width - root.margin
|
|
|
|
|
color: "transparent"
|
|
|
|
|
Rectangle {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
color: Colors.surfaceContainer
|
|
|
|
|
border.width: 5
|
|
|
|
|
border.color: Colors.surface
|
|
|
|
|
radius: Settings.config.floating ? height / 2 : Settings.config.screenCornerRadius
|
2026-02-14 12:33:31 +01:00
|
|
|
|
2026-02-15 13:50:23 +01:00
|
|
|
CustomText {
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
text: batPopup.popupText
|
2026-02-14 12:33:31 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
|
id: statusLayout
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
spacing: 10
|
|
|
|
|
CustomIcon {
|
|
|
|
|
id: volumeIcon
|
|
|
|
|
Layout.alignment: Qt.AlignVCenter
|
|
|
|
|
PwObjectTracker {
|
|
|
|
|
objects: Pipewire.ready ? Pipewire.defaultAudioSink : []
|
|
|
|
|
}
|
2026-02-15 13:50:23 +01:00
|
|
|
text: Fn.getVolumeIcon()
|
2026-02-14 12:33:31 +01:00
|
|
|
MouseArea {
|
|
|
|
|
id: pavuArea
|
|
|
|
|
Process {
|
|
|
|
|
id: pavuLauncher
|
|
|
|
|
command: ["sh", "-c", "pavucontrol"]
|
|
|
|
|
}
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
onClicked: pavuLauncher.exec(pavuLauncher.command)
|
|
|
|
|
acceptedButtons: Qt.LeftButton
|
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
|
hoverEnabled: true
|
2026-02-15 13:50:23 +01:00
|
|
|
onEntered: {
|
|
|
|
|
batPopup.visible = true;
|
2026-02-20 15:43:31 +01:00
|
|
|
batPopup.popupText = "Vol " + root.vol + "%";
|
2026-02-15 13:50:23 +01:00
|
|
|
}
|
|
|
|
|
onExited: {
|
|
|
|
|
batPopup.visible = false;
|
|
|
|
|
}
|
2026-02-14 12:33:31 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Repeater {
|
|
|
|
|
id: netRepeater
|
|
|
|
|
Layout.alignment: Qt.AlignVCenter
|
|
|
|
|
model: Networking.devices
|
|
|
|
|
|
|
|
|
|
delegate: CustomIcon {
|
|
|
|
|
id: netIcon
|
|
|
|
|
Layout.alignment: Qt.AlignVCenter
|
|
|
|
|
required property var modelData
|
2026-02-15 13:50:23 +01:00
|
|
|
text: Fn.getIcon(modelData)
|
2026-02-14 12:33:31 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
CustomIcon {
|
|
|
|
|
id: batIcon
|
|
|
|
|
Layout.alignment: Qt.AlignVCenter
|
2026-02-18 16:47:53 +01:00
|
|
|
visible: UPower.displayDevice.isLaptopBattery
|
2026-02-15 13:50:23 +01:00
|
|
|
text: Fn.getBatteryIcon(root.perc)
|
|
|
|
|
MouseArea {
|
|
|
|
|
id: batHover
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
acceptedButtons: Qt.LeftButton
|
|
|
|
|
hoverEnabled: true
|
|
|
|
|
onEntered: {
|
|
|
|
|
batPopup.visible = true;
|
|
|
|
|
batPopup.popupText = "Battery: " + Math.floor(UPower.displayDevice.percentage * 100) + "%";
|
|
|
|
|
}
|
|
|
|
|
onExited: {
|
|
|
|
|
batPopup.visible = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-02-14 12:33:31 +01:00
|
|
|
}
|
|
|
|
|
CustomIcon {
|
|
|
|
|
id: settingsIcon
|
|
|
|
|
text: "settings"
|
|
|
|
|
MouseArea {
|
|
|
|
|
id: settingsArea
|
|
|
|
|
anchors.fill: settingsIcon
|
|
|
|
|
onClicked: {
|
|
|
|
|
Settings.config.settingsShown = true;
|
|
|
|
|
}
|
|
|
|
|
acceptedButtons: Qt.LeftButton
|
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
|
hoverEnabled: true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|