Skip to content

Commit

Permalink
Ordering on screens by true x position (sminez#198)
Browse files Browse the repository at this point in the history
* Ordering on screens by true x position

Will give correct screen ordering

* `sort_by_key` and no PartialOrd
  • Loading branch information
teo8192 authored Nov 27, 2021
1 parent e0c9ba7 commit 6edc98a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/core/manager/screens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,12 @@ impl Screens {

debug!(?workspace_ordering, "current workspace ordering");

let detected: Vec<Screen> = state
.current_screens()?
let mut detected: Vec<Screen> = state.current_screens()?;

// sort the screens to be in the correct order
detected.sort_by_key(|s| s.true_region.x);

let detected = detected
.into_iter()
.zip(workspace_ordering)
.enumerate()
Expand Down
2 changes: 1 addition & 1 deletion src/core/screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::core::data_types::{Point, Region};
pub struct Screen {
/// The current workspace index being displayed
pub wix: usize,
true_region: Region,
pub(crate) true_region: Region,
effective_region: Region,
}

Expand Down

0 comments on commit 6edc98a

Please sign in to comment.