add tooltips
This commit is contained in:
parent
7ca7e1e952
commit
6370732e4e
15 changed files with 123 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import Quickshell.Services.UPower
|
||||
import "." as M
|
||||
|
||||
|
|
@ -26,4 +27,16 @@ Row {
|
|||
color: root.pct < 15 ? M.Theme.base08 : M.Theme.base05
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
HoverHandler { id: hover }
|
||||
ToolTip {
|
||||
visible: hover.hovered
|
||||
text: {
|
||||
const state = root.charging ? "Charging" : "Discharging";
|
||||
const t = root.charging ? root.dev?.timeToFull : root.dev?.timeToEmpty;
|
||||
const mins = t ? Math.round(t / 60) : 0;
|
||||
const timeStr = mins > 0 ? "\n" + Math.floor(mins / 60) + "h " + (mins % 60) + "m " + (root.charging ? "until full" : "remaining") : "";
|
||||
return state + " — " + Math.round(root.pct) + "%" + timeStr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue