Compare commits

...

3 commits

Author SHA1 Message Date
Damocles
24c90dae11 fix power profile jittery 2026-04-12 15:49:45 +02:00
Damocles
d0a6778004 fix app title not updating when changing focus 2026-04-12 15:47:49 +02:00
Damocles
2a96de6d27 fix power menu for real this time 2026-04-12 15:47:14 +02:00
4 changed files with 19 additions and 12 deletions

View file

@ -11,16 +11,12 @@ PanelWindow {
required property real anchorX
signal menuClosed()
signal runCommand(var cmd)
readonly property bool _isNiri: Quickshell.env("NIRI_SOCKET") !== ""
Process {
id: runner
}
function _run(cmd) {
runner.command = cmd;
runner.running = true;
runCommand(cmd);
menuClosed();
}

View file

@ -51,9 +51,7 @@ M.BarIcon {
onClicked: {
const cycle = ["performance", "balanced", "power-saver"];
const idx = cycle.indexOf(root.profile);
const next = cycle[(idx + 1) % cycle.length];
root.profile = next;
setter.next = next;
setter.next = cycle[(idx + 1) % cycle.length];
setter.running = true;
}
}

View file

@ -48,9 +48,13 @@ M.BarSection {
try {
const ev = JSON.parse(line);
if (ev.WindowFocusChanged !== undefined) {
const w = ev.WindowFocusChanged.window;
root._title = w ? (w.title || "") : "";
root._appId = w ? (w.app_id || "") : "";
// WindowFocusChanged only gives id, re-query for full info
if (ev.WindowFocusChanged.id !== null)
initProc.running = true;
else {
root._title = "";
root._appId = "";
}
} else if (ev.WindowOpenedOrChanged !== undefined) {
const w = ev.WindowOpenedOrChanged.window;
if (w.is_focused) {

View file

@ -1,4 +1,5 @@
import QtQuick
import Quickshell
import "." as M
M.BarIcon {
@ -9,6 +10,10 @@ M.BarIcon {
required property var bar
Process {
id: runner
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
@ -22,6 +27,10 @@ M.BarIcon {
screen: root.bar.screen
anchorX: root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0)
onMenuClosed: menuLoader.active = false
onRunCommand: cmd => {
runner.command = cmd;
runner.running = true;
}
}
}
}