Skip to content

fix: pass current refresh rate to cosmic-randr when changing monitor position - #2139

Merged
mmstick merged 3 commits into
pop-os:masterfrom
NotYourAlejandro:position-refresh-rate-fix
Aug 20, 2026
Merged

mmstick merged 3 commits into
pop-os:masterfrom
NotYourAlejandro:position-refresh-rate-fix

Conversation

@NotYourAlejandro

Copy link
Copy Markdown
Contributor

Hello,

I've had a really strange and specific issue while using the COSMIC settings app where changing the display position specifically on my secondary ASUS VG249 monitor would set the refresh rate of the monitor to 60hz even though it was already set to 144hz.

This seems to happen when constructing the cosmic-randr command to call. The command called sets only the position of the monitor which different monitors tend to handle differently. The low-level explanation is above me at the moment, but specifying the refresh rate explicitly in the constructed cosmic-randr command appears to fix the issue at best and does nothing at worst.

I thought that cosmic-randr was trying to select the refresh rate of the monitor's default mode, but that doesn't seem to hold on my TV as it's default mode is 3560x2560@60 (had it set to 2560x1440@120 in the demo) so in theory it should have set the refresh rate to 60, but that didn't happen. Any other ideas/theories are welcome!

Here's a demo of the issue along with a demo of the fixed build: https://github.com/user-attachments/assets/5ffa3d3d-a9c9-4e62-843d-a7af72be4061

Testers would be greatly appreciated if you're also seeing this issue yourself!

Should also fix the following quote within the description of the issue pop-os/cosmic-epoch#1540:

If you then click the offending monitor and try to reposition it, after the screen flashes black and comes back the refresh rate setting will have been changed back to 60 Hz.

  • I have disclosed use of any AI generated code in my commit messages.
    • If you are using an LLM, and do not fully understand the changes it is making to the code base, do not create a PR.
    • In our experience, AI generated code often results in overly complex code that lacks enough context for a proper fix or feature inclusion. This results in considerably longer code reviews. Due to this, AI authored or partially authored PRs may be closed without comment.
  • I understand these changes in full and will be able to respond to review comments.
  • My change is accurately described in the commit message.
  • My contribution is tested and working as described.
  • I have read the Developer Certificate of Origin and certify my contribution under its conditions.

Please let me know if any improvements need to be made!
-- Alex

mmstick
mmstick previously approved these changes Aug 9, 2026
@mmstick
mmstick requested a review from a team August 9, 2026 03:36
@jacobktm jacobktm self-assigned this Aug 13, 2026
@jacobktm

Copy link
Copy Markdown

This PR has made it so that the displays can't be re-positioned by dragging anymore. They snap back to where they started from.

@NotYourAlejandro

NotYourAlejandro commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor Author

This PR has made it so that the displays can't be re-positioned by dragging anymore. They snap back to where they started from.

Apologies for the delay, could you provide the version of cosmic-randr you have installed so I can reproduce your issue? Additionally, if you run cosmic-settings from this PR from the CLI, are there any error messages that appear when changing screen position?

Edit: I'm also interested in what refresh rate your affected monitor is set to.

@jacobktm

jacobktm commented Aug 19, 2026 •

Copy link
Copy Markdown

This is what I see when I run cosmic-settings from the terminal:

