mirror of
https://gitlab.freedesktop.org/pipewire/helvum
synced 2026-03-16 03:56:12 +08:00
Add a ^Q accel to quit
This is a somewhat standard shortcut used in many GTK applications.
This commit is contained in:
committed by
Ryuukyu
parent
b417ad9827
commit
aab1f1bde3
@@ -2,6 +2,7 @@ mod pipewire_connection;
|
||||
mod pipewire_state;
|
||||
mod view;
|
||||
|
||||
use gtk::glib::{self, clone};
|
||||
use gtk::prelude::*;
|
||||
|
||||
use std::{cell::RefCell, rc::Rc};
|
||||
@@ -82,6 +83,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
window.show();
|
||||
});
|
||||
|
||||
let quit = gtk::gio::SimpleAction::new("quit", None);
|
||||
quit.connect_activate(clone!(@weak app => move |_, _| {
|
||||
app.quit();
|
||||
}));
|
||||
app.set_accels_for_action("app.quit", &["<Control>Q"]);
|
||||
app.add_action(&quit);
|
||||
|
||||
app.run(&std::env::args().collect::<Vec<_>>());
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user