Saturday, September 8, 2012

Re: Setting WM_CLASS

On 09/09/12 07:13, Benjamin R. Haskell wrote:
> On Sun, 9 Sep 2012, Tony Mechelynck wrote:
>
>> On 08/09/12 23:02, Benjamin R. Haskell wrote:
>>> On Sat, 8 Sep 2012, Marco wrote:
>>>
>>>> is it possible to set the WM_CLASS of gVim to a custom value?
>>>
>>> If you're using a GTK version of gvim, you should be able to pass the
>>> '--class' commandline argument.
>>>
>>> [...]
>>>
>>> Not sure this is documented anywhere. [...]
>>
>> It is not documented in the Vim help AFAICT. But looking down that
>> list suggests (and experiment shows) that typing
>>
>> vim -?
>>
>> at a Unix-like shell prompt will give the help for GTK and GNOME
>> command-line arguments if your "vim" binary was compiled with GNOME
>> GUI support. However Vim still starts the editor in that case, so
>>
>> vim -? -cq
>>
>> is better. You will still get an E852 error and a hit-Enter prompt
>> after the help; just hit Enter to go back to the shell prompt.
>
> `vim -?` gets me:
>
> VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Sep 9 2012 00:49:50)
> Unknown option argument: "-?"
> More info with: "vim -h"
>
> So, "-?" must be handled by something guarded by FEAT_GNOME.

Yes, as I said ("[...] if your "vim" binary was compiled with GNOME GUI
support.")

>
>
>> Or else,
>>
>> vim --help
>> or
>> vim --help |less
>>
>> will give _both_ the Vim command-line help and the GTK/GNOME
>> command-line help (if compiled-in). That's quite a lot of console
>> output, hence the |less redirection.
>
> `gvim --help` doesn't explain the "--name" or "--class" options, despite
> having a section with the heading:
>
> Arguments recognized by gvim (GTK+ version):
>
> Were the options just overlooked?
>

In this case too, it's part of the same #ifdef FEAT_GUI_GNOME section:
look just before the #if 0: these are gui_gtk_x11.c lines 333-365:

/* Arguments handled by GTK (and GNOME) internally. */
{"--g-fatal-warnings", ARG_FOR_GTK},
{"--gdk-debug", ARG_FOR_GTK|ARG_HAS_VALUE},
{"--gdk-no-debug", ARG_FOR_GTK|ARG_HAS_VALUE},
{"--gtk-debug", ARG_FOR_GTK|ARG_HAS_VALUE},
{"--gtk-no-debug", ARG_FOR_GTK|ARG_HAS_VALUE},
{"--gtk-module", ARG_FOR_GTK|ARG_HAS_VALUE},
{"--sync", ARG_FOR_GTK},
{"--display", ARG_FOR_GTK|ARG_HAS_VALUE|ARG_COMPAT_LONG},
{"--name", ARG_FOR_GTK|ARG_HAS_VALUE|ARG_COMPAT_LONG},
{"--class", ARG_FOR_GTK|ARG_HAS_VALUE|ARG_COMPAT_LONG},
{"--screen", ARG_FOR_GTK|ARG_HAS_VALUE},
{"--gxid-host", ARG_FOR_GTK|ARG_HAS_VALUE},
{"--gxid-port", ARG_FOR_GTK|ARG_HAS_VALUE},
#ifdef FEAT_GUI_GNOME
{"--load-modules", ARG_FOR_GTK|ARG_HAS_VALUE},
{"--sm-client-id", ARG_FOR_GTK|ARG_HAS_VALUE},
{"--sm-config-prefix", ARG_FOR_GTK|ARG_HAS_VALUE},
{"--sm-disable", ARG_FOR_GTK},
{"--oaf-ior-fd", ARG_FOR_GTK|ARG_HAS_VALUE},
{"--oaf-activate-iid", ARG_FOR_GTK|ARG_HAS_VALUE},
{"--oaf-private", ARG_FOR_GTK},
{"--enable-sound", ARG_FOR_GTK},
{"--disable-sound", ARG_FOR_GTK},
{"--espeaker", ARG_FOR_GTK|ARG_HAS_VALUE},
{"-?", ARG_FOR_GTK|ARG_NEEDS_GUI},
{"--help", ARG_FOR_GTK|ARG_NEEDS_GUI|ARG_KEEP},
{"--usage", ARG_FOR_GTK|ARG_NEEDS_GUI},
# if 0 /* conflicts with Vim's own --version argument */
{"--version", ARG_FOR_GTK|ARG_NEEDS_GUI},
# endif
{"--disable-crash-dialog", ARG_FOR_GTK},

No comments: