Skip to content

HyprlandMonitor.activeWorkspace does not update on both monitors #837

@qriaa

Description

@qriaa

Context

I am running a multi-monitor setup with Hyprland. The following bug prevents me from using the workspaces api, I am forced to use the hyprctl -j commands.

Version:

$ quickshell --version
Quickshell 0.3.0 (revision 4b4fca3224ab977dc515ac0bb78d00b3dfa71e00, distributed by AUR (package: quickshell-git))
$ pacman -Q qt6-base
qt6-base 6.11.1-1

Bug reproduction

  1. Save the following file to $XDG_CONFIG_HOME/test/shell.qml
import QtQuick
import Quickshell
import Quickshell.Hyprland

ShellRoot {
    Variants {
        id: variants
        model: Quickshell.screens;

        Scope {
            id: scope
            required property var modelData
            property ShellScreen screen: modelData

            property var monitor: Hyprland.monitorFor(screen)

            Connections {
                target: monitor
                function onActiveWorkspaceChanged() {
                    console.log(monitor.name);
                    console.log(monitor.activeWorkspace.id)
                }
            }
        }
    }
}
  1. Make sure you have workspace 1 on the first monitor, workspace 2 on the second monitor (this works with any workspace number, this is for the example)
  2. Run qs -c test
  3. The console prints out monitors and the present workspaces on them
  4. On a tty in the first monitor, run hyprctl dispatch 'hl.dsp.focus({ workspace = "2", on_current_monitor = true })' (such that the workspaces swap places)
  5. Observe that quickshell prints only the monitor and workspace of the destination monitor
  6. Focus any window on the second monitor
  7. Observe that quickshell only now does print the second monitor's updated workspace

Desired behavior

Upon swapping the workspaces, both monitors should be affected by the change in the moment of the swap, not when they are focused

Workaround

I use Processes calling hyprctl monitors -j (and others), triggered by Hyprland.onRawEvent signal handler. This provides me with up-to-date data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions