WindowManager: handle empty action keys (#1290)

This commit is contained in:
Danielle Foré 2021-11-05 16:37:25 -07:00 committed by GitHub
parent e55b62d834
commit 72869e0e34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -243,27 +243,15 @@ namespace Gala {
display.add_keybinding ("cycle-workspaces-previous", keybinding_settings, 0, (Meta.KeyHandlerFunc) handle_cycle_workspaces);
display.overlay_key.connect (() => {
try {
Process.spawn_command_line_async (
behavior_settings.get_string ("overlay-action")
);
} catch (Error e) { warning (e.message); }
launch_action ("overlay-action");
});
Meta.KeyBinding.set_custom_handler ("panel-main-menu", () => {
try {
Process.spawn_command_line_async (
behavior_settings.get_string ("panel-main-menu-action")
);
} catch (Error e) { warning (e.message); }
launch_action ("panel-main-menu-action");
});
Meta.KeyBinding.set_custom_handler ("toggle-recording", () => {
try {
Process.spawn_command_line_async (
behavior_settings.get_string ("toggle-recording-action")
);
} catch (Error e) { warning (e.message); }
launch_action ("toggle-recording-action");
});
Meta.KeyBinding.set_custom_handler ("switch-to-workspace-up", () => {});
@ -365,6 +353,15 @@ namespace Gala {
return false;
}
private void launch_action (string action_key) {
try {
var action = behavior_settings.get_string (action_key);
if (action != null && action != "") {
Process.spawn_command_line_async (action);
}
} catch (Error e) { warning (e.message); }
}
void on_show_background_menu (int x, int y) {
if (daemon_proxy == null) {
return;