Skip to content

Code that controls power button action #158

Answered by YaLTeR
0xDEAD-C0DE asked this question in Q&A
Discussion options

You must be logged in to vote

Hey, so when you run niri directly, it does not do any power button handling. In this case it's controlled by logind or something like that. So in your case you need to look into logind.conf.

When niri is a session however, it will:

  1. Inhibit the logind power key handling, so that niri can handle it by itself: https://github.com/YaLTeR/niri/blob/main/src/main.rs#L246, https://github.com/YaLTeR/niri/blob/main/src/niri.rs#L1042
  2. When it's pressed, ask logind to suspend: https://github.com/YaLTeR/niri/blob/main/src/backend/tty.rs#L1511

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@0xDEAD-C0DE
Comment options

Answer selected by 0xDEAD-C0DE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants