all repos — quickshell @ main

A desert-witch desktop shell

bar/modules/deprecated/Battery_rev1.qml.bak (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
 33
 34
 35
//TODO let's start by simplifying the output, then see about simpifying the
//input
import "../.."
import QtQuick
import QtQuick.Layouts
import Quickshell.Services.UPower
import "classes"

RowLayout {
  layoutDirection: Qt.RightToLeft
  Repeater {
    model: UPower.devices.values.filter(d => d.model)

    RowLayout {
      spacing: 2
      layoutDirection: Qt.RightToLeft
      property var lvl: Math.round(modelData.percentage * 100)
      property var charge_state: UPowerDeviceState.toString(modelData.state)
      property var device_type: UPowerDeviceType.toString(modelData.type)

      BarText {
        text: lvl + "%"
        color: (charge_state == "Charging") ? Style.saffron : (lvl < 20) ? Style.scarlet : Style.fg
      }

      BarText {
        text: modelData.model == "Jupiter of the Monkey" ? Icons.jotm : Icons.devices[modelData.type]
        color: (charge_state == "Charging") ? Style.saffron : (lvl < 20) ? Style.scarlet : Style.orange
      }
      BarText {
        text: Resources.sep
      }
    }
  }
}