Make hotkey configuration functionality available from the cmdline (v2)

Changes in v2:
-Add --hotkeys documentation to the man-pages

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
Hans de Goede 2012-12-19 15:56:43 +01:00
parent aecd80ec77
commit 008491a2d9
4 changed files with 36 additions and 0 deletions

View File

@ -52,6 +52,20 @@ page to start a client.
Print debugging information
=item -h HOTKEYS, --hotkeys HOTKEYS
Override the default hotkey bindings with B<HOTKEYS>. Where B<HOTKEYS> is
<action1>=<key1>[+<key2>][,<action2>=<key3>[+<key4>]]. Key-names are
case-insensitive, valid actions are: toggle-fullscreen, release-cursor,
smartcard-insert and smartcard-remove. Examples:
--hotkeys=toggle-fullscreen=shift+f11,release-cursor=shift+f12
--hotkeys=release-cursor=ctrl+alt
Note that hotkeys for which no binding is given are disabled, specifying an
empty string disables all hotkeys.
=back
=head1 EXAMPLES

View File

@ -72,6 +72,20 @@ Start with the window maximised to fullscreen
Print debugging information
=item -h HOTKEYS, --hotkeys HOTKEYS
Override the default hotkey bindings with B<HOTKEYS>. Where B<HOTKEYS> is
<action1>=<key1>[+<key2>][,<action2>=<key3>[+<key4>]]. Key-names are
case-insensitive, valid actions are: toggle-fullscreen, release-cursor,
smartcard-insert and smartcard-remove. Examples:
--hotkeys=toggle-fullscreen=shift+f11,release-cursor=shift+f12
--hotkeys=release-cursor=ctrl+alt
Note that hotkeys for which no binding is given are disabled, specifying an
empty string disables all hotkeys.
=back
=head1 EXAMPLES

View File

@ -197,6 +197,7 @@ main(int argc, char **argv)
gchar **args = NULL;
gchar *uri = NULL;
char *title = NULL;
char *hotkeys = NULL;
gboolean verbose = FALSE;
gboolean debug = FALSE;
gboolean direct = FALSE;
@ -224,6 +225,8 @@ main(int argc, char **argv)
{ "spice-controller", '\0', 0, G_OPTION_ARG_NONE, &controller,
N_("Open connection using Spice controller communication"), NULL },
#endif
{ "hotkeys", 'h', 0, G_OPTION_ARG_STRING, &hotkeys,
N_("Customise hotkeys"), NULL },
{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &args,
NULL, "URI" },
{ NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
@ -302,6 +305,7 @@ main(int argc, char **argv)
NULL);
virt_viewer_window_set_zoom_level(virt_viewer_app_get_main_window(app), zoom);
virt_viewer_app_set_direct(app, direct);
virt_viewer_app_set_hotkeys(app, hotkeys);
if (!virt_viewer_app_start(app))
goto cleanup;

View File

@ -49,6 +49,7 @@ int main(int argc, char **argv)
char *uri = NULL;
int zoom = 100;
gchar **args = NULL;
gchar *hotkeys = NULL;
gboolean verbose = FALSE;
gboolean debug = FALSE;
gboolean direct = FALSE;
@ -80,6 +81,8 @@ int main(int argc, char **argv)
N_("Display debugging information"), NULL },
{ "full-screen", 'f', 0, G_OPTION_ARG_NONE, &fullscreen,
N_("Open in full screen mode"), NULL },
{ "hotkeys", 'h', 0, G_OPTION_ARG_STRING, &hotkeys,
N_("Customise hotkeys"), NULL },
{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &args,
NULL, "DOMAIN-NAME|ID|UUID" },
{ NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
@ -131,6 +134,7 @@ int main(int argc, char **argv)
goto cleanup;
g_object_set(viewer, "fullscreen", fullscreen, NULL);
virt_viewer_app_set_hotkeys(VIRT_VIEWER_APP(viewer), hotkeys);
if (!virt_viewer_app_start(VIRT_VIEWER_APP(viewer)))
goto cleanup;