Commit a71053e4 authored by Bilal Elmoussaoui's avatar Bilal Elmoussaoui

a18y: add handy keyboard shortcuts

parent 95775bf4
......@@ -86,6 +86,7 @@ mod imp {
}),
);
application.set_accels_for_action("app.quit", &["<Control>q"]);
application.set_accels_for_action("app.skip-tour", &["Escape"]);
self.parent_startup(application);
}
}
......
use gtk::prelude::*;
use gtk::{
gdk,
glib::{self, clone},
subclass::prelude::*,
};
......@@ -68,6 +69,19 @@ mod imp {
.connect_position_notify(clone!(@weak obj => move |_| {
obj.update_position();
}));
let controller = gtk::EventControllerKey::new();
controller.connect_key_pressed(clone!(@weak obj => @default-return gtk::Inhibit(true), move |_controller, keyval, _keycode, _state| {
if keyval == gdk::Key::Right {
obj.try_next();
} else if keyval == gdk::Key::Left {
obj.try_previous();
}
gtk::Inhibit(false)
}));
obj.add_controller(&controller);
self.parent_constructed(obj);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment