usable
This commit is contained in:
@@ -8,88 +8,27 @@ import Quickshell.Hyprland
|
||||
import Quickshell.Services.UPower
|
||||
|
||||
ClippingWrapperRectangle {
|
||||
radius: 5
|
||||
width: 100; height: 30
|
||||
color: "red"
|
||||
Button {
|
||||
id: button
|
||||
text: if(UPower.onBattery) {
|
||||
" " + Math.floor(UPower.displayDevice.percentage * 100) + "%"
|
||||
} else {
|
||||
" " + Math.floor(UPower.displayDevice.percentage * 100) + "%"
|
||||
}
|
||||
font.pointSize: 12
|
||||
implicitHeight: parent.height
|
||||
//icon.color: "red"
|
||||
//icon.source: "/nix/store/c4dcn4vl0v5njv4d587sazrad1xgyd9h-rose-pine-icon-theme-unstable-2022-09-01/share/icons/rose-pine/symbolic/devices/battery-symbolic.svg"
|
||||
onClicked: {
|
||||
menu.visible = true
|
||||
grab.active = true
|
||||
}
|
||||
}
|
||||
|
||||
required property var window
|
||||
required property real popupOffset
|
||||
id: root
|
||||
radius: 3
|
||||
|
||||
PopupWindow {
|
||||
|
||||
id: menu
|
||||
color: Pywal.colors.color2
|
||||
|
||||
anchor.window: window
|
||||
anchor.rect.x: popupOffset
|
||||
anchor.rect.y: 50
|
||||
implicitWidth: 250
|
||||
implicitHeight: 150
|
||||
visible: false
|
||||
implicitWidth: 30
|
||||
|
||||
color: "transparent"
|
||||
|
||||
ClippingWrapperRectangle {
|
||||
radius: 5
|
||||
implicitHeight: text.contentWidth + text.padding
|
||||
|
||||
implicitHeight: parent.height - 20
|
||||
implicitWidth: parent.width
|
||||
|
||||
ColumnLayout {
|
||||
Text {
|
||||
id: text
|
||||
text: UPower.displayDevice.percentage * 100 + "%"
|
||||
|
||||
spacing: 0
|
||||
padding: 10
|
||||
|
||||
Button {
|
||||
Layout.topMargin: 5
|
||||
x: (parent.width - width) / 2
|
||||
implicitWidth: parent.width - 10
|
||||
implicitHeight: parent.height / 5 - parent.spacing
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
|
||||
text: 'performance'
|
||||
onClicked: PowerProfiles.profile = PowerProfile.Performance
|
||||
visible: PowerProfiles.hasPerformanceProfile
|
||||
}
|
||||
Button {
|
||||
Layout.topMargin: 5
|
||||
x: (parent.width - width) / 2
|
||||
implicitWidth: parent.width - 10
|
||||
implicitHeight: parent.height / 5 - parent.spacing
|
||||
font.pointSize: 14
|
||||
|
||||
text: 'balanced'
|
||||
onClicked: PowerProfiles.profile = PowerProfile.Balanced
|
||||
}
|
||||
Button {
|
||||
Layout.topMargin: 5
|
||||
x: (parent.width - width) / 2
|
||||
implicitWidth: parent.width - 10
|
||||
implicitHeight: parent.height / 5 - parent.spacing
|
||||
|
||||
text: 'power saver'
|
||||
onClicked: PowerProfiles.profile = PowerProfile.PowerSaver
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HyprlandFocusGrab {
|
||||
id: grab
|
||||
windows: [ menu ]
|
||||
onCleared: menu.visible = false
|
||||
}
|
||||
color: Pywal.special.foreground
|
||||
rotation: -90
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user