diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-04-29 23:45:12 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-04-29 23:45:12 +1000 |
| commit | 2fd1e90d57378e7335bf72496d4787cddbed890f (patch) | |
| tree | 811ce727710bf0404f6c1009d7daab8331cd9fd3 /services/Hyprland.qml | |
| parent | bar: animate tray recolour (diff) | |
| download | caelestia-shell-2fd1e90d57378e7335bf72496d4787cddbed890f.tar.gz caelestia-shell-2fd1e90d57378e7335bf72496d4787cddbed890f.tar.bz2 caelestia-shell-2fd1e90d57378e7335bf72496d4787cddbed890f.zip | |
bar: fix activewindow
Diffstat (limited to 'services/Hyprland.qml')
| -rw-r--r-- | services/Hyprland.qml | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/services/Hyprland.qml b/services/Hyprland.qml index 92f1de5..336be73 100644 --- a/services/Hyprland.qml +++ b/services/Hyprland.qml @@ -11,7 +11,7 @@ Singleton { property list<Client> clients: [] readonly property var workspaces: Hyprland.workspaces readonly property var monitors: Hyprland.monitors - readonly property Client activeClient: Client {} + property Client activeClient: null readonly property HyprlandWorkspace activeWorkspace: focusedMonitor?.activeWorkspace ?? null readonly property HyprlandMonitor focusedMonitor: Hyprland.monitors.values.find(m => m.lastIpcObject.focused) ?? null @@ -54,25 +54,30 @@ Singleton { id: getActiveClient command: ["sh", "-c", "hyprctl -j activewindow | jq -c"] stdout: SplitParser { - onRead: data => root.activeClient.lastIpcObject = JSON.parse(data) + onRead: data => { + const client = JSON.parse(data); + root.activeClient = client.address ? clientComp.createObject(root, { + lastIpcObject: client + }) : null; + } } } component Client: QtObject { - property var lastIpcObject - property string address: lastIpcObject?.address ?? "" - property string wmClass: lastIpcObject?.class ?? "" - property string title: lastIpcObject?.title ?? "" - property string initialClass: lastIpcObject?.initialClass ?? "" - property string initialTitle: lastIpcObject?.initialTitle ?? "" - property int x: (lastIpcObject?.at ?? [])[0] ?? 0 - property int y: (lastIpcObject?.at ?? [])[1] ?? 0 - property int width: (lastIpcObject?.size ?? [])[0] ?? 0 - property int height: (lastIpcObject?.size ?? [])[1] ?? 0 - property HyprlandWorkspace workspace: Hyprland.workspaces.values.find(w => w.id === lastIpcObject?.workspace?.id) ?? null - property bool floating: lastIpcObject?.floating ?? false - property bool fullscreen: lastIpcObject?.fullscreen ?? false - property int pid: lastIpcObject?.pid ?? 0 + required property var lastIpcObject + property string address: lastIpcObject.address + property string wmClass: lastIpcObject.class + property string title: lastIpcObject.title + property string initialClass: lastIpcObject.initialClass + property string initialTitle: lastIpcObject.initialTitle + property int x: lastIpcObject.at[0] + property int y: lastIpcObject.at[1] + property int width: lastIpcObject.size[0] + property int height: lastIpcObject.size[1] + property HyprlandWorkspace workspace: Hyprland.workspaces.values.find(w => w.id === lastIpcObject.workspace.id) ?? null + property bool floating: lastIpcObject.floating + property bool fullscreen: lastIpcObject.fullscreen + property int pid: lastIpcObject.pid } Component { |