commit
14274f0aac
11 changed files with 65 additions and 29 deletions
|
|
@ -214,7 +214,7 @@ PanelWithOverlay {
|
|||
Rectangle {
|
||||
id: searchBar
|
||||
color: Theme.surfaceVariant
|
||||
radius: 22
|
||||
radius: 20
|
||||
height: 48
|
||||
Layout.fillWidth: true
|
||||
border.color: searchField.activeFocus ? Theme.accentPrimary : Theme.outline
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import Quickshell.Services.UPower
|
|||
import QtQuick.Layouts
|
||||
import qs.Components
|
||||
import qs.Settings
|
||||
import "../../Helpers/Time.js" as Time
|
||||
|
||||
Item {
|
||||
id: batteryWidget
|
||||
|
|
@ -76,17 +77,37 @@ Item {
|
|||
positionAbove: false
|
||||
text: {
|
||||
let lines = [];
|
||||
if (batteryWidget.isReady) {
|
||||
if (!batteryWidget.isReady) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (batteryWidget.battery.timeToEmpty > 0) {
|
||||
lines.push("Time left: " + Time.formatVagueHumanReadableTime(batteryWidget.battery.timeToEmpty));
|
||||
}
|
||||
|
||||
if (batteryWidget.battery.timeToFull > 0) {
|
||||
lines.push("Time until full: " + Time.formatVagueHumanReadableTime(batteryWidget.battery.timeToFull));
|
||||
}
|
||||
|
||||
if (batteryWidget.battery.changeRate !== undefined) {
|
||||
const rate = batteryWidget.battery.changeRate;
|
||||
if (rate > 0) {
|
||||
lines.push(batteryWidget.charging ? "Charging rate: " + rate.toFixed(2) + " W" : "Discharging rate: " + rate.toFixed(2) + " W");
|
||||
}
|
||||
else if (rate < 0) {
|
||||
lines.push("Discharging rate: " + Math.abs(rate).toFixed(2) + " W");
|
||||
}
|
||||
else {
|
||||
lines.push("Estimating...");
|
||||
}
|
||||
}
|
||||
else {
|
||||
lines.push(batteryWidget.charging ? "Charging" : "Discharging");
|
||||
lines.push(Math.round(batteryWidget.percent) + "%");
|
||||
if (batteryWidget.battery.changeRate !== undefined)
|
||||
lines.push("Rate: " + batteryWidget.battery.changeRate.toFixed(2) + " W");
|
||||
if (batteryWidget.battery.timeToEmpty > 0)
|
||||
lines.push("Time left: " + Math.floor(batteryWidget.battery.timeToEmpty / 60) + " min");
|
||||
if (batteryWidget.battery.timeToFull > 0)
|
||||
lines.push("Time to full: " + Math.floor(batteryWidget.battery.timeToFull / 60) + " min");
|
||||
if (batteryWidget.battery.healthPercentage !== undefined)
|
||||
lines.push("Health: " + Math.round(batteryWidget.battery.healthPercentage) + "%");
|
||||
}
|
||||
|
||||
|
||||
if (batteryWidget.battery.healthPercentage !== undefined && batteryWidget.battery.healthPercentage > 0) {
|
||||
lines.push("Health: " + Math.round(batteryWidget.battery.healthPercentage) + "%");
|
||||
}
|
||||
return lines.join("\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ Item {
|
|||
|
||||
StyledTooltip {
|
||||
id: volumeTooltip
|
||||
text: "Volume: " + volume + "%\nScroll up/down to change volume.\nLeft click to open the input/output selection."
|
||||
text: "Volume: " + volume + "%\nLeft click for advanced settings.\nScroll up/down to change volume."
|
||||
positionAbove: false
|
||||
tooltipVisible: !ioSelector.visible && volumeDisplay.containsMouse
|
||||
targetItem: pillIndicator
|
||||
|
|
|
|||
|
|
@ -6,20 +6,17 @@ import QtQuick.Effects
|
|||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 2
|
||||
|
||||
anchors.leftMargin: 2
|
||||
anchors.rightMargin: 2
|
||||
anchors.topMargin: 2
|
||||
anchors.bottomMargin: 2
|
||||
|
||||
IconImage {
|
||||
Image {
|
||||
id: avatarImage
|
||||
anchors.fill: parent
|
||||
anchors.margins: 2
|
||||
source: "file://" + Settings.settings.profileImage
|
||||
visible: false
|
||||
mipmap: true
|
||||
smooth: true
|
||||
asynchronous: true
|
||||
backer.fillMode: Image.PreserveAspectCrop
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
}
|
||||
|
||||
MultiEffect {
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ Window {
|
|||
color: "transparent"
|
||||
visible: false
|
||||
|
||||
minimumWidth: tooltipText.implicitWidth + 24
|
||||
minimumHeight: tooltipText.implicitHeight + 16
|
||||
minimumWidth: Math.max(50, tooltipText.implicitWidth + 24)
|
||||
minimumHeight: Math.max(50, tooltipText.implicitHeight + 16)
|
||||
property var _timerObj: null
|
||||
|
||||
onTooltipVisibleChanged: {
|
||||
|
|
|
|||
18
Helpers/Time.js
Normal file
18
Helpers/Time.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
function formatVagueHumanReadableTime(totalSeconds) {
|
||||
const hours = Math.floor(totalSeconds / 3600);
|
||||
const minutes = Math.floor((totalSeconds - (hours * 3600)) / 60);
|
||||
const seconds = totalSeconds - (hours * 3600) - (minutes * 60);
|
||||
|
||||
var str = "";
|
||||
if (hours) {
|
||||
str += hours.toString() + "h";
|
||||
}
|
||||
if (minutes) {
|
||||
str += minutes.toString() + "m";
|
||||
}
|
||||
if (!hours && !minutes) {
|
||||
str += seconds.toString() + "s";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
|
|
@ -240,7 +240,7 @@ WlSessionLock {
|
|||
width: parent.width * 0.8
|
||||
height: 44
|
||||
color: Theme.overlay
|
||||
radius: 22
|
||||
radius: 20
|
||||
visible: lock.errorMessage !== ""
|
||||
|
||||
Text {
|
||||
|
|
@ -258,7 +258,7 @@ WlSessionLock {
|
|||
Layout.alignment: Qt.AlignHCenter
|
||||
width: 120
|
||||
height: 44
|
||||
radius: 22
|
||||
radius: 20
|
||||
opacity: unlockButtonArea.containsMouse ? 0.8 : 0.5
|
||||
color: unlockButtonArea.containsMouse ? Theme.accentPrimary : Theme.surface
|
||||
border.color: Theme.accentPrimary
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ PanelWindow {
|
|||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Theme.backgroundPrimary
|
||||
radius: 24
|
||||
radius: 20
|
||||
z: 0
|
||||
|
||||
ColumnLayout {
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ Item {
|
|||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Theme.backgroundPrimary
|
||||
radius: 24
|
||||
radius: 20
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ PanelWindow {
|
|||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Theme.backgroundPrimary
|
||||
radius: 24
|
||||
radius: 20
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 32
|
||||
|
|
|
|||
|
|
@ -482,7 +482,7 @@ Item {
|
|||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Theme.backgroundPrimary
|
||||
radius: 24
|
||||
radius: 20
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 32
|
||||
|
|
@ -590,7 +590,7 @@ Item {
|
|||
anchors.fill: parent
|
||||
spacing: 4
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
model: Object.values(wifiLogic.networks)
|
||||
model: wifiLogic.networks ? Object.values(wifiLogic.networks) : null
|
||||
delegate: Item {
|
||||
id: networkEntry
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue