Skip to content

Set wlr_output_head serial number#1575

Merged
Drakulix merged 2 commits intopop-os:masterfrom
duvholt:output-serial-number
Aug 11, 2025
Merged

Set wlr_output_head serial number#1575
Drakulix merged 2 commits intopop-os:masterfrom
duvholt:output-serial-number

Conversation

@duvholt
Copy link
Contributor

@duvholt duvholt commented Aug 10, 2025

This is a follow up on Smithay/smithay#1795 where I added output serial number support in Smithay.

As mentioned in that PR my main use case for adding serial numbers is for Shikane/Kanshi to correctly identify my monitor setup since I have a dual monitor setup with two DELL U2715H.

wlr-randr output after this change:

[..]
DP-5 "Dell Inc. - DELL U2715H - DP-5"
  Make: Dell Inc.
  Model: DELL U2715H
  Serial: GH85D5AL0DWL
[..]

I also plan to extend cosmic-randr to show serial number as it is currently only shown when using cosmic-randr list --kdl right now.

Copy link
Member

@Drakulix Drakulix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@Drakulix Drakulix merged commit 1db1d81 into pop-os:master Aug 11, 2025
2 of 3 checks passed
@hojjatabdollahi
Copy link
Contributor

@duvholt are you telling me I don't have to open cosmic settings and re-arrange my monitors every time I connect my dock at work? 🥹

@Drakulix
Copy link
Member

@duvholt are you telling me I don't have to open cosmic settings and re-arrange my monitors every time I connect my dock at work? 🥹

Tbf, serial numbers aren't the perfect solution to these issues (though I am glad to provide some infrastructure to support scripting things like these via kanshi/shikane given we support the relevant protocol anyway). There are (especially no-name) monitors reporting the same serial number for all monitors of the same model.

The correct solution here is unfortunately hashing/comparing the whole EDID (something which really isn't very user-friendly). We already started using that for pinned-workspaces to experiment more with this approach. The goal is to eventually extend this to the stored output config, so you'll get stable positions/layouts in these circumstances as well.

@hojjatabdollahi
Copy link
Contributor

Ah! Thanks for the explanation.
I just tested it by pinning a workspace per monitor, unplugged my dock and plugged it back in and even though the displays were rearranged (You can tell since the cursor jumps from the left monitor to the right and then the middle) but the workspaces stayed on the correct monitor. That's awesome.

Can't wait until that lands for the display config too. Thank you.

@hojjatabdollahi
Copy link
Contributor

@Drakulix Just FYI, after this PR if I connect my external monitors cosmic-settings wouldn't show anything in the display page. This is being printed out open cosmic-settings:

  ERROR  error fetching displays, why: "`cosmic-randr` KDL format error"
    at cosmic-settings/src/pages/display/mod.rs:623 on main

The only difference between the kdl output of my internal display and the external one is the serial_number field, so I tried disabling it.

Commenting out the bit in cosmic-randr that prints out the serial_number fixed the issue for me.

diff --git a/cli/src/main.rs b/cli/src/main.rs
index 6865a36..81b0ec1 100644
--- a/cli/src/main.rs
+++ b/cli/src/main.rs
@@ -683,9 +683,9 @@ fn list_kdl(context: &Context) {
                 })
                 "\n"
             }
-            if !head.serial_number.is_empty() {
-                "  serial_number=\"" (head.serial_number) "\"\n"
-            }
+            // if !head.serial_number.is_empty() {
+            //     "  serial_number=\"" (head.serial_number) "\"\n"
+            // }
             "  modes {"
         );

It looks like cosmic-settings does not have a field for "serial number" and it wasn't a problem before since cosmic-comp wasn't passing that to cosmic-randr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants