mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 17:10:40 -05:00
keybindings: Add a switch-monitor builtin keybinding
Moved from g-s-d's media keys plugin, where it was called "video-out", since it requires changing the current monitor configuration and we want to remove the old DBus API. This implementation is intentionally simple and not really meant for more than debugging and validating the various configurations. A better user experience will be introduced in gnome-shell with a custom keybinding handler. The default value includes <Super>P in addition to the standard keysym for historical reasons. https://bugzilla.gnome.org/show_bug.cgi?id=781906
This commit is contained in:
parent
3f9c5823cb
commit
7e330bd65f
@ -156,6 +156,11 @@
|
||||
<summary>Cancel tab popup</summary>
|
||||
</key>
|
||||
|
||||
<key name="switch-monitor" type="as">
|
||||
<default><![CDATA[['<Super>p','XF86Display']]]></default>
|
||||
<summary>Switch monitor configurations</summary>
|
||||
</key>
|
||||
|
||||
<key name="rotate-monitor" type="as">
|
||||
<default><![CDATA[['XF86RotateWindows']]]></default>
|
||||
<summary>Rotates the built-in monitor configuration</summary>
|
||||
|
@ -3328,6 +3328,27 @@ handle_switch_vt (MetaDisplay *display,
|
||||
}
|
||||
#endif /* HAVE_NATIVE_BACKEND */
|
||||
|
||||
static void
|
||||
handle_switch_monitor (MetaDisplay *display,
|
||||
MetaScreen *screen,
|
||||
MetaWindow *window,
|
||||
ClutterKeyEvent *event,
|
||||
MetaKeyBinding *binding,
|
||||
gpointer dummy)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaMonitorManager *monitor_manager =
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
MetaMonitorSwitchConfigType config_type =
|
||||
meta_monitor_manager_get_switch_config (monitor_manager);
|
||||
|
||||
if (!meta_monitor_manager_can_switch_config (monitor_manager))
|
||||
return;
|
||||
|
||||
config_type = (config_type + 1) % (META_MONITOR_SWITCH_CONFIG_UNKNOWN);
|
||||
meta_monitor_manager_switch_config (monitor_manager, config_type);
|
||||
}
|
||||
|
||||
static void
|
||||
handle_rotate_monitor (MetaDisplay *display,
|
||||
MetaScreen *screen,
|
||||
@ -3632,6 +3653,13 @@ init_builtin_key_bindings (MetaDisplay *display)
|
||||
META_KEYBINDING_ACTION_SET_SPEW_MARK,
|
||||
handle_set_spew_mark, 0);
|
||||
|
||||
add_builtin_keybinding (display,
|
||||
"switch-monitor",
|
||||
mutter_keybindings,
|
||||
META_KEY_BINDING_NONE,
|
||||
META_KEYBINDING_ACTION_SWITCH_MONITOR,
|
||||
handle_switch_monitor, 0);
|
||||
|
||||
add_builtin_keybinding (display,
|
||||
"rotate-monitor",
|
||||
mutter_keybindings,
|
||||
|
@ -357,6 +357,7 @@ typedef enum _MetaKeyBindingAction
|
||||
META_KEYBINDING_ACTION_OVERLAY_KEY,
|
||||
META_KEYBINDING_ACTION_ISO_NEXT_GROUP,
|
||||
META_KEYBINDING_ACTION_ALWAYS_ON_TOP,
|
||||
META_KEYBINDING_ACTION_SWITCH_MONITOR,
|
||||
META_KEYBINDING_ACTION_ROTATE_MONITOR,
|
||||
|
||||
META_KEYBINDING_ACTION_LAST
|
||||
|
Loading…
Reference in New Issue
Block a user