use svg icons instead of goofy font
This commit is contained in:
parent
d3b5ccc48b
commit
5df124dc5f
6 changed files with 83 additions and 37 deletions
|
|
@ -1,4 +1,6 @@
|
|||
import Quickshell.Services.UPower
|
||||
import Quickshell
|
||||
import Quickshell.Widgets
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Effects
|
||||
|
|
@ -15,30 +17,33 @@ BarComponent {
|
|||
implicitHeight: Config.moduleHeight
|
||||
implicitWidth: batLayout.implicitWidth + 16
|
||||
|
||||
function batteryIcon(percent) {
|
||||
if (root.charging)
|
||||
return "battery_android_frame_bolt";
|
||||
if (percent <= 15)
|
||||
return "battery_android_alert";
|
||||
if (percent <= 30)
|
||||
return "battery_android_frame_2";
|
||||
if (percent <= 50)
|
||||
return "battery_android_frame_3";
|
||||
if (percent <= 70)
|
||||
return "battery_android_frame_4";
|
||||
if (percent <= 85)
|
||||
return "battery_android_frame_5";
|
||||
if (percent <= 100)
|
||||
return "battery_android_frame_full";
|
||||
function batteryIcon(percent, charging) {
|
||||
if(percent <= 10) return charging ? "battery-empty-charging" : "battery-empty"
|
||||
if(percent <= 30) return charging ? "battery-level-30-charging" : "battery-level-30"
|
||||
if(percent <= 40) return charging ? "battery-level-40-charging" : "battery-level-40"
|
||||
if(percent <= 50) return charging ? "battery-level-50-charging" : "battery-level-50"
|
||||
if(percent <= 60) return charging ? "battery-level-60-charging" : "battery-level-60"
|
||||
if(percent <= 70) return charging ? "battery-level-70-charging" : "battery-level-70"
|
||||
if(percent <= 80) return charging ? "battery-level-80-charging" : "battery-level-80"
|
||||
if(percent <= 90) return charging ? "battery-level-90-charging" : "battery-level-90"
|
||||
if(percent >= 90) return charging ? "battery-level-100-charging" : "battery-level-100"
|
||||
|
||||
}
|
||||
RowLayout {
|
||||
id: batLayout
|
||||
anchors.centerIn: root
|
||||
MaterialIcon {
|
||||
text: root.batteryIcon(root.percent)
|
||||
}
|
||||
IconImage {
|
||||
source: Quickshell.iconPath(root.batteryIcon(root.percent, root.charging) + "-symbolic")
|
||||
implicitSize: Config.iconSize
|
||||
layer.enabled: true
|
||||
layer.effect: MultiEffect {
|
||||
colorization: 1.0
|
||||
colorizationColor: Colors.text
|
||||
brightness: 0.5
|
||||
}
|
||||
}
|
||||
StyledText {
|
||||
text: Math.floor(root.percent) + "%"
|
||||
text: Math.floor(root.percent,root.charging) + "%"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue