Switch to stow for dotfiles management
This commit is contained in:
parent
00455231b1
commit
ed591485a1
39 changed files with 325 additions and 43 deletions
14
quickshell/.config/quickshell/Appearance.qml
Normal file
14
quickshell/.config/quickshell/Appearance.qml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
pragma Singleton
|
||||
import QtQuick
|
||||
|
||||
QtObject {
|
||||
// make them readonly because we dont have to write to them
|
||||
readonly property color colBg: "#3c1450"
|
||||
readonly property color colAppBg: "#1e0a28"
|
||||
readonly property color colFg: "#d2d2d2"
|
||||
readonly property color colDark: "#230f05"
|
||||
readonly property string font: "NotoSansM Nerd Font"
|
||||
readonly property int fontSize: 18
|
||||
readonly property int appletRadHeight: 25
|
||||
readonly property int appletSpacing: 6
|
||||
}
|
||||
36
quickshell/.config/quickshell/linux.qml
Normal file
36
quickshell/.config/quickshell/linux.qml
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import Quickshell
|
||||
import QtQuick
|
||||
// This is just for funsies
|
||||
|
||||
PanelWindow {
|
||||
|
||||
implicitHeight: 80
|
||||
implicitWidth: 280
|
||||
color: "transparent"
|
||||
anchors {
|
||||
bottom: true
|
||||
right: true
|
||||
}
|
||||
margins {
|
||||
right: 5
|
||||
bottom: 5
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "transparent"
|
||||
Item {
|
||||
opacity: 0.7
|
||||
Text {
|
||||
text: "Activate Linux"
|
||||
color: "#aaaaaa"
|
||||
font { family: "Mono Sans" ;pixelSize: 24; bold: false}
|
||||
}
|
||||
Text {
|
||||
text: "\nGo to Settings to activate Linux."
|
||||
color: "#aaaaaa"
|
||||
topPadding: 10
|
||||
font { family: "Mono Sans" ;pixelSize: 16; bold: false}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
64
quickshell/.config/quickshell/modules/Bar.qml
Normal file
64
quickshell/.config/quickshell/modules/Bar.qml
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs
|
||||
|
||||
Variants {
|
||||
model: Quickshell.screens
|
||||
// Variants so that we get a bar on all monitors
|
||||
delegate: WlrLayershell {
|
||||
// use wlrlayershell instead of panelwindow because it's almost the same except wlrlayershell is easier to work with
|
||||
id: root
|
||||
layer: WlrLayer.Top
|
||||
required property ShellScreen modelData
|
||||
screen: modelData
|
||||
implicitHeight: Appearance.appletRadHeight + 10
|
||||
color: 'transparent'
|
||||
anchors {
|
||||
top: true
|
||||
left: true
|
||||
right: true
|
||||
}
|
||||
margins {
|
||||
right: 5
|
||||
left: 5
|
||||
top: 5
|
||||
bottom: 0
|
||||
}
|
||||
Rectangle {
|
||||
id: barContainer
|
||||
anchors.fill: parent
|
||||
color: Appearance.colBg
|
||||
radius: Appearance.appletRadHeight
|
||||
RowLayout {
|
||||
id: leftLayout
|
||||
spacing: Appearance.appletSpacing
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
Battery {
|
||||
//Layout.leftMargin: ((Appearance.appletRadHeight + 10) - Appearance.appletRadHeight) / 2 // to have the same padding on the left no matter what the height it
|
||||
Layout.leftMargin: 8 // ^ This but simpler i guess
|
||||
}
|
||||
Cpu {}
|
||||
Mem {}
|
||||
}
|
||||
RowLayout {
|
||||
id: centerLayout
|
||||
anchors.centerIn: parent
|
||||
MangoWs {}
|
||||
}
|
||||
RowLayout {
|
||||
id: rightLayout
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
Tray {}
|
||||
Pw {}
|
||||
Clock {
|
||||
//Layout.rightMargin: ((Appearance.appletRadHeight + 10) - Appearance.appletRadHeight) / 2 // to have the same padding on the left no matter what the height it
|
||||
Layout.rightMargin: 8 // ^ This but again simpler?
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
43
quickshell/.config/quickshell/modules/Battery.qml
Normal file
43
quickshell/.config/quickshell/modules/Battery.qml
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import Quickshell.Services.UPower
|
||||
import QtQuick
|
||||
import qs
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
clip: true
|
||||
color: Appearance.colAppBg
|
||||
visible: UPower.displayDevice.isPresent
|
||||
property var batCharMin: (UPower.displayDevice.timeToFull / 60).toFixed(2)
|
||||
property var batDisMin: (UPower.displayDevice.timeToEmpty / 60).toFixed(2)
|
||||
property var batTime: 0
|
||||
implicitHeight: Appearance.appletRadHeight
|
||||
implicitWidth: batText.implicitWidth + 25
|
||||
radius: Appearance.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
|
||||
text: batStatProc() + " - " + getBatStat()
|
||||
font.family: Appearance.font
|
||||
font.pixelSize: Appearance.fontSize
|
||||
font.bold: true
|
||||
color: Appearance.colFg
|
||||
}
|
||||
}
|
||||
25
quickshell/.config/quickshell/modules/Clock.qml
Normal file
25
quickshell/.config/quickshell/modules/Clock.qml
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import Quickshell
|
||||
import QtQuick
|
||||
import qs
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
clip: true
|
||||
implicitHeight: Appearance.appletRadHeight
|
||||
implicitWidth: clockText.implicitWidth + 25
|
||||
color: Appearance.colAppBg
|
||||
radius: Appearance.appletRadHeight
|
||||
SystemClock {
|
||||
id: clock
|
||||
precision: SystemClock.Seconds
|
||||
}
|
||||
Text {
|
||||
id: clockText
|
||||
anchors.centerIn: root
|
||||
font.family: Appearance.font
|
||||
font.pixelSize: Appearance.fontSize
|
||||
font.bold: true
|
||||
color: Appearance.colFg
|
||||
text: Qt.formatDateTime(clock.date, "yyyy.MM.dd - hh:mm:ss")
|
||||
}
|
||||
}
|
||||
52
quickshell/.config/quickshell/modules/Cpu.qml
Normal file
52
quickshell/.config/quickshell/modules/Cpu.qml
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import QtQuick
|
||||
import qs
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
property real lastCpuTotal: 0.0
|
||||
property real lastCpuIdle: 0.0
|
||||
property real cpuUsage: 0.0
|
||||
color: Appearance.colAppBg
|
||||
implicitHeight: Appearance.appletRadHeight
|
||||
implicitWidth: cpuText.width + 25
|
||||
radius: Appearance.appletRadHeight
|
||||
Process {
|
||||
id: cpuProc
|
||||
command: ["sh", "-c", "head -1 /proc/stat"]
|
||||
property double cpuUsage
|
||||
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 {
|
||||
font.family: Appearance.font
|
||||
font.pixelSize: Appearance.fontSize
|
||||
font.bold: true
|
||||
color: Appearance.colFg
|
||||
id: cpuText
|
||||
anchors.centerIn: parent
|
||||
text: "CPU: " + root.cpuUsage + "%"
|
||||
}
|
||||
}
|
||||
50
quickshell/.config/quickshell/modules/MangoWs.qml
Normal file
50
quickshell/.config/quickshell/modules/MangoWs.qml
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
pragma ComponentBehavior: Bound
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell.WindowManager
|
||||
import qs
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
color: Appearance.colAppBg
|
||||
RowLayout {
|
||||
id: wsNumLayout
|
||||
anchors.centerIn: parent
|
||||
spacing: 2
|
||||
Repeater {
|
||||
id: wsNumRepeater
|
||||
model: WindowManager.windowsets
|
||||
Rectangle {
|
||||
required property var modelData
|
||||
function isOverview() {
|
||||
if (modelData.name == "overview") {
|
||||
return 85 + Appearance.appletRadHeight;
|
||||
}
|
||||
else {
|
||||
return Appearance.appletRadHeight;
|
||||
}
|
||||
}
|
||||
id: wsNum
|
||||
implicitWidth: isOverview()
|
||||
implicitHeight: Appearance.appletRadHeight
|
||||
color: Appearance.colAppBg
|
||||
radius: Appearance.appletRadHeight
|
||||
visible: modelData.shouldDisplay
|
||||
Text {
|
||||
id: wsText
|
||||
anchors.centerIn: parent
|
||||
text: modelData.name
|
||||
color: Appearance.colFg
|
||||
opacity: modelData.active ? 1 : 0.3
|
||||
font {
|
||||
family: Appearance.font
|
||||
pixelSize: Appearance.fontSize
|
||||
bold: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
44
quickshell/.config/quickshell/modules/Mem.qml
Normal file
44
quickshell/.config/quickshell/modules/Mem.qml
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import QtQuick
|
||||
import qs
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
property real ramUsage
|
||||
implicitHeight: Appearance.appletRadHeight
|
||||
radius: Appearance.appletRadHeight
|
||||
implicitWidth: ramText.width + 25
|
||||
color: Appearance.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: root
|
||||
text: "RAM: " + root.ramUsage.toFixed(2) + " GiB"
|
||||
font.family: Appearance.font
|
||||
font.pixelSize: Appearance.fontSize
|
||||
font.bold: true
|
||||
color: Appearance.colFg
|
||||
}
|
||||
}
|
||||
42
quickshell/.config/quickshell/modules/Pw.qml
Normal file
42
quickshell/.config/quickshell/modules/Pw.qml
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import Quickshell.Services.Pipewire
|
||||
import Quickshell.Io
|
||||
import QtQuick
|
||||
import qs
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
color: Appearance.colAppBg
|
||||
property PwNode defaultAudio: Pipewire.ready ? Pipewire.preferredDefaultAudioSink : null
|
||||
property bool mute: Pipewire.ready ? defaultAudio?.audio.muted : null
|
||||
radius: Appearance.appletRadHeight
|
||||
implicitHeight: Appearance.appletRadHeight
|
||||
implicitWidth: pwText.implicitWidth + 25
|
||||
PwObjectTracker {
|
||||
objects: [Pipewire.ready ? Pipewire.defaultAudioSink : null]
|
||||
}
|
||||
|
||||
Process {
|
||||
id: pavuLauncher
|
||||
command: ["pavucontrol"]
|
||||
running: false
|
||||
}
|
||||
|
||||
Text {
|
||||
id: pwText
|
||||
font.family: Appearance.font
|
||||
font.pixelSize: Appearance.fontSize
|
||||
font.bold: true
|
||||
color: Appearance.colFg
|
||||
anchors.centerIn: root
|
||||
text: root.mute ? "MUT: " + Math.floor(root.defaultAudio?.audio.volume * 100) + "%" : "VOL: " + Math.floor(root.defaultAudio?.audio.volume * 100) + "%"
|
||||
opacity: root.defaultAudio?.audio.muted ? 0.6 : 1.0
|
||||
}
|
||||
MouseArea {
|
||||
id: clickHandler
|
||||
hoverEnabled: true
|
||||
acceptedButtons: Qt.LeftButton
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
anchors.fill: root
|
||||
onClicked: pavuLauncher.running = true
|
||||
}
|
||||
}
|
||||
45
quickshell/.config/quickshell/modules/Tray.qml
Normal file
45
quickshell/.config/quickshell/modules/Tray.qml
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
pragma ComponentBehavior: Bound
|
||||
import Quickshell
|
||||
import Quickshell.Services.SystemTray
|
||||
import Quickshell.Widgets
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
color: Appearance.colAppBg
|
||||
visible: iconRepeater.count != 0
|
||||
radius: Appearance.appletRadHeight
|
||||
Layout.fillHeight: true
|
||||
implicitHeight: Appearance.appletRadHeight
|
||||
implicitWidth: iconlayout.implicitWidth + 16
|
||||
|
||||
RowLayout {
|
||||
id: iconlayout
|
||||
anchors.centerIn: root
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
9
quickshell/.config/quickshell/shell.qml
Normal file
9
quickshell/.config/quickshell/shell.qml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
//@ pragma UseQApplication
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
import qs.modules
|
||||
|
||||
ShellRoot {
|
||||
id: root
|
||||
Bar {}
|
||||
}
|
||||
335
quickshell/.config/quickshell/swayshell.qml
Executable file
335
quickshell/.config/quickshell/swayshell.qml
Executable file
|
|
@ -0,0 +1,335 @@
|
|||
//@ pragma UseQApplication
|
||||
import Quickshell
|
||||
import Quickshell.I3
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Io
|
||||
import Quickshell.Services.SystemTray
|
||||
import Quickshell.Widgets
|
||||
import Quickshell.Services.UPower
|
||||
import Quickshell.Services.Pipewire
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
// Some credit goes to my friends Lucy and Babsi
|
||||
// Work in progress (Audio)
|
||||
|
||||
PanelWindow {
|
||||
id: root
|
||||
|
||||
property color colBg: "#64320a"
|
||||
property color colAppBg: "#2d1405"
|
||||
property color colFg: "#d2d2d2"
|
||||
property color colDark: "#230f05"
|
||||
property string fontFamily: "Noto Sans"
|
||||
property int fontSize: 18
|
||||
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 batTime: 0
|
||||
property var batCharMin: (UPower.displayDevice.timeToFull / 60).toFixed(2)
|
||||
property var batDisMin: (UPower.displayDevice.timeToEmpty / 60).toFixed(2)
|
||||
|
||||
anchors {
|
||||
right: true
|
||||
left: true
|
||||
top:true
|
||||
}
|
||||
|
||||
color: "transparent"
|
||||
implicitHeight: root.appletRadHeight + 10
|
||||
margins {
|
||||
right: 5
|
||||
left: 5
|
||||
top: 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
|
||||
property var ws: I3.workspaces
|
||||
|
||||
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 {
|
||||
|
||||
Process {
|
||||
id: cpuProc
|
||||
command: ["sh", "-c", "head -1 /proc/stat"]
|
||||
stdout: SplitParser {
|
||||
onRead: data => {
|
||||
if (!data) return
|
||||
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)
|
||||
if (lastCpuTotal > 0) {
|
||||
cpuUsage = Math.round(100 * (1 - (idle - lastCpuIdle) / (total - lastCpuTotal)))
|
||||
}
|
||||
lastCpuTotal = total
|
||||
lastCpuIdle = idle
|
||||
}
|
||||
}
|
||||
Component.onCompleted: running = true
|
||||
}
|
||||
|
||||
Process {
|
||||
id: ramProc
|
||||
command: ["sh", "-c", "free | grep Mem"]
|
||||
stdout: SplitParser {
|
||||
onRead: data => {
|
||||
if (!data) return
|
||||
var parts = data.trim().split(/\s+/)
|
||||
var used = parseInt(parts[2]) || 0
|
||||
ramUsage = used /1048576
|
||||
}
|
||||
}
|
||||
Component.onCompleted: running = true
|
||||
}
|
||||
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 {
|
||||
id: statLoader
|
||||
active: true
|
||||
sourceComponent: Rectangle {
|
||||
id: batRect
|
||||
height: root.appletRadHeight
|
||||
width: batText.paintedWidth + root.appletRadHeight
|
||||
radius: root.appletRadHeight
|
||||
color: root.colAppBg
|
||||
|
||||
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 }
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
height: root.appletRadHeight
|
||||
width: cpuText.paintedWidth + 25
|
||||
radius: root.appletRadHeight
|
||||
color: root.colAppBg
|
||||
|
||||
|
||||
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 }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
id: clockRow
|
||||
Rectangle {
|
||||
height: root.appletRadHeight
|
||||
width: clock.paintedWidth + root.appletRadHeight
|
||||
radius: root.appletRadHeight
|
||||
color: root.colAppBg
|
||||
|
||||
Text {
|
||||
id: clock
|
||||
anchors.centerIn: parent
|
||||
anchors.right: parent.right
|
||||
text: Qt.formatDateTime(new Date(), "yyyy.MM.dd - HH:mm:ss")
|
||||
color: root.colFg
|
||||
font { family: root.fontFamily; pixelSize: root.fontSize; bold: true }
|
||||
|
||||
Timer {
|
||||
interval: 1000
|
||||
running: true
|
||||
repeat: true
|
||||
onTriggered: clock.text = Qt.formatDateTime(new Date(), "yyyy.MM.dd - HH:mm:ss")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Row {
|
||||
id: trayWholeRow
|
||||
rightPadding: 10
|
||||
Item{
|
||||
id: miscItem
|
||||
implicitHeight: root.appletRadHeight
|
||||
implicitWidth: trayRect.implicitWidth
|
||||
visible: trayRepeater.count > 0
|
||||
|
||||
Rectangle {
|
||||
id: trayRect
|
||||
implicitHeight: root.appletRadHeight
|
||||
implicitWidth: trayRow.implicitWidth + 10
|
||||
radius: root.appletRadHeight
|
||||
color: root.colAppBg
|
||||
anchors.centerIn: parent
|
||||
|
||||
Row {
|
||||
id: trayRow
|
||||
spacing: root.appletSpacing
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.centerIn: parent
|
||||
|
||||
Repeater {
|
||||
id: trayRepeater
|
||||
model: SystemTray.items
|
||||
|
||||
MouseArea {
|
||||
id: trayMouse
|
||||
property var bar: trayMouse.QsWindow.window
|
||||
required property SystemTrayItem modelData
|
||||
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
implicitWidth: 16
|
||||
implicitHeight: 16
|
||||
|
||||
onClicked: event => {
|
||||
if (event.button === Qt.LeftButton) {
|
||||
modelData.activate();
|
||||
}
|
||||
else if (modelData.hasMenu) {
|
||||
menu.open();
|
||||
}
|
||||
}
|
||||
|
||||
QsMenuAnchor {
|
||||
id: menu
|
||||
menu: trayMouse.modelData.hasMenu ? trayMouse.modelData.menu : null
|
||||
anchor.item: trayMouse
|
||||
}
|
||||
|
||||
IconImage {
|
||||
id: trayIcon
|
||||
width: parent.implicitWidth
|
||||
height: parent.implicitHeight
|
||||
source: trayMouse.modelData.icon
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue