remove qs, fixes to waybar
This commit is contained in:
48
modules/home/services/quickshell/components/bar/Battery.qml
Normal file
48
modules/home/services/quickshell/components/bar/Battery.qml
Normal file
@@ -0,0 +1,48 @@
|
||||
import Quickshell
|
||||
import Quickshell.Services.UPower
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import org.kde.kirigami
|
||||
|
||||
Rectangle {
|
||||
id: bat
|
||||
|
||||
Layout.preferredWidth: batIcon.width
|
||||
Layout.fillHeight: true
|
||||
color: 'transparent'
|
||||
|
||||
readonly property var battery: UPower.displayDevice
|
||||
readonly property int percentage: Math.round(battery.percentage * 100)
|
||||
property var size: height * 0.4
|
||||
|
||||
visible: battery.isLaptopBattery
|
||||
|
||||
Icon {
|
||||
id: batIcon
|
||||
anchors.centerIn: parent
|
||||
|
||||
implicitHeight: bat.size
|
||||
implicitWidth: bat.size
|
||||
|
||||
// This recolors the entire svg, instead of only classless components.
|
||||
// Hopefully in the future classes can be selected for recoloring.
|
||||
isMask: true
|
||||
color: 'white'
|
||||
|
||||
source: {
|
||||
const nearestTen = Math.round(bat.percentage / 10) * 10;
|
||||
const number = nearestTen.toString().padStart(2, "0");
|
||||
let charging;
|
||||
|
||||
if (bat.battery.state == UPowerDeviceState.Charging) {
|
||||
charging = "-charging";
|
||||
} else if (bat.battery.state.toString() == UPowerDeviceState.FullyCharged) {
|
||||
charging = "-charged";
|
||||
} else {
|
||||
charging = "";
|
||||
}
|
||||
|
||||
return Quickshell.iconPath(`battery-level-${number}${charging}-symbolic`);
|
||||
}
|
||||
}
|
||||
}
|
||||
16
modules/home/services/quickshell/components/bar/Clock.qml
Normal file
16
modules/home/services/quickshell/components/bar/Clock.qml
Normal file
@@ -0,0 +1,16 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import "../../utils"
|
||||
|
||||
Rectangle {
|
||||
Layout.fillHeight: true
|
||||
color: "transparent"
|
||||
implicitWidth: clockText.width
|
||||
|
||||
Text {
|
||||
id: clockText
|
||||
text: Time.time
|
||||
color: Colors.fg
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
14
modules/home/services/quickshell/components/bar/Mpris.qml
Normal file
14
modules/home/services/quickshell/components/bar/Mpris.qml
Normal file
@@ -0,0 +1,14 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
Rectangle {
|
||||
Layout.fillHeight: true
|
||||
color: "salmon"
|
||||
implicitWidth: mprisText.width
|
||||
|
||||
Text {
|
||||
id: mprisText
|
||||
text: "Mpris"
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import "../../utils"
|
||||
|
||||
Rectangle {
|
||||
id: resources
|
||||
|
||||
Layout.fillHeight: true
|
||||
color: "transparent"
|
||||
implicitWidth: rowLayout.width
|
||||
|
||||
property int valueSize: 8
|
||||
property int textSize: 6
|
||||
|
||||
property string valueColor: "white"
|
||||
property string textColor: "lightgray"
|
||||
|
||||
RowLayout {
|
||||
id: rowLayout
|
||||
anchors.centerIn: parent
|
||||
|
||||
ColumnLayout {
|
||||
id: cpuColumn
|
||||
Label {
|
||||
color: textColor
|
||||
font.pointSize: textSize
|
||||
text: "CPU"
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
}
|
||||
Label {
|
||||
color: valueColor
|
||||
font.pointSize: valueSize
|
||||
text: Resources.cpu_percent + "%"
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Label {
|
||||
color: textColor
|
||||
font.pointSize: textSize
|
||||
text: "MEM"
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
}
|
||||
Label {
|
||||
color: valueColor
|
||||
font.pointSize: valueSize
|
||||
text: Resources.mem_percent + "%"
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
5
modules/home/services/quickshell/components/bar/Text.qml
Normal file
5
modules/home/services/quickshell/components/bar/Text.qml
Normal file
@@ -0,0 +1,5 @@
|
||||
import QtQuick
|
||||
|
||||
Text {
|
||||
renderType: Text.NativeRendering
|
||||
}
|
||||
14
modules/home/services/quickshell/components/bar/Tray.qml
Normal file
14
modules/home/services/quickshell/components/bar/Tray.qml
Normal file
@@ -0,0 +1,14 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
Rectangle {
|
||||
Layout.fillHeight: true
|
||||
color: "lightblue"
|
||||
implicitWidth: trayText.width
|
||||
|
||||
Text {
|
||||
id: trayText
|
||||
text: "Tray"
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
Rectangle {
|
||||
id: ws
|
||||
|
||||
property bool hovered: false
|
||||
|
||||
Layout.preferredWidth: parent.height * 0.4
|
||||
Layout.preferredHeight: parent.height * 0.4
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
radius: height / 2
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
|
||||
onEntered: () => {
|
||||
ws.hovered = true;
|
||||
}
|
||||
onExited: () => {
|
||||
ws.hovered = false;
|
||||
}
|
||||
onClicked: () => console.log(`workspace ?`)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import "../../../utils"
|
||||
import Quickshell.Hyprland
|
||||
|
||||
Rectangle {
|
||||
id: workspaces
|
||||
|
||||
color: 'transparent'
|
||||
|
||||
width: workspacesRow.implicitWidth
|
||||
Layout.fillHeight: true
|
||||
|
||||
RowLayout {
|
||||
id: workspacesRow
|
||||
|
||||
height: parent.height
|
||||
implicitWidth: (parent.height * 0.5 + spacing) * 2 - spacing
|
||||
anchors.centerIn: parent
|
||||
|
||||
spacing: height / 7
|
||||
|
||||
Repeater {
|
||||
id: repeater
|
||||
|
||||
model: HyprlandUtils.maxWorkspace
|
||||
|
||||
Workspace {
|
||||
id: ws
|
||||
required property int index
|
||||
property HyprlandWorkspace currWorkspace: Hyprland.workspaces.values.find(e => e.id == index + 1) || null
|
||||
property bool nonexistent: currWorkspace === null
|
||||
property bool focused: index + 1 === Hyprland.focusedMonitor.activeWorkspace.id
|
||||
|
||||
Layout.preferredWidth: {
|
||||
if (focused) {
|
||||
return parent.height * 0.8;
|
||||
} else {
|
||||
return parent.height * 0.4;
|
||||
}
|
||||
}
|
||||
|
||||
color: {
|
||||
if (nonexistent) {
|
||||
return Colors.bgBlur;
|
||||
} else {
|
||||
return Colors.monitorColors[Hyprland.monitors.values.indexOf(Hyprland.workspaces.values.find(e => e.id === index + 1).monitor)];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user