tty: Skip initialization if session is inactive
Browse files at this commit084f2cb1930986b043e1dc9432b432a12bf30e38Parent: 25c88b51 changed file +8 -0
- src/backend/tty.rs +8 -0
src/backend/tty.rsmodified+8 -0
| @@ -519,6 +519,14 @@ impl Tty { | |||
| 519 | } | 519 | } |
| 520 | 520 | ||
| 521 | pub fn init(&mut self, niri: &mut Niri) { | 521 | pub fn init(&mut self, niri: &mut Niri) { |
| 522 | + // If the session is inactive, skip initialization because we won't be able to do much with | ||
| 523 | + // the devices anyway. We'll get ActivateSession and add the devices there instead. | ||
| 524 | + // | ||
| 525 | + // This can happen when starting niri while having a different TTY active (e.g. via tmux). | ||
| 526 | + if !self.session.is_active() { | ||
| 527 | + return; | ||
| 528 | + } | ||
| 529 | + | ||
| 522 | let udev = self.udev_dispatcher.clone(); | 530 | let udev = self.udev_dispatcher.clone(); |
| 523 | let udev = udev.as_source_ref(); | 531 | let udev = udev.as_source_ref(); |
| 524 | 532 | ||