mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-22 02:01:55 +07:00
handle SIGINT, SIGTERM, SIGHUP
This commit is contained in:
committed by
Ivan Molodetskikh
parent
7a2379ad35
commit
22e43193e0
+15
-1
@@ -9,6 +9,7 @@ use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
use std::{env, mem};
|
||||
|
||||
use calloop::signals::{Signal, Signals};
|
||||
use calloop::EventLoop;
|
||||
use clap::{CommandFactory, Parser};
|
||||
use clap_complete::Shell;
|
||||
@@ -192,8 +193,21 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
store_and_increase_nofile_rlimit();
|
||||
|
||||
// Create the main event loop.
|
||||
let mut event_loop = EventLoop::<State>::try_new().unwrap();
|
||||
|
||||
// Handle Ctrl+C and other signals.
|
||||
event_loop
|
||||
.handle()
|
||||
.insert_source(
|
||||
Signals::new(&[Signal::SIGINT, Signal::SIGTERM, Signal::SIGHUP]).unwrap(),
|
||||
|_, _, state| {
|
||||
state.niri.stop_signal.stop();
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
// Create the compositor.
|
||||
let mut event_loop = EventLoop::try_new().unwrap();
|
||||
let display = Display::new().unwrap();
|
||||
let mut state = State::new(
|
||||
config,
|
||||
|
||||
Reference in New Issue
Block a user