[PR #1343] [MERGED] fix(wm): use preferred id when caching monitors #1339

Closed
opened 2026-01-05 14:54:56 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/LGUG2Z/komorebi/pull/1343
Author: @alex-ds13
Created: 3/13/2025
Status: Merged
Merged: 3/13/2025
Merged by: @LGUG2Z

Base: masterHead: fix/use-preferred-id-on-cache


📝 Commits (1)

  • c68f79b fix(wm): use preferred id when caching monitors

📊 Changes

6 files changed (+38 additions, -17 deletions)

View changed files

📝 komorebi/src/lib.rs (+3 -2)
📝 komorebi/src/monitor_reconciliator/mod.rs (+23 -3)
📝 komorebi/src/process_command.rs (+1 -1)
📝 komorebi/src/static_config.rs (+8 -8)
📝 komorebi/src/window_manager.rs (+1 -1)
📝 komorebi/src/windows_api.rs (+2 -2)

📄 Description

Use the preferred id set by the user as the key when caching monitors. This way if a user is having issues with the device_id on their system they can use the serial_number_id on display_index_preferences. If instead a user is having issues with the serial_number_id they can make sure to use the device_id on display_index_preferences. Komorebi will use the preferred one as a key when caching the monitors.

@LGUG2Z This PR also includes a change of the DISPLAY_INDEX_PREFERENCES from a Mutex to RwLock. I believe the RwLock is better since it allows multiple readers at the same time, while the mutex blocks on all calls even if you just want to read or compare some value. For display index preferences (same thing applies to other existing mutexes) most times we access it is a read-only access. We only ever change it when applying a config or when a command is used to change it. Every other use is a read-only use so it doesn't make sense to block on those situations.
If you don't think this is a necessary change I can remove it from this PR though! Just say the word!


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/LGUG2Z/komorebi/pull/1343 **Author:** [@alex-ds13](https://github.com/alex-ds13) **Created:** 3/13/2025 **Status:** ✅ Merged **Merged:** 3/13/2025 **Merged by:** [@LGUG2Z](https://github.com/LGUG2Z) **Base:** `master` ← **Head:** `fix/use-preferred-id-on-cache` --- ### 📝 Commits (1) - [`c68f79b`](https://github.com/LGUG2Z/komorebi/commit/c68f79b5c3219946466cc6c431c02d2474c10659) fix(wm): use preferred id when caching monitors ### 📊 Changes **6 files changed** (+38 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `komorebi/src/lib.rs` (+3 -2) 📝 `komorebi/src/monitor_reconciliator/mod.rs` (+23 -3) 📝 `komorebi/src/process_command.rs` (+1 -1) 📝 `komorebi/src/static_config.rs` (+8 -8) 📝 `komorebi/src/window_manager.rs` (+1 -1) 📝 `komorebi/src/windows_api.rs` (+2 -2) </details> ### 📄 Description Use the preferred id set by the user as the key when caching monitors. This way if a user is having issues with the `device_id` on their system they can use the `serial_number_id` on `display_index_preferences`. If instead a user is having issues with the `serial_number_id` they can make sure to use the `device_id` on `display_index_preferences`. Komorebi will use the preferred one as a key when caching the monitors. @LGUG2Z This PR also includes a change of the `DISPLAY_INDEX_PREFERENCES` from a `Mutex` to `RwLock`. I believe the `RwLock` is better since it allows multiple readers at the same time, while the mutex blocks on all calls even if you just want to read or compare some value. For display index preferences (same thing applies to other existing mutexes) most times we access it is a read-only access. We only ever change it when applying a config or when a command is used to change it. Every other use is a read-only use so it doesn't make sense to block on those situations. If you don't think this is a necessary change I can remove it from this PR though! Just say the word! <!-- Please follow the Conventional Commits specification. If you need to update your PR with changes from `master`, please run `git rebase master`. By opening this PR, you confirm that you have read and understood this project's `CONTRIBUTING.md`. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-01-05 14:54:56 +01:00
adam closed this issue 2026-01-05 14:54:56 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/komorebi#1339