Initial commit
This commit is contained in:
commit
f94fd70f07
151 changed files with 7650 additions and 0 deletions
74
quickshell/shell/Modules/Battery.qml
Normal file
74
quickshell/shell/Modules/Battery.qml
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
//@ pragma IconTheme Adwaita
|
||||
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Io
|
||||
import Quickshell.Widgets
|
||||
import Quickshell.Services.UPower
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import "../Config"
|
||||
|
||||
PanelWindow {
|
||||
anchors {
|
||||
bottom: true
|
||||
right: true
|
||||
}
|
||||
|
||||
width: text.width + 70
|
||||
color: "transparent"
|
||||
|
||||
function getIcon() {
|
||||
if (UPower.displayDevice.percentage > 0.9) {
|
||||
if (UPower.onBattery == false) {
|
||||
return "xfce4-battery-full-charging"
|
||||
}
|
||||
else {
|
||||
return "xfce4-battery-full"
|
||||
}
|
||||
}
|
||||
else if (0.5 < UPower.displayDevice.percentage) {
|
||||
if (UPower.onBattery == false) {
|
||||
return "xfce4-battery-ok-charging"
|
||||
}
|
||||
else {
|
||||
return "xfce4-battery-ok"
|
||||
}
|
||||
}
|
||||
else if (0.1 < UPower.displayDevice.percentage) {
|
||||
if (UPower.onBattery == false) {
|
||||
return "xfce4-battery-low-charging"
|
||||
}
|
||||
else {
|
||||
return "xfce4-battery-low"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
|
||||
topLeftRadius: 20
|
||||
opacity: 0.95
|
||||
color: Colours.colour1
|
||||
|
||||
Row {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
IconImage {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: 50
|
||||
height: 50
|
||||
source: Quickshell.iconPath(getIcon())
|
||||
}
|
||||
Text {
|
||||
id: text
|
||||
color: Colours.foreground
|
||||
font.family: "Departure Mono"
|
||||
font.pixelSize: 50
|
||||
text: Math.floor(UPower.displayDevice.percentage * 100) + "%"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue