summaryrefslogtreecommitdiff
path: root/src/clients
diff options
context:
space:
mode:
Diffstat (limited to 'src/clients')
-rw-r--r--src/clients/mod.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/clients/mod.rs b/src/clients/mod.rs
index 37a88c0..053b4de 100644
--- a/src/clients/mod.rs
+++ b/src/clients/mod.rs
@@ -359,11 +359,17 @@ impl ClientState {
/// Set the new amount of screens, without unmanaging any clients.
fn truncate_screens(&mut self, new_size: usize) {
// hack: working around double borrow stuff
- let mut moved_clients = vec![];
- for old in self.mons.drain(new_size - self.mons.len()..self.mons.len()) {
- moved_clients.extend(old.clients.into_iter());
+ if new_size < self.mons.len() {
+ let mut moved_clients = vec![];
+ for old in self.mons.drain(new_size - self.mons.len()..self.mons.len()) {
+ moved_clients.extend(old.clients.into_iter());
+ }
+ self.mons[0].clients.extend(moved_clients);
+ } else if new_size > self.mons.len() {
+ for _ in 0..new_size - self.mons.len() {
+ self.mons.push(MonitorInfo::default());
+ }
}
- self.mons[0].clients.extend(moved_clients);
}
/// Set the given screen's geometry, resizing the monitor list if necessary.