Skip to content

Monitor Connector Not Populating on Re-Connect #802

@cold-leopard

Description

@cold-leopard

Environment
AGS Commit e169694
Astal Commit Aylur/astal@7d1fac8

flake.lock at bottom for reference

Describe the bug

Gdkmonitor.connector is null when monitor reconnects

To Reproduce

Run the below , disconnect, then reconnect a monitor.

With a 4-monitor setup logs were as below

ags-Message: 11:17:20.052: DP-1
ags-Message: 11:17:20.052: DP-2
ags-Message: 11:17:20.052: HDMI-A-1
ags-Message: 11:17:20.052: DP-3

(gjs:85441): ags-WARNING **: 11:20:49.400: duplicate keys found: [object instance wrapper GType:GdkWaylandMonitor jsobj@0x1d657abed3d0 native@0x422d40]

(gjs:85441): ags-WARNING **: 11:20:49.401: duplicate keys found: [object instance wrapper GType:GdkWaylandMonitor jsobj@0x1d657abed3f8 native@0x422f50]

(gjs:85441): ags-WARNING **: 11:20:51.454: duplicate keys found: [object instance wrapper GType:GdkWaylandMonitor jsobj@0x1d657abed3d0 native@0x422d40]

(gjs:85441): ags-WARNING **: 11:20:51.455: duplicate keys found: [object instance wrapper GType:GdkWaylandMonitor jsobj@0x1d657abed3f8 native@0x422f50]
ags-Message: 11:20:51.455: null

With a single monitor setup, logs were

ags-Message: 11:29:19.786: DP-1
ags-Message: 11:29:27.362: null
import app from "ags/gtk4/app"
import style from "./style.scss"
import { For, This, createBinding } from "ags"

function main() {
	const monitors = createBinding(app, "monitors")
	return (
		<For each={monitors}>
	    {(monitor) =>  (
				<This this={app}>
						{console.log(monitor.connector)}
				</This>
		)}
		</For>
	)
}

app.start({
	main
})

Based on auto-create window on each monitor example https://aylur.github.io/ags/guide/faq.html#auto-create-window-for-each-monitor

Expected behavior

Monitor connector properly populates with name of monitor connector (e.g. "DP-1")

Additional context

Need to get monitor connector for use with AstalRiver.River.getOutput so that the bar on each monitor displays information on the relevant river output, but when re-connecting a monitor (e.g. when waking from suspend) River information no longer populates on bar. A different way to get that working would also be appreciated

Flake.lock below

{
  "nodes": {
    "ags": {
      "inputs": {
        "astal": "astal",
        "nixpkgs": [
          "nixpkgs"
        ]
      },
      "locked": {
        "lastModified": 1764289441,
        "narHash": "sha256-ak+lgFiYE5PHByN1/BRkO5JP498hno6Ix24C1Qf/vec=",
        "owner": "aylur",
        "repo": "ags",
        "rev": "e169694390548dfd38ff40f1ef2163d6c3ffe3ea",
        "type": "github"
      },
      "original": {
        "owner": "aylur",
        "repo": "ags",
        "type": "github"
      }
    },
    "astal": {
      "inputs": {
        "nixpkgs": [
          "ags",
          "nixpkgs"
        ]
      },
      "locked": {
        "lastModified": 1764173295,
        "narHash": "sha256-Jh4VtPcK2Ov+RTcV9FtyQRsxiJmXFQGfqX6jjM7/mgc=",
        "owner": "aylur",
        "repo": "astal",
        "rev": "7d1fac8a4b2a14954843a978d2ddde86168c75ef",
        "type": "github"
      },
      "original": {
        "owner": "aylur",
        "repo": "astal",
        "type": "github"
      }
    },
    "flake-parts": {
      "inputs": {
        "nixpkgs-lib": "nixpkgs-lib"
      },
      "locked": {
        "lastModified": 1768135262,
        "narHash": "sha256-PVvu7OqHBGWN16zSi6tEmPwwHQ4rLPU9Plvs8/1TUBY=",
        "owner": "hercules-ci",
        "repo": "flake-parts",
        "rev": "80daad04eddbbf5a4d883996a73f3f542fa437ac",
        "type": "github"
      },
      "original": {
        "owner": "hercules-ci",
        "repo": "flake-parts",
        "type": "github"
      }
    },
    "nixpkgs": {
      "locked": {
        "lastModified": 1748026580,
        "narHash": "sha256-rWtXrcIzU5wm/C8F9LWvUfBGu5U5E7cFzPYT1pHIJaQ=",
        "owner": "nixos",
        "repo": "nixpkgs",
        "rev": "11cb3517b3af6af300dd6c055aeda73c9bf52c48",
        "type": "github"
      },
      "original": {
        "owner": "nixos",
        "ref": "25.05",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "nixpkgs-lib": {
      "locked": {
        "lastModified": 1765674936,
        "narHash": "sha256-k00uTP4JNfmejrCLJOwdObYC9jHRrr/5M/a/8L2EIdo=",
        "owner": "nix-community",
        "repo": "nixpkgs.lib",
        "rev": "2075416fcb47225d9b68ac469a5c4801a9c4dd85",
        "type": "github"
      },
      "original": {
        "owner": "nix-community",
        "repo": "nixpkgs.lib",
        "type": "github"
      }
    },
    "root": {
      "inputs": {
        "ags": "ags",
        "flake-parts": "flake-parts",
        "nixpkgs": "nixpkgs"
      }
    }
  },
  "root": "root",
  "version": 7
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions