[PATCH:app/setxkbmap] Add -query option to print current RLMVO settings
Alan Coopersmith
alan.coopersmith at sun.com
Thu Oct 8 16:55:18 PDT 2009
Signed-off-by: Alan Coopersmith <alan.coopersmith at sun.com>
---
When a user asked on #xorg today how to see their current settings, I
couldn't find a better answer than "xprop -root _XKB_RULES_NAMES", so I
made one that was a little less user hostile.
setxkbmap.c | 12 +++++++++++-
setxkbmap.man | 4 ++++
2 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/setxkbmap.c b/setxkbmap.c
index 721e2ee..32e55b2 100644
--- a/setxkbmap.c
+++ b/setxkbmap.c
@@ -85,6 +85,7 @@
/***====================================================================***/
static Bool print = False;
+static Bool query = False;
static Bool synch = False;
static int verbose = 5;
@@ -240,6 +241,7 @@ usage(int argc, char **argv)
MSG("-model <name> Specifies model used to choose component names\n");
MSG("-option <name> Adds an option used to choose component names\n");
MSG("-print Print a complete xkb_keymap description and exit\n");
+ MSG("-query Print the current layout settings and exit\n");
MSG("-rules <name> Name of rules file to use\n");
MSG("-symbols <name> Specifies symbols component name\n");
MSG("-synch Synchronize request w/X server\n");
@@ -254,6 +256,8 @@ dumpNames(Bool wantRules, Bool wantCNames)
{
if (wantRules)
{
+ if (svValue[RULES_NDX])
+ MSG1("rules: %s\n", svValue[RULES_NDX]);
if (svValue[MODEL_NDX])
MSG1("model: %s\n", svValue[MODEL_NDX]);
if (svValue[LAYOUT_NDX])
@@ -430,6 +434,8 @@ parseArgs(int argc, char **argv)
}
else if (streq(argv[i], "-print"))
print = True;
+ else if (streq(argv[i], "-query"))
+ query = True;
else if (streq(argv[i], "-rules"))
ok = setOptString(&i, argc, argv, RULES_NDX, FROM_CMD_LINE);
else if (streq(argv[i], "-symbols"))
@@ -977,7 +983,7 @@ applyComponentNames(void)
dumpNames(False, True);
}
/* Upload the new description to the server. */
- if (dpy && !print)
+ if (dpy && !print && !query)
{
XkbComponentNamesRec cmdNames;
cmdNames.types = svValue[TYPES_NDX];
@@ -1008,6 +1014,10 @@ applyComponentNames(void)
{
printKeymap();
}
+ if (query)
+ {
+ dumpNames(True, False);
+ }
return True;
}
diff --git a/setxkbmap.man b/setxkbmap.man
index f3f44b4..4c1a8f4 100644
--- a/setxkbmap.man
+++ b/setxkbmap.man
@@ -85,6 +85,10 @@ acceptable by \fBxkbcomp\fP (an XKB keymap compiler) and exits. The option
can be used for tests instead of a verbose option and in cases when one needs
to run both the \fBsetxkbmap\fP and the \fBxkbcomp\fP in chain (see below).
.TP 8
+.B \-query
+With this option the \fBsetxkbmap\fP just prints the current rules, model,
+layout, variant, and options.
+.TP 8
.B \-rules \fIfile\fP
Specifies the name of the rules file used to resolve the requested layout
and model to a set of component names.
--
1.5.6.5
More information about the xorg-devel
mailing list