all repos — quickshell @ fe80d53b1ad94ec7ea394a3ca1825994913e7d47

A desert-witch desktop shell

bar/modules/Battery.qml (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
//HeadphonesBattery.qml
import QtQuick
import Quickshell
import QtQuick.Layouts
import Quickshell.Services.UPower
import "../.."
import "../classes" as Class


Repeater {
  model: UPower.devices.values
  Class.RightRowLayout {
    Class.BottombarText {
      // text: !modelData.isLaptopBattery ? modelData.percentage*100+"%" : ""
      // text: UPowerDeviceState.toString(modelData.state)
      text: modelData.percentage*100+"%"
    }
    Class.BottombarIcon {
      text: (({
        "Jupiter of the Monkey": Icons.modules.headphones,
        "mix4": Icons.modules.mewi,
      })[modelData.model] ?? modelData.model)+" "
      color: ({
        "Charging": Resources.palette.saffron,
        "Discharging": Resources.palette.orange,
        "FullyCharged": Resources.palette.cyan,
        "Empty": Resources.palette.scarlet,
      })[UPowerDeviceState.toString(modelData.state)] ?? Resources.palette.orange
    }
    Class.BotSep{}
  }
}