Add keybinding

This commit is contained in:
Marius Meisenzahl 2022-12-29 15:22:14 +01:00
parent 5041a0f63a
commit 8312895b99
3 changed files with 16 additions and 0 deletions

View File

@ -282,6 +282,8 @@ namespace Gala {
screenshot_accellabel.accel_string = gala_keybind_settings.get_strv ("window-screenshot")[0];
hide_others_accellabel.accel_string = gala_keybind_settings.get_strv ("hide-others")[0];
close.visible = Gala.WindowFlags.CAN_CLOSE in flags;
if (close.visible) {
close_accellabel.accel_string = keybind_settings.get_strv ("close")[0];

View File

@ -206,6 +206,11 @@
<summary>The shortcut to enable picture-in-picture window</summary>
<description>The shortcut to show the selection area to choose a window.</description>
</key>
<key type="as" name="hide-others">
<default><![CDATA[['<Super><Shift>h']]]></default>
<summary>Shortcut to hide other windows</summary>
<description></description>
</key>
</schema>
<schema path="/org/pantheon/desktop/gala/appearance/" id="org.pantheon.desktop.gala.appearance">

View File

@ -261,6 +261,9 @@ namespace Gala {
display.add_keybinding ("area-screenshot-clip", keybinding_settings, 0, (Meta.KeyHandlerFunc) handle_screenshot);
#endif
var gala_keybinding_settings = new GLib.Settings ("org.pantheon.desktop.gala.keybindings");
display.add_keybinding ("hide-others", gala_keybinding_settings, 0, (Meta.KeyHandlerFunc) handle_hide_others);
display.overlay_key.connect (() => {
launch_action ("overlay-action");
});
@ -481,6 +484,12 @@ namespace Gala {
}
}
[CCode (instance_pos = -1)]
void handle_hide_others (Meta.Display display, Meta.Window? window,
Clutter.KeyEvent event, Meta.KeyBinding binding) {
perform_action (Gala.ActionType.HIDE_OTHERS);
}
private void on_gesture_detected (Gesture gesture) {
if (workspace_view.is_opened ()) {
return;