1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-27 06:52:50 -05:00

show a power profile OSD

This commit is contained in:
bbedward
2025-11-13 10:23:14 -05:00
parent 76a60df88b
commit cf75c1aad0
4 changed files with 73 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
import QtQuick
import Quickshell.Services.UPower
import qs.Common
import qs.Services
import qs.Widgets
DankOSD {
id: root
osdWidth: Theme.iconSize + Theme.spacingS * 2
osdHeight: Theme.iconSize + Theme.spacingS * 2
autoHideInterval: 2000
enableMouseInteraction: false
property int lastProfile: -1
Connections {
target: typeof PowerProfiles !== "undefined" ? PowerProfiles : null
function onProfileChanged() {
if (lastProfile !== -1 && lastProfile !== PowerProfiles.profile) {
root.show()
}
lastProfile = PowerProfiles.profile
}
}
Component.onCompleted: {
if (typeof PowerProfiles !== "undefined") {
lastProfile = PowerProfiles.profile
}
}
content: DankIcon {
anchors.centerIn: parent
name: typeof PowerProfiles !== "undefined" ? Theme.getPowerProfileIcon(PowerProfiles.profile) : "settings"
size: Theme.iconSize
color: Theme.primary
}
}