system76@pop-os:~$ cosmic-settings
  ERROR  error loading system dark theme, error: GetKey("list_button", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at /build/cosmic-settings-BinEGs/cosmic-settings-1.0.12~1786131942~24.04~1144004/vendor/libcosmic/src/theme/mod.rs:95 on main

  ERROR  Failed to read config 'accessibility_zoom', err: GetKey("accessibility_zoom", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/accessibility/magnifier.rs:55 on main

  ERROR  shortcuts custom config error: GetKey("custom", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at /build/cosmic-settings-BinEGs/cosmic-settings-1.0.12~1786131942~24.04~1144004/vendor/cosmic-settings-config/src/shortcuts/mod.rs:42 on main

  ERROR  1:1: Expected identifier
    at cosmic-settings/src/pages/desktop/appearance/theme_manager.rs:62 on main

  ERROR  Failed to load Panel system config., err: GetKey("padding_overlap", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/desktop/panel/mod.rs:91 on main

  ERROR  Failed to load Panel system config., err: GetKey("keep_style_on_maximize", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/desktop/panel/mod.rs:91 on main

  ERROR  Error when loading Panel container config., err: GetKey("padding_overlap", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/desktop/panel/inner.rs:68 on main

  ERROR  Error when loading Panel container config., err: GetKey("keep_style_on_maximize", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/desktop/panel/inner.rs:68 on main

  ERROR  Error when loading Panel container config., err: GetKey("padding_overlap", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/desktop/panel/inner.rs:68 on main

  ERROR  Error when loading Panel container config., err: GetKey("keep_style_on_maximize", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/desktop/panel/inner.rs:68 on main

  ERROR  Failed to load Dock system config., err: GetKey("padding_overlap", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/desktop/dock/mod.rs:135 on main

  ERROR  Failed to load Dock system config., err: GetKey("keep_style_on_maximize", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/desktop/dock/mod.rs:135 on main

  ERROR  Error when loading Panel container config., err: GetKey("padding_overlap", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/desktop/panel/inner.rs:68 on main

  ERROR  Error when loading Panel container config., err: GetKey("keep_style_on_maximize", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/desktop/panel/inner.rs:68 on main

  ERROR  Error when loading Panel container config., err: GetKey("padding_overlap", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/desktop/panel/inner.rs:68 on main

  ERROR  Error when loading Panel container config., err: GetKey("keep_style_on_maximize", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/desktop/panel/inner.rs:68 on main

  ERROR  Failed to read config 'focus_follows_cursor', err: GetKey("focus_follows_cursor", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/desktop/window_management.rs:49 on main

  ERROR  Failed to read config 'cursor_follows_focus', err: GetKey("cursor_follows_focus", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/desktop/window_management.rs:57 on main

  ERROR  Failed to read config 'focus_follows_cursor_delay', err: GetKey("focus_follows_cursor_delay", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/desktop/window_management.rs:66 on main

  ERROR  Failed to read config 'active_hint', err: GetKey("active_hint", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/desktop/window_management.rs:75 on main

  ERROR  Failed to read config 'edge_snap_threshold', err: GetKey("edge_snap_threshold", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/desktop/window_management.rs:84 on main

  ERROR  shortcuts custom config error: GetKey("custom", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at /build/cosmic-settings-BinEGs/cosmic-settings-1.0.12~1786131942~24.04~1144004/vendor/cosmic-settings-config/src/shortcuts/mod.rs:42 on main

  ERROR  Failed to read config 'workspaces', err: GetKey("workspaces", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/desktop/workspaces.rs:40 on main

  ERROR  Failed to read config 'input_default', why: GetKey("input_default", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/input/mod.rs:51 on main

  ERROR  Failed to read config 'workspaces', err: GetKey("workspaces", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/input/touchpad.rs:26 on main

  ERROR  Failed to read config 'descale_xwayland', err: GetKey("descale_xwayland", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/applications/legacy_applications.rs:53 on main

  ERROR  Failed to read config 'xwayland_eavesdropping', err: GetKey("xwayland_eavesdropping", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/applications/legacy_applications.rs:62 on main

  ERROR  error loading system dark theme, error: GetKey("list_button", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at /build/cosmic-settings-BinEGs/cosmic-settings-1.0.12~1786131942~24.04~1144004/vendor/libcosmic/src/theme/mod.rs:95 on main

Error: ModeNotFound
Error: ModeNotFound
Error: ModeNotFound
Error: ModeNotFound
Error: ModeNotFound
Error: ModeNotFound
Error: ModeNotFound
Error: ModeNotFound
Error: ModeNotFound

The Error: ModeNotFound happens every time I try to drag either of the displays.

and the cosmic-randr version is:

system76@pop-os:~$ apt policy cosmic-randr
cosmic-randr:
  Installed: 0.1.0~1771011327~24.04~6e8e795
  Candidate: 0.1.0~1771011327~24.04~6e8e795
  Version table:
 *** 0.1.0~1771011327~24.04~6e8e795 1001
       1001 http://apt.pop-os.org/release noble/main amd64 Packages
        100 /var/lib/dpkg/status

Edit: Both displays are set to 144Hz, when they were both set to 60Hz this doesn't happen, though.

@NotYourAlejandro

Copy link
Copy Markdown
Contributor Author

@jacobktm Thank you! Could you also send me the output of cosmic-randr list?

@jacobktm

Copy link
Copy Markdown

Here is the output of cosmic-randr list:

system76@pop-os:~$ cosmic-randr list
eDP-1 (enabled)
  Make: BOE
  Model: 0x08B3
  Physical Size: 350 x 190 mm
  Position: 1920,0
  Scale: 100%
  Transform: normal
  Adaptive Sync Support: false
  Adaptive Sync: false
  Xwayland primary: false

  Modes:
    1920x1080 @ 144.003 Hz (current) (preferred)
    1920x1080 @  59.997 Hz
HDMI-A-4 (enabled)
  Make: Shenzhen KTC Technology Group
  Model: H24T09P
  Physical Size: 530 x 300 mm
  Position: 0,0
  Scale: 100%
  Transform: normal
  Adaptive Sync Support: false
  Adaptive Sync: false
  Xwayland primary: true

  Modes:
    1920x1080 @ 164.999 Hz
    1920x1080 @ 144.002 Hz (current)
    1920x1080 @ 120.000 Hz
    1920x1080 @ 119.996 Hz
    1920x1080 @ 119.879 Hz
    1920x1080 @  60.000 Hz
    1920x1080 @  59.996 Hz (preferred)
    1920x1080 @  59.939 Hz
    1920x1080 @  50.000 Hz
    1680x1050 @  59.954 Hz
     1600x900 @  60.000 Hz
     1440x900 @  59.887 Hz
    1280x1024 @  75.025 Hz
    1280x1024 @  60.020 Hz
     1280x720 @ 119.879 Hz
     1280x720 @  60.000 Hz
     1280x720 @  59.943 Hz
     1152x864 @  59.997 Hz
     1024x768 @  75.029 Hz
     1024x768 @  60.004 Hz
      800x600 @  75.000 Hz
      800x600 @  60.317 Hz
      720x480 @  59.940 Hz
      640x480 @  75.000 Hz
      640x480 @  59.940 Hz

@NotYourAlejandro

Copy link
Copy Markdown
Contributor Author

@jacobktm Thank you, that was very helpful!

I suspect cosmic-randr is rounding the refresh rate to the nearest whole integer while my patch is simply rounding up when passing the CLI flag. I'll investigate specifically how cosmic-randr interprets the refresh rate flag and get a patch in soon when I've got time.


task.arg("mode")
.arg("--refresh")
.arg(format!("{}.{:03}", rate / 1000, rate % 1000))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We use integer math for the refresh rate, like so

@NotYourAlejandro

Copy link
Copy Markdown
Contributor Author

Whoops, I thought I saw cosmic-randr accept only whole integer refresh rates, but I must've tested that wrong. Especially as that was how it was done directly below that.

@jacobktm Can you give it another shot?

@jacobktm jacobktm left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This has passed regression testing. # Testing

This document provides a regression testing checklist for COSMIC Settings and the COSMIC Settings Daemon. The checklist provides a starting point for Quality Assurance reviews.

Checklist

Network & Wireless

Wi-Fi

  • Able to disconnect from and connect to a network.

Bluetooth

  • Bluetooth device connects.
  • Paired device can be disconnected & reconnected.
  • Paired device can be forgotten & connecting again works.

Desktop

Wallpaper

  • Clicking a different wallpaper switches to it immediately
  • Leaving the page and coming back does not change the wallpaper

Appearance

  • Open a COSMIC app and a GNOME app. When switching between Dark and Light mode, the COSMIC app switches immediately, and the GNOME app switches after restarting.
  • Changing the accent color works.
  • Changing the roundness style works and does not affect other aspects of the theme (e.g. color mode).
  • Changing the interface density works.

Panel

  • Enable tiling. "Automatically hide panel" takes effect immediately.
  • Disable tiling; maximize a window. "Automatically hide panel" takes effect immediately.

Dock

  • Enable tiling. "Automatically hide dock" takes effect immediately.
  • Disable tiling; maximize a window. "Automatically hide dock" takes effect immediately.
  • Changing position on screen works.
  • All Style settings take effect as expected.

Displays

  • Plug in a second display. Displays can be rearranged via dragging.

Sound

  • Output & Input volume sliders work independently
  • Output balance slider works & doesn't get reset by volume slider
  • Amplification toggles work as expected
  • Device profiles can be changed & reflect as expected on the main Sound page

Power & Battery

  • Changing power mode takes effect and is reflected by top panel applet.

Input Devices

Touchpad

  • All click behavior settings work as expected.
  • All scrolling settings work as expected.

Applications

Default Applications

  • Changing the default terminal affects Super-T shortcut.

X11 Applications Compatibility

  • Global Shortcuts in X11 Applications work (in e.g. Discord).

Time & Language

Date & Time

  • Changing time zone works.
  • Toggling 24-hour time takes effect in Settings preview, on top panel, and on the lock screen.
  • Toggling seconds takes effect in Settings preview and on top panel.
  • Changing first day of week takes effect in Calendar applet.
  • Turning date on/off for applet works.

System & Accounts

About

  • Changing hostname works (check terminal prompt).

Looks good now, thanks!

@mmstick
mmstick merged commit 2b43c92 into pop-os:master Aug 20, 2026
7 checks passed
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