-
Notifications
You must be signed in to change notification settings - Fork 9
service/upower: add upower service #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot!
Looks pretty good overall, just a few UAFs and nitpicks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noticed a few more things while testing.
Here's my tester if you don't have one, but I assume you do
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Quickshell
import Quickshell.Services.UPower
ShellRoot {
Component {
id: comp
Rectangle {
required property var modelData;
implicitWidth: layout.implicitWidth + 10
implicitHeight: layout.implicitHeight + 10
color: palette.active.base
ColumnLayout {
id: layout
Label { text: `is display device: ${modelData == UPower.displayDevice}` }
Label { text: `device type: ${UPowerDeviceType.toString(modelData.type)}` }
Label { text: `is power supply: ${modelData.powerSupply}` }
Label { text: `energy: ${modelData.energy}` }
Label { text: `energy capacity: ${modelData.energyCapacity}` }
Label { text: `change rate: ${modelData.changeRate}` }
Label { text: `time to empty: ${modelData.timeToEmpty}` }
Label { text: `time to full: ${modelData.timeToFull}` }
Label { text: `percentage: ${modelData.percentage}` }
Label { text: `is present: ${modelData.isPresent}` }
Label { text: `state: ${UPowerDeviceState.toString(modelData.state)}` }
Label { text: `health percentage: ${modelData.healthPercentage}` }
Label { text: `health supported: ${modelData.healthSupported}` }
Label { text: `icon name: ${modelData.iconName}` }
Label { text: `is laptop battery: ${modelData.isLaptopBattery}` }
}
}
}
FloatingWindow {
color: contentItem.palette.active.window
ListView {
anchors.fill: parent
spacing: 10
model: UPower.devices
delegate: comp
}
Loader {
anchors.right: parent.right
active: UPower.displayDevice != null
sourceComponent: BoundComponent {
sourceComponent: comp
property var modelData: UPower.displayDevice
}
}
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After this please squash+rebase and it should be good to merge.
LGTM, thanks! |
Thanks for everything! |
Adds a UPower service to interact with system battery devices. I only implemented properties I thought would be useful, but more can be added later on.
This is my first shot at C++ so any suggestions would be greatly appreciated!