Compare commits
3 commits
a1a8d0cf24
...
24c90dae11
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
24c90dae11 | ||
|
|
d0a6778004 | ||
|
|
2a96de6d27 |
4 changed files with 19 additions and 12 deletions
|
|
@ -11,16 +11,12 @@ PanelWindow {
|
||||||
required property real anchorX
|
required property real anchorX
|
||||||
|
|
||||||
signal menuClosed()
|
signal menuClosed()
|
||||||
|
signal runCommand(var cmd)
|
||||||
|
|
||||||
readonly property bool _isNiri: Quickshell.env("NIRI_SOCKET") !== ""
|
readonly property bool _isNiri: Quickshell.env("NIRI_SOCKET") !== ""
|
||||||
|
|
||||||
Process {
|
|
||||||
id: runner
|
|
||||||
}
|
|
||||||
|
|
||||||
function _run(cmd) {
|
function _run(cmd) {
|
||||||
runner.command = cmd;
|
runCommand(cmd);
|
||||||
runner.running = true;
|
|
||||||
menuClosed();
|
menuClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,9 +51,7 @@ M.BarIcon {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
const cycle = ["performance", "balanced", "power-saver"];
|
const cycle = ["performance", "balanced", "power-saver"];
|
||||||
const idx = cycle.indexOf(root.profile);
|
const idx = cycle.indexOf(root.profile);
|
||||||
const next = cycle[(idx + 1) % cycle.length];
|
setter.next = cycle[(idx + 1) % cycle.length];
|
||||||
root.profile = next;
|
|
||||||
setter.next = next;
|
|
||||||
setter.running = true;
|
setter.running = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,9 +48,13 @@ M.BarSection {
|
||||||
try {
|
try {
|
||||||
const ev = JSON.parse(line);
|
const ev = JSON.parse(line);
|
||||||
if (ev.WindowFocusChanged !== undefined) {
|
if (ev.WindowFocusChanged !== undefined) {
|
||||||
const w = ev.WindowFocusChanged.window;
|
// WindowFocusChanged only gives id, re-query for full info
|
||||||
root._title = w ? (w.title || "") : "";
|
if (ev.WindowFocusChanged.id !== null)
|
||||||
root._appId = w ? (w.app_id || "") : "";
|
initProc.running = true;
|
||||||
|
else {
|
||||||
|
root._title = "";
|
||||||
|
root._appId = "";
|
||||||
|
}
|
||||||
} else if (ev.WindowOpenedOrChanged !== undefined) {
|
} else if (ev.WindowOpenedOrChanged !== undefined) {
|
||||||
const w = ev.WindowOpenedOrChanged.window;
|
const w = ev.WindowOpenedOrChanged.window;
|
||||||
if (w.is_focused) {
|
if (w.is_focused) {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
import "." as M
|
import "." as M
|
||||||
|
|
||||||
M.BarIcon {
|
M.BarIcon {
|
||||||
|
|
@ -9,6 +10,10 @@ M.BarIcon {
|
||||||
|
|
||||||
required property var bar
|
required property var bar
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: runner
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
|
@ -22,6 +27,10 @@ M.BarIcon {
|
||||||
screen: root.bar.screen
|
screen: root.bar.screen
|
||||||
anchorX: root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0)
|
anchorX: root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0)
|
||||||
onMenuClosed: menuLoader.active = false
|
onMenuClosed: menuLoader.active = false
|
||||||
|
onRunCommand: cmd => {
|
||||||
|
runner.command = cmd;
|
||||||
|
runner.running = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue