aboutsummaryrefslogtreecommitdiff
path: root/src/niri.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-11-08 09:11:56 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2024-11-08 09:11:56 +0300
commit5ff8b89aafca0143866f93dd7e2f27aee6c2b0f5 (patch)
tree79ba91e6291e532555094c9473f07f8dd4bcfb86 /src/niri.rs
parent927abad4b42d36fc5e5bd91839ba54a5d93a89eb (diff)
downloadniri-5ff8b89aafca0143866f93dd7e2f27aee6c2b0f5.tar.gz
niri-5ff8b89aafca0143866f93dd7e2f27aee6c2b0f5.tar.bz2
niri-5ff8b89aafca0143866f93dd7e2f27aee6c2b0f5.zip
Rework output connection to always go through on_output_config_changed()
This has the following benefits: 1. connector_connected() is now more closely mirroring connector_disconnected() in that it merely lights up the connector, and doesn't check if the connector should be off from the config. 2. We can use more complex on/off logic that depends on multiple connectors. For example, this commit adds logic to only disable the laptop panel on lid close if there are other connected outputs. We don't want to disable the laptop panel on lid close if it's the only connected output because it causes screen lockers to create their surface from scratch on normal laptop unsuspend, which is undesirable and also confuses some screen lockers.
Diffstat (limited to 'src/niri.rs')
-rw-r--r--src/niri.rs21
1 files changed, 2 insertions, 19 deletions
diff --git a/src/niri.rs b/src/niri.rs
index 50cf444f..79f99858 100644
--- a/src/niri.rs
+++ b/src/niri.rs
@@ -143,9 +143,8 @@ use crate::ui::screenshot_ui::{OutputScreenshot, ScreenshotUi, ScreenshotUiRende
use crate::utils::scale::{closest_representable_scale, guess_monitor_scale};
use crate::utils::spawning::CHILD_ENV;
use crate::utils::{
- center, center_f64, get_monotonic_time, ipc_transform_to_smithay, is_laptop_panel,
- logical_output, make_screenshot_path, output_matches_name, output_size, send_scale_transform,
- write_png_rgba8,
+ center, center_f64, get_monotonic_time, ipc_transform_to_smithay, logical_output,
+ make_screenshot_path, output_matches_name, output_size, send_scale_transform, write_png_rgba8,
};
use crate::window::{InitialConfigureState, Mapped, ResolvedWindowRules, Unmapped, WindowRef};
use crate::{animation, niri_render_elements};
@@ -4811,22 +4810,6 @@ impl Niri {
.unwrap();
self.pointer_inactivity_timer = Some(token);
}
-
- pub fn should_enable_laptop_panel(&self, connector: &str) -> bool {
- // Make sure the output config is reloaded when any of the conditions in this function
- // change.
-
- let config = self.config.borrow();
-
- // We reload the output config when this flag changes.
- if config.debug.keep_laptop_panel_on_when_lid_is_closed {
- return true;
- }
-
- // We reload the output config when the lid switch is toggled, and the connector name is
- // static.
- !(self.is_lid_closed && is_laptop_panel(connector))
- }
}
pub struct ClientState {