Actually updated swayshell now (I updated the one of my friend and not my own lmao)
This commit is contained in:
parent
496b047425
commit
7e56692ce1
2 changed files with 286 additions and 285 deletions
|
|
@ -15,7 +15,7 @@ Rectangle {
|
||||||
Process {
|
Process {
|
||||||
id: cpuProc
|
id: cpuProc
|
||||||
command: ["sh", "-c", "head -1 /proc/stat"]
|
command: ["sh", "-c", "head -1 /proc/stat"]
|
||||||
property double cpuUsage
|
//property double cpuUsage
|
||||||
stdout: SplitParser {
|
stdout: SplitParser {
|
||||||
onRead: data => {
|
onRead: data => {
|
||||||
if (!data) {
|
if (!data) {
|
||||||
|
|
|
||||||
|
|
@ -12,336 +12,337 @@ import QtQuick.Layouts
|
||||||
// Some credit goes to my friends Lucy and Babsi
|
// Some credit goes to my friends Lucy and Babsi
|
||||||
// Zoe here, ignore the wide ass code, emacs qml-mode adds 2 on my tab-width for some reason
|
// Zoe here, ignore the wide ass code, emacs qml-mode adds 2 on my tab-width for some reason
|
||||||
|
|
||||||
PanelWindow {
|
Variants {
|
||||||
id: root
|
model: Quickshell.screens
|
||||||
|
delegate: WlrLayershell {
|
||||||
property color colBg: "#454545"
|
id: root
|
||||||
property color colAppBg: "#333333"
|
layer: WlrLayer.Top
|
||||||
property color colFg: "#ffffff"
|
required property ShellScreen modelData
|
||||||
property string fontFamily: "Hack Nerd Font"
|
screen: modelData
|
||||||
property int fontSize: 16
|
|
||||||
property int appletRadHeight: 25
|
|
||||||
property int appletSpacing: 6
|
|
||||||
|
|
||||||
|
|
||||||
property int cpuUsage: 0
|
|
||||||
property var lastCpuIdle: 0
|
|
||||||
property var lastCpuTotal: 0
|
|
||||||
property real ramUsage: 0.00
|
|
||||||
|
|
||||||
property var batCharMin: (UPower.displayDevice.timeToFull / 60).toFixed(2)
|
|
||||||
property var batDisMin: (UPower.displayDevice.timeToEmpty / 60).toFixed(2)
|
|
||||||
property var batTime: 0
|
|
||||||
|
|
||||||
anchors {
|
|
||||||
right: true
|
|
||||||
left: true
|
|
||||||
top:true
|
|
||||||
}
|
|
||||||
|
|
||||||
color: "transparent"
|
|
||||||
implicitHeight: root.appletRadHeight + 5
|
|
||||||
margins {
|
|
||||||
right: 0 // 5
|
|
||||||
left: 0 // 5
|
|
||||||
top: 0 // 5
|
|
||||||
bottom: 0
|
|
||||||
}
|
|
||||||
Rectangle {
|
|
||||||
color: root.colBg
|
|
||||||
anchors.fill: parent
|
|
||||||
// radius: root.appletRadHeight
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
id: leftRow
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.left: parent.left
|
|
||||||
Item {
|
|
||||||
id: rootItem
|
|
||||||
implicitWidth: root.appletRadHeight
|
|
||||||
height: root.appletRadHeight
|
|
||||||
Row {
|
|
||||||
id: workspaceRow
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.left: parent.left
|
|
||||||
leftPadding: 10
|
|
||||||
|
|
||||||
Repeater {
|
|
||||||
id: wsRepeater
|
|
||||||
model: I3.workspaces
|
|
||||||
anchors.centerIn: parent
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: workspaceNumber
|
|
||||||
property bool isOnMon: {
|
|
||||||
if (!modelData)
|
|
||||||
return false
|
|
||||||
if (!modelData.monitor)
|
|
||||||
return false
|
|
||||||
if (!rootItem.screen)
|
|
||||||
return false;
|
|
||||||
return modelData.monitor.name === rootItem.screen.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
required property var modelData
|
|
||||||
height: root.appletRadHeight * 1.1
|
|
||||||
width: root.appletRadHeight * 1.1
|
|
||||||
radius: root.appletRadHeight
|
|
||||||
color: root.colAppBg
|
|
||||||
Text {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
text: parent.modelData.number
|
|
||||||
color: root.colFg
|
|
||||||
opacity: workspaceNumber.modelData.focused ? 1 : 0.5
|
|
||||||
font { family: root.fontFamily; pixelSize: root.fontSize; bold: true }
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
onClicked: {parent.modelData.activate();}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
RowLayout {
|
|
||||||
id: centerRow
|
|
||||||
spacing: root.appletSpacing
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
RowLayout {
|
|
||||||
id: rightRow
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
spacing: root.appletSpacing
|
|
||||||
|
|
||||||
Item {
|
readonly property color colBg: "#3c1450"
|
||||||
Process {
|
readonly property color colAppBg: "#1e0a28"
|
||||||
id: cpuProc
|
readonly property color colFg: "#d2d2d2"
|
||||||
command: ["sh", "-c", "head -1 /proc/stat"]
|
readonly property color colDark: "#230f05"
|
||||||
stdout: SplitParser {
|
readonly property string fontFamily: "Iosevka"
|
||||||
onRead: data => {
|
readonly property int fontSize: 18
|
||||||
if (!data) return
|
readonly property int appletRadHeight: 25
|
||||||
var p = data.trim().split(/\s+/)
|
readonly property int appletSpacing: 6
|
||||||
var idle = parseInt(p[4]) + parseInt(p[5])
|
|
||||||
var total = p.slice(1, 8).reduce((a, b) => a + parseInt(b), 0)
|
property real lastCpuTotal: 0.0
|
||||||
if (lastCpuTotal > 0) {
|
property real lastCpuIdle: 0.0
|
||||||
cpuUsage = Math.round(100 * (1 - (idle - lastCpuIdle) / (total - lastCpuTotal)))
|
property real cpuUsage
|
||||||
}
|
|
||||||
lastCpuTotal = total
|
property real ramUsage: 0.00
|
||||||
lastCpuIdle = idle
|
|
||||||
}
|
property var batCharMin: (UPower.displayDevice.timeToFull / 60).toFixed(2)
|
||||||
}
|
property var batDisMin: (UPower.displayDevice.timeToEmpty / 60).toFixed(2)
|
||||||
Component.onCompleted: running = true
|
property var batTime: 0
|
||||||
}
|
|
||||||
|
anchors {
|
||||||
|
right: true
|
||||||
|
left: true
|
||||||
|
top:true
|
||||||
|
}
|
||||||
|
|
||||||
|
color: "transparent"
|
||||||
|
implicitHeight: root.appletRadHeight + 10
|
||||||
|
margins {
|
||||||
|
right: 5
|
||||||
|
left: 5
|
||||||
|
top: 5
|
||||||
|
bottom: 0
|
||||||
|
}
|
||||||
|
Rectangle {
|
||||||
|
id: barRect
|
||||||
|
color: root.colBg
|
||||||
|
anchors.fill: parent
|
||||||
|
radius: root.appletRadHeight
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
id: leftRow
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.left: parent.left
|
||||||
|
spacing: root.appletSpacing
|
||||||
|
|
||||||
Process {
|
Loader {
|
||||||
id: ramProc
|
id: batLoader
|
||||||
command: ["sh", "-c", "free | grep Mem"]
|
active: true
|
||||||
stdout: SplitParser {
|
Layout.leftMargin: 8
|
||||||
onRead: data => {
|
sourceComponent: Rectangle {
|
||||||
if (!data) return
|
id: batRect
|
||||||
var parts = data.trim().split(/\s+/)
|
clip: true
|
||||||
var used = parseInt(parts[2]) || 0
|
color: root.colAppBg
|
||||||
ramUsage = used /1048576
|
visible: UPower.displayDevice.isPresent
|
||||||
}
|
implicitHeight: root.appletRadHeight
|
||||||
}
|
implicitWidth: batText.implicitWidth + 25
|
||||||
Component.onCompleted: running = true
|
radius: root.appletRadHeight
|
||||||
}
|
|
||||||
Timer {
|
|
||||||
interval: 2000
|
|
||||||
running: true
|
|
||||||
repeat: true
|
|
||||||
onTriggered: {
|
|
||||||
cpuProc.running = true
|
|
||||||
ramProc.running = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Item {
|
|
||||||
id: procItem
|
|
||||||
Row {
|
|
||||||
id: procRow
|
|
||||||
spacing: root.appletSpacing
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
leftPadding: 10
|
|
||||||
|
|
||||||
Loader {
|
function getBatStat() {
|
||||||
id: batLoader
|
if (UPower.displayDevice.state == UPowerDeviceState.Discharging) {
|
||||||
active: true
|
batTime = Math.floor(batDisMin / 60) + "h " + ((batDisMin - (Math.floor(batDisMin / 60) * 60)).toFixed(0)) + "min"
|
||||||
sourceComponent: Rectangle {
|
return batTime;
|
||||||
id: batRect
|
|
||||||
clip: true
|
|
||||||
color: root.colAppBg
|
|
||||||
visible: UPower.displayDevice.isPresent
|
|
||||||
implicitHeight: root.appletRadHeight
|
|
||||||
implicitWidth: batText.implicitWidth + 25
|
|
||||||
radius: root.appletRadHeight
|
|
||||||
|
|
||||||
function getBatStat() {
|
|
||||||
if (UPower.displayDevice.state == UPowerDeviceState.Discharging) {
|
|
||||||
batTime = Math.floor(batDisMin / 60) + "h " + ((batDisMin - (Math.floor(batDisMin / 60) * 60)).toFixed(0)) + "min"
|
|
||||||
return batTime;
|
|
||||||
}
|
|
||||||
if (UPower.displayDevice.state == UPowerDeviceState.Charging) {
|
|
||||||
batTime = Math.floor(batCharMin / 60) + "h " + ((batCharMin - (Math.floor(batCharMin / 60) * 60)).toFixed(0)) + "min"
|
|
||||||
return batTime;
|
|
||||||
}
|
|
||||||
if (UPower.displayDevice.state == UPowerDeviceState.FullyCharged) {
|
|
||||||
return "Full";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function batStatProc() {
|
|
||||||
return Math.round(UPower.displayDevice.percentage * 100) + "%";
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
id: batText
|
|
||||||
anchors.centerIn: parent
|
|
||||||
color: root.colFg
|
|
||||||
text: batStatProc() + " - " + getBatStat()
|
|
||||||
font { family: root.fontFamily; pixelSize: root.fontSize; bold: true }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (UPower.displayDevice.state == UPowerDeviceState.Charging) {
|
||||||
|
batTime = Math.floor(batCharMin / 60) + "h " + ((batCharMin - (Math.floor(batCharMin / 60) * 60)).toFixed(0)) + "min"
|
||||||
|
return batTime;
|
||||||
|
}
|
||||||
|
if (UPower.displayDevice.state == UPowerDeviceState.FullyCharged) {
|
||||||
|
return "Full";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function batStatProc() {
|
||||||
|
return Math.round(UPower.displayDevice.percentage * 100) + "%";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
Rectangle {
|
id: batText
|
||||||
height: root.appletRadHeight
|
anchors.centerIn: parent
|
||||||
width: cpuText.paintedWidth + 25
|
color: root.colFg
|
||||||
radius: root.appletRadHeight
|
text: batStatProc() + " - " + getBatStat()
|
||||||
color: root.colAppBg
|
font { family: root.fontFamily; pixelSize: root.fontSize; bold: true }
|
||||||
|
|
||||||
Text {
|
|
||||||
id: cpuText
|
|
||||||
anchors.centerIn: parent
|
|
||||||
text: "CPU: " + cpuUsage + "%"
|
|
||||||
color: root.colFg
|
|
||||||
font { family: root.fontFamily; pixelSize: root.fontSize; bold: true }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Rectangle {
|
|
||||||
height: root.appletRadHeight
|
|
||||||
width: ramText.paintedWidth + 28
|
|
||||||
radius: root.appletRadHeight
|
|
||||||
color: root.colAppBg
|
|
||||||
|
|
||||||
Text {
|
|
||||||
id: ramText
|
|
||||||
anchors.centerIn: parent
|
|
||||||
text: "RAM: " + ramUsage.toFixed(2) + " GiB"
|
|
||||||
color: root.colFg
|
|
||||||
font { family: root.fontFamily; pixelSize: root.fontSize; bold: true }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Rectangle {
|
|
||||||
id: pwRect
|
|
||||||
color: root.colAppBg
|
|
||||||
property PwNode defaultAudio: Pipewire.ready ? Pipewire.preferredDefaultAudioSink : null
|
|
||||||
property bool mute: Pipewire.ready ? defaultAudio?.audio.muted : null
|
|
||||||
radius: root.appletRadHeight
|
|
||||||
implicitHeight: root.appletRadHeight
|
|
||||||
implicitWidth: pwText.implicitWidth + 25
|
|
||||||
|
|
||||||
PwObjectTracker {
|
|
||||||
objects: [Pipewire.ready ? Pipewire.defaultAudioSink : null]
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: pavuLauncher
|
|
||||||
command: ["pavucontrol"]
|
|
||||||
running: false
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
id: pwText
|
|
||||||
anchors.centerIn: pwRect
|
|
||||||
color: root.colFg
|
|
||||||
opacity: pwRect.defaultAudio?.audio.muted ? 0.6 : 1.0
|
|
||||||
font { family: root.fontFamily; pixelSize: root.fontSize; bold: true }
|
|
||||||
text: pwRect.mute ? "MUT: " + Math.floor(pwRect.defaultAudio?.audio.volume * 100) + "%" : "VOL: " + Math.floor(pwRect.defaultAudio?.audio.volume * 100) + "%"
|
|
||||||
}
|
|
||||||
MouseArea {
|
|
||||||
id: clickHandler
|
|
||||||
hoverEnabled: true
|
|
||||||
acceptedButtons: Qt.LeftButton
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
anchors.fill: pwRect
|
|
||||||
onClicked: pavuLauncher.running = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Row {
|
|
||||||
id: clockRow
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: clockRect
|
id: cpuRect
|
||||||
clip: true
|
|
||||||
implicitHeight: root.appletRadHeight
|
|
||||||
implicitWidth: clockText.implicitWidth + 25
|
|
||||||
color: root.colAppBg
|
color: root.colAppBg
|
||||||
|
implicitHeight: root.appletRadHeight
|
||||||
|
implicitWidth: cpuText.width + 25
|
||||||
radius: root.appletRadHeight
|
radius: root.appletRadHeight
|
||||||
SystemClock {
|
Process {
|
||||||
id: clock
|
id: cpuProc
|
||||||
precision: SystemClock.Seconds
|
command: ["sh", "-c", "head -1 /proc/stat"]
|
||||||
|
stdout: SplitParser {
|
||||||
|
onRead: data => {
|
||||||
|
if (!data) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var p = data.trim().split(/\s+/);
|
||||||
|
var idle = parseInt(p[4]) + parseInt(p[5]);
|
||||||
|
var total = p.slice(1, 8).reduce((a, b) => a + parseInt(b), 0);
|
||||||
|
root.cpuUsage = Math.round(100 * (1 - (idle - root.lastCpuIdle) / (total - root.lastCpuTotal)));
|
||||||
|
root.lastCpuTotal = total;
|
||||||
|
root.lastCpuIdle = idle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Component.onCompleted: running = true
|
||||||
|
}
|
||||||
|
Timer {
|
||||||
|
id: cpuProcRestarter
|
||||||
|
interval: 2000
|
||||||
|
repeat: true
|
||||||
|
running: true
|
||||||
|
onTriggered: cpuProc.running = true
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
id: clockText
|
id: cpuText
|
||||||
anchors.centerIn: clockRect
|
anchors.centerIn: parent
|
||||||
color: root.colFg
|
color: root.colFg
|
||||||
font { family: root.fontFamily; pixelSize: root.fontSize; bold: true }
|
font { family: root.fontFamily; pixelSize: root.fontSize; bold: true }
|
||||||
text: Qt.formatDateTime(clock.date, "yyyy.MM.dd - hh:mm:ss")
|
text: "CPU: " + root.cpuUsage + "%"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: ramRect
|
||||||
|
implicitHeight: root.appletRadHeight
|
||||||
|
radius: root.appletRadHeight
|
||||||
|
implicitWidth: ramText.width + 25
|
||||||
|
color: root.colAppBg
|
||||||
|
Process {
|
||||||
|
id: ramProc
|
||||||
|
command: ["sh", "-c", "free | grep Mem"]
|
||||||
|
running: true
|
||||||
|
stdout: SplitParser {
|
||||||
|
onRead: data => {
|
||||||
|
if (!data) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var parts = data.trim().split(/\s+/);
|
||||||
|
var used = parseInt(parts[2]) || 0;
|
||||||
|
root.ramUsage = used / 1048576;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Timer {
|
||||||
|
id: ramProcRestarter
|
||||||
|
interval: 2000
|
||||||
|
running: true
|
||||||
|
repeat: true
|
||||||
|
onTriggered: ramProc.running = true
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
id: ramText
|
||||||
|
anchors.centerIn: ramRect
|
||||||
|
text: "RAM: " + root.ramUsage.toFixed(2) + " GiB"
|
||||||
|
font { family: root.fontFamily; pixelSize: root.fontSize; bold: true }
|
||||||
|
color: root.colFg
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Row {
|
RowLayout {
|
||||||
id: trayWholeRow
|
id: centerRow
|
||||||
rightPadding: 10
|
anchors.centerIn: parent
|
||||||
Rectangle {
|
spacing: root.appletSpacing
|
||||||
id: trayRect
|
|
||||||
color: root.colAppBg
|
Item {
|
||||||
visible: iconRepeater.count != 0
|
id: wsItem
|
||||||
radius: root.appletRadHeight
|
implicitWidth: root.appletRadHeight
|
||||||
Layout.fillHeight: true
|
height: root.appletRadHeight
|
||||||
implicitHeight: root.appletRadHeight
|
Row {
|
||||||
implicitWidth: iconlayout.implicitWidth + 16
|
id: workspaceRow
|
||||||
|
anchors.centerIn: parent
|
||||||
RowLayout {
|
leftPadding: 10
|
||||||
id: iconlayout
|
|
||||||
anchors.centerIn: trayRect
|
|
||||||
Repeater {
|
Repeater {
|
||||||
id: iconRepeater
|
id: wsRepeater
|
||||||
model: SystemTray.items
|
model: I3.workspaces
|
||||||
delegate: WrapperMouseArea {
|
anchors.centerIn: parent
|
||||||
id: iconWrapper
|
|
||||||
|
Rectangle {
|
||||||
|
id: workspaceNumber
|
||||||
|
property bool isOnMon: {
|
||||||
|
if (!modelData)
|
||||||
|
return false
|
||||||
|
if (!modelData.monitor)
|
||||||
|
return false
|
||||||
|
if (!wsItem.screen)
|
||||||
|
return false;
|
||||||
|
return modelData.monitor.name === wsItem.screen.name;
|
||||||
|
}
|
||||||
|
|
||||||
required property var modelData
|
required property var modelData
|
||||||
child: IconImage {
|
height: root.appletRadHeight * 1.1
|
||||||
source: iconWrapper.modelData.icon
|
width: root.appletRadHeight * 1.1
|
||||||
implicitSize: 16
|
radius: root.appletRadHeight
|
||||||
|
color: root.colAppBg
|
||||||
|
Text {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: parent.modelData.number
|
||||||
|
color: root.colFg
|
||||||
|
opacity: workspaceNumber.modelData.focused ? 1 : 0.5
|
||||||
|
font { family: root.fontFamily; pixelSize: root.fontSize; bold: true }
|
||||||
}
|
}
|
||||||
QsMenuAnchor {
|
|
||||||
id: menu
|
MouseArea {
|
||||||
anchor.item: iconWrapper
|
anchors.fill: parent
|
||||||
menu: modelData.menu
|
onClicked: {parent.modelData.activate();}
|
||||||
}
|
}
|
||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
}
|
||||||
onClicked: mouse => {
|
}
|
||||||
if (mouse.button == Qt.RightButton) {
|
}
|
||||||
menu.open();
|
}
|
||||||
|
}
|
||||||
|
RowLayout {
|
||||||
|
id: rightRow
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: root.appletSpacing
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: trayWholeRow
|
||||||
|
Rectangle {
|
||||||
|
id: trayRect
|
||||||
|
color: root.colAppBg
|
||||||
|
visible: iconRepeater.count != 0
|
||||||
|
radius: root.appletRadHeight
|
||||||
|
Layout.fillHeight: true
|
||||||
|
implicitHeight: root.appletRadHeight
|
||||||
|
implicitWidth: iconlayout.implicitWidth + 16
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
id: iconlayout
|
||||||
|
anchors.centerIn: trayRect
|
||||||
|
Repeater {
|
||||||
|
id: iconRepeater
|
||||||
|
model: SystemTray.items
|
||||||
|
delegate: WrapperMouseArea {
|
||||||
|
id: iconWrapper
|
||||||
|
required property var modelData
|
||||||
|
child: IconImage {
|
||||||
|
source: iconWrapper.modelData.icon
|
||||||
|
implicitSize: 16
|
||||||
|
}
|
||||||
|
QsMenuAnchor {
|
||||||
|
id: menu
|
||||||
|
anchor.item: iconWrapper
|
||||||
|
menu: modelData.menu
|
||||||
|
}
|
||||||
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
|
onClicked: mouse => {
|
||||||
|
if (mouse.button == Qt.RightButton) {
|
||||||
|
menu.open();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Rectangle {
|
||||||
|
id: pwRect
|
||||||
|
color: root.colAppBg
|
||||||
|
property PwNode defaultAudio: Pipewire.ready ? Pipewire.preferredDefaultAudioSink : null
|
||||||
|
property bool mute: Pipewire.ready ? defaultAudio?.audio.muted : null
|
||||||
|
radius: root.appletRadHeight
|
||||||
|
implicitHeight: root.appletRadHeight
|
||||||
|
implicitWidth: pwText.implicitWidth + 25
|
||||||
|
|
||||||
|
PwObjectTracker {
|
||||||
|
objects: [Pipewire.ready ? Pipewire.defaultAudioSink : null]
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: pavuLauncher
|
||||||
|
command: ["pavucontrol"]
|
||||||
|
running: false
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: pwText
|
||||||
|
anchors.centerIn: pwRect
|
||||||
|
color: root.colFg
|
||||||
|
opacity: pwRect.defaultAudio?.audio.muted ? 0.6 : 1.0
|
||||||
|
font { family: root.fontFamily; pixelSize: root.fontSize; bold: true }
|
||||||
|
text: pwRect.mute ? "MUT: " + Math.floor(pwRect.defaultAudio?.audio.volume * 100) + "%" : "VOL: " + Math.floor(pwRect.defaultAudio?.audio.volume * 100) + "%"
|
||||||
|
}
|
||||||
|
MouseArea {
|
||||||
|
id: clickHandler
|
||||||
|
hoverEnabled: true
|
||||||
|
acceptedButtons: Qt.LeftButton
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
anchors.fill: pwRect
|
||||||
|
onClicked: pavuLauncher.running = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: clockRow
|
||||||
|
Layout.rightMargin: 8
|
||||||
|
Rectangle {
|
||||||
|
id: clockRect
|
||||||
|
clip: true
|
||||||
|
implicitHeight: root.appletRadHeight
|
||||||
|
implicitWidth: clockText.implicitWidth + 25
|
||||||
|
color: root.colAppBg
|
||||||
|
radius: root.appletRadHeight
|
||||||
|
SystemClock {
|
||||||
|
id: clock
|
||||||
|
precision: SystemClock.Seconds
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
id: clockText
|
||||||
|
anchors.centerIn: clockRect
|
||||||
|
color: root.colFg
|
||||||
|
font { family: root.fontFamily; pixelSize: root.fontSize; bold: true }
|
||||||
|
text: Qt.formatDateTime(clock.date, "yyyy.MM.dd - hh:mm:ss")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue