repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

fix nuguland power popup proportions

91a1be81b5ddc775b28ae5553c828b769ea6ddf8

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (3)

quickshell/nuguland/PowerPanel.qml

Modified
18 18 readonly property var devices: panelState.externalDevices || []
19 19 readonly property var sessionActions: panelState.sessionActions || ["lock", "suspend", "monitor-off", "monitor-on", "logout", "reboot", "poweroff"]
20 20 readonly property bool hasMainBattery: !!(battery && battery.present)
21 - readonly property var safeActionNames: ["lock", "suspend", "monitor-off", "monitor-on"]
21 + readonly property var safeActionNames: ["lock", "suspend", "monitor-off"]
22 22 readonly property var destructiveActionNames: ["logout", "reboot", "poweroff"]
23 23 readonly property var safeActions: actionSubset(safeActionNames)
24 24 readonly property var destructiveActions: actionSubset(destructiveActionNames)
70 70 function actionLabel(action) {
71 + if (action === "suspend")
72 + return "sleep";
71 74 if (action === "monitor-off")
72 75 return "display off";
74 - if (action === "monitor-on")
75 - return "display on";
77 77 if (action === "poweroff")
78 78 return "power off";
216 216 objectName: "safeActionGrid"
217 217 width: parent.width
218 - columns: 2
218 + columns: 3
219 219 columnSpacing: 8
220 220 rowSpacing: 8

quickshell/nuguland/SurfaceManager.qml

Modified
20 20 property int screenHeight: 0
21 21 property int barHeight: 34
22 22 property string orientation: "horizontal"
23 + property var powerService
23 24 readonly property bool vertical: orientation === "vertical"
24 25 property var anchorRegistry: ({})
25 26 readonly property int closeRetentionMs: 0
60 61 return Math.min(maxHeight, Math.max(220, Number(wanted)));
64 + function powerContentSize() {
65 + const state = powerService ? JSON.parse(powerService.stateJson()) : ({
66 + "battery": {},
67 + "externalDevices": []
68 + });
69 + const hasBattery = !!(state.battery && state.battery.present);
70 + const hasDevices = (state.externalDevices || []).length > 0;
71 + return {
72 + "width": hasBattery ? 376 : 326,
73 + "height": hasBattery ? (hasDevices ? 334 : 290) : (hasDevices ? 206 : 174)
74 + };
75 + }
63 77 function popoutContentSize(name) {
64 78 const width = popoutWidth();
65 79 switch (String(name)) {
122 136 "height": heightBudget(540)
124 138 case "power":
125 - return {
126 - "width": width,
127 - "height": heightBudget(480)
128 - };
139 + return powerContentSize();
129 140 default:
130 141 return {
131 142 "width": width,

quickshell/nuguland/shell.qml

Modified
157 157 SurfaceManager {
158 158 id: surfaceManager
160 + powerService: power
161 163 Noko {