35 lines
1.0 KiB
QML
35 lines
1.0 KiB
QML
import QtQuick 2.15
|
|
import QtQuick.Layouts 1.3
|
|
import org.kde.plasma.plasmoid 2.0
|
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
|
import org.kde.kirigami 2.14 as Kirigami
|
|
|
|
import "./lib/helper.js" as Helper
|
|
|
|
Item {
|
|
id: main
|
|
|
|
property int pollingrate: Plasmoid.configuration.pollingrate
|
|
property int batteryheight: Plasmoid.configuration.batteryheight
|
|
property string colorEmpty: Plasmoid.configuration.colorEmpty
|
|
property string colorHalf: Plasmoid.configuration.colorHalf
|
|
property string colorFull: Plasmoid.configuration.colorFull
|
|
property int batteryPercent: -2
|
|
|
|
PlasmaCore.DataSource {
|
|
id: hsSource
|
|
engine: "executable"
|
|
connectedSources: ["headsetcontrol -bc"]
|
|
interval: pollingrate * 1e3
|
|
onNewData: {
|
|
return batteryPercent = data['exit code'] > 0
|
|
? -2 // not connected
|
|
: data['stdout'];
|
|
}
|
|
}
|
|
|
|
Plasmoid.preferredRepresentation: Plasmoid.compactRepresentation
|
|
Plasmoid.fullRepresentation: FullRepresentation{}
|
|
Plasmoid.compactRepresentation: CompactRepresentation{}
|
|
}
|