| @@ -1980,6 +1980,9 @@ impl WindowManager { |
| 1980 |
self.apply_rules(window)?; |
1980 |
self.apply_rules(window)?; |
| 1981 |
|
1981 |
|
| 1982 |
let updated_monitor_index = self.clients.get(&window).map(|c| c.monitor_index).unwrap_or(monitor_index); |
1982 |
let updated_monitor_index = self.clients.get(&window).map(|c| c.monitor_index).unwrap_or(monitor_index); |
|
|
1983 |
+ let updated_monitor = self.monitors.get(updated_monitor_index).cloned().unwrap_or(monitor.clone()); |
|
|
1984 |
+ let is_rule_floating = self.clients.get(&window).map(|c| c.is_floating).unwrap_or(false); |
|
|
1985 |
+ |
| 1983 |
self.attach_aside(window, updated_monitor_index); |
1986 |
self.attach_aside(window, updated_monitor_index); |
| 1984 |
self.attach_stack(window, updated_monitor_index); |
1987 |
self.attach_stack(window, updated_monitor_index); |
| 1985 |
|
1988 |
|
| @@ -2032,10 +2035,48 @@ impl WindowManager { |
| 2032 |
.border_width(border_width) |
2035 |
.border_width(border_width) |
| 2033 |
.stack_mode(StackMode::ABOVE), |
2036 |
.stack_mode(StackMode::ABOVE), |
| 2034 |
)?; |
2037 |
)?; |
|
|
2038 |
+ } else if is_rule_floating && !is_transient && !is_dialog { |
|
|
2039 |
+ let mut adjusted_x = window_x; |
|
|
2040 |
+ let mut adjusted_y = window_y; |
|
|
2041 |
+ |
|
|
2042 |
+ if adjusted_x + (window_width as i32) + (2 * border_width as i32) > updated_monitor.screen_x + updated_monitor.screen_width as i32 { |
|
|
2043 |
+ adjusted_x = updated_monitor.screen_x + updated_monitor.screen_width as i32 - (window_width as i32) - (2 * border_width as i32); |
|
|
2044 |
+ } |
|
|
2045 |
+ if adjusted_y + (window_height as i32) + (2 * border_width as i32) > updated_monitor.screen_y + updated_monitor.screen_height as i32 { |
|
|
2046 |
+ adjusted_y = updated_monitor.screen_y + updated_monitor.screen_height as i32 - (window_height as i32) - (2 * border_width as i32); |
|
|
2047 |
+ } |
|
|
2048 |
+ adjusted_x = adjusted_x.max(updated_monitor.screen_x); |
|
|
2049 |
+ adjusted_y = adjusted_y.max(updated_monitor.screen_y); |
|
|
2050 |
+ |
|
|
2051 |
+ if let Some(client) = self.clients.get_mut(&window) { |
|
|
2052 |
+ client.x_position = adjusted_x as i16; |
|
|
2053 |
+ client.y_position = adjusted_y as i16; |
|
|
2054 |
+ client.width = window_width as u16; |
|
|
2055 |
+ client.height = window_height as u16; |
|
|
2056 |
+ } |
|
|
2057 |
+ |
|
|
2058 |
+ self.update_geometry_cache(window, CachedGeometry { |
|
|
2059 |
+ x_position: adjusted_x as i16, |
|
|
2060 |
+ y_position: adjusted_y as i16, |
|
|
2061 |
+ width: window_width as u16, |
|
|
2062 |
+ height: window_height as u16, |
|
|
2063 |
+ border_width: border_width as u16, |
|
|
2064 |
+ }); |
|
|
2065 |
+ |
|
|
2066 |
+ self.connection.configure_window( |
|
|
2067 |
+ window, |
|
|
2068 |
+ &ConfigureWindowAux::new() |
|
|
2069 |
+ .x(adjusted_x) |
|
|
2070 |
+ .y(adjusted_y) |
|
|
2071 |
+ .width(window_width) |
|
|
2072 |
+ .height(window_height) |
|
|
2073 |
+ .border_width(border_width) |
|
|
2074 |
+ .stack_mode(StackMode::ABOVE), |
|
|
2075 |
+ )?; |
| 2035 |
} |
2076 |
} |
| 2036 |
|
2077 |
|
| 2037 |
let is_normie_layout = self.layout.name() == "normie"; |
2078 |
let is_normie_layout = self.layout.name() == "normie"; |
| 2038 |
- if is_normie_layout && !is_transient && !is_dialog { |
2079 |
+ if is_normie_layout && !is_transient && !is_dialog && !is_rule_floating { |
| 2039 |
if let Ok(pointer) = self.connection.query_pointer(self.root)?.reply() { |
2080 |
if let Ok(pointer) = self.connection.query_pointer(self.root)?.reply() { |
| 2040 |
let cursor_monitor = self.get_monitor_at_point(pointer.root_x as i32, pointer.root_y as i32) |
2081 |
let cursor_monitor = self.get_monitor_at_point(pointer.root_x as i32, pointer.root_y as i32) |
| 2041 |
.and_then(|idx| self.monitors.get(idx)) |
2082 |
.and_then(|idx| self.monitors.get(idx)) |