[virt-tools-list] [PATCH 2/2] Make hotkey configuration functionality available from the cmdline (v2)

Hans de Goede hdegoede at redhat.com
Mon Jan 7 10:49:42 UTC 2013


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

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 man/remote-viewer.pod    | 14 ++++++++++++++
 man/virt-viewer.pod      | 14 ++++++++++++++
 src/remote-viewer-main.c |  4 ++++
 src/virt-viewer-main.c   |  4 ++++
 4 files changed, 36 insertions(+)

diff --git a/man/remote-viewer.pod b/man/remote-viewer.pod
index e8337ed..3bbb2e9 100644
--- a/man/remote-viewer.pod
+++ b/man/remote-viewer.pod
@@ -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
diff --git a/man/virt-viewer.pod b/man/virt-viewer.pod
index f2830f8..e2a5754 100644
--- a/man/virt-viewer.pod
+++ b/man/virt-viewer.pod
@@ -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
diff --git a/src/remote-viewer-main.c b/src/remote-viewer-main.c
index 540d9de..048f6b4 100644
--- a/src/remote-viewer-main.c
+++ b/src/remote-viewer-main.c
@@ -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;
diff --git a/src/virt-viewer-main.c b/src/virt-viewer-main.c
index 8dca48b..8ac061a 100644
--- a/src/virt-viewer-main.c
+++ b/src/virt-viewer-main.c
@@ -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;
 
-- 
1.8.0.2




More information about the virt-tools-list mailing list