Skip to content

fix: no longer input locks when TTY is switched before full compositor#3593

Open
Atan-D-RP4 wants to merge 1 commit intoniri-wm:mainfrom
Atan-D-RP4:fix/tty-switch-freeze
Open

fix: no longer input locks when TTY is switched before full compositor#3593
Atan-D-RP4 wants to merge 1 commit intoniri-wm:mainfrom
Atan-D-RP4:fix/tty-switch-freeze

Conversation

@Atan-D-RP4
Copy link

This fixes the case of starting Niri from a separate TTY (via Tmux or a TTY switch before full startup) and then switching to that Niri session causing an input lock.

I hack on Niri mostly in separate TTY and this behavior was a super annoying blocker. Resolving it required either restarting my computer (since all input was blocked) or sshing into my machine and killing that Niri session.

@YaLTeR
Copy link
Member

YaLTeR commented Mar 11, 2026

Do other compositors do something similar?

@Atan-D-RP4
Copy link
Author

I can only confirm that Hyprland has the same problem, from my own experience and testing for this.

From what I can tell, both Mutter and Kwin use systemd-logind to manage inactive VT and defer input processing until it sends active session signal to them.

@YaLTeR
Copy link
Member

YaLTeR commented Mar 11, 2026

From what I can tell, both Mutter and Kwin use systemd-logind to manage inactive VT and defer input processing until it sends active session signal to them.

That's also what niri does

@YaLTeR
Copy link
Member

YaLTeR commented Mar 11, 2026

Maybe it doesn't do so at startup? Does mutter also call libinput suspend at startup?

@Atan-D-RP4
Copy link
Author

Atan-D-RP4 commented Mar 11, 2026

Maybe it doesn't do so at startup? Does mutter also call libinput suspend at startup?

I checked and no it does not. Which might be why it also has this same issue, from my testing.
I can't even fully switch to Kwin's session before my entire screen is locked, with only a frozen TTY visible to me.

@Sempyos Sempyos added area:session Screen locking, idle inhibit, suspend/resume pr kind:fix Issue fixes, code cleanups labels Mar 12, 2026
@YaLTeR
Copy link
Member

YaLTeR commented Mar 12, 2026

Huh. I want to be careful here then if this is a bit of an uncharted ground. Perhaps a better solution is, when the session is inactive at startup, call on_session_event() with session suspended, and let it handle libinput suspend and others?

@Atan-D-RP4 Atan-D-RP4 force-pushed the fix/tty-switch-freeze branch from f723854 to 2673383 Compare March 12, 2026 06:20
@Atan-D-RP4
Copy link
Author

Atan-D-RP4 commented Mar 12, 2026

I want to be careful here then if this is a bit of an uncharted ground.

Seems to be the case, though I don't know why. Do devs not use separate TTY during development? I ran into this right away when I started hacking on Niri.

Anyway, now using event_loop.insert_idle to insert PauseSession event.

@YaLTeR
Copy link
Member

YaLTeR commented Mar 12, 2026

Any reason for using an idle rather than calling it in init()?

@Atan-D-RP4
Copy link
Author

Atan-D-RP4 commented Mar 12, 2026

I didn't know better. I've played around with the insert_idle for something else, saw it was there reached for it.
Doing it in Tty::init() is actually much cleaner.

@Atan-D-RP4 Atan-D-RP4 force-pushed the fix/tty-switch-freeze branch from 2673383 to f723854 Compare March 12, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:session Screen locking, idle inhibit, suspend/resume pr kind:fix Issue fixes, code cleanups

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants