2008/10/2 Thomas Adam <[EMAIL PROTECTED]>:
> 2008/10/2 Dominik Vogt <[EMAIL PROTECTED]>:
>> On Tue, Sep 30, 2008 at 07:01:56PM +0100, Thomas Adam wrote:
>>> I'm a heavy user of "Style * IndexedWindowName" and was wondering why
>>> it only sets the visible name, and not fw->name.name?
>>
>> I think the reason is that styles depend on the name.
>>
>>> There's several
>>> times where I have thought this to be useful, especially when using
>>> $[w.name] so it returns what I would like to be "foo (n)" rather than
>>> "foo".  Would something like the following be rejected?  I've been
>>> using this tweak for ages now and it doesn't break anything for me.
>>
>> This particular problem could be solved by adding $[w.visible_name].
>
> OK.  I'll send a patch through to do this in due course.  Thanks.

See attached.  This introduces $[w.visiblename].   Comments welcome.
I've been using it for a day now and doesn't seem to break anything
for me.

-- Thomas Adam
? visible-name-expansion.patch
Index: AUTHORS
===================================================================
RCS file: /home/cvs/fvwm/fvwm/AUTHORS,v
retrieving revision 1.128
diff -u -r1.128 AUTHORS
--- AUTHORS	22 Jun 2008 12:04:30 -0000	1.128
+++ AUTHORS	3 Oct 2008 21:48:42 -0000
@@ -13,6 +13,7 @@
 Window style !StickyStippledTitle (and hence StickyStippledTitle).
 Icon style StippledIconTitle and !StickyStippledIconTitle.
 StartShaded style option.
+Introduce the command expansion placeholder:  $[w.visible_name]
 
 Serge (gentoosiast) Koksharov:
 Documentation fixes, bug fixes.
Index: doc/fvwm/expansion.xml
===================================================================
RCS file: /home/cvs/fvwm/fvwm/doc/fvwm/expansion.xml,v
retrieving revision 1.2
diff -u -r1.2 expansion.xml
--- doc/fvwm/expansion.xml	7 Jun 2007 20:09:52 -0000	1.2
+++ doc/fvwm/expansion.xml	3 Oct 2008 21:48:44 -0000
@@ -236,13 +236,13 @@
   <varlistentry>
     <term>
       $[w.name] $[w.iconname] $[w.class] $[w.resource]
-      $[w.iconfile] $[w.miniiconfile] $[w.iconfile.svgopts]
-      $[w.miniiconfile.svgopts]
+      $[w.visiblename] $[w.iconfile] $[w.miniiconfile] 
+      $[w.iconfile.svgopts] $[w.miniiconfile.svgopts]
     </term>
     <listitem>
       <para>
 	The window's name, icon name, resource class and resource name,
-	file name of its icon or mini icon defined with the
+	visible name, file name of its icon or mini icon defined with the
 	<fvwmref cmd="Style" opt="Icon"/> or
 	<fvwmref cmd="Style" opt="MiniIcon"/>
 	style (including the full path if the file was found on disk),
@@ -252,7 +252,7 @@
 	if no window is associated with the command.
       </para>
       <para>
-	Note, the first 4 variables may include any kind of characters, so
+	Note, the first 5 variables may include any kind of characters, so
 	these variables are quoted.  It means that the value is surrounded
 	by single quote characters and any contained single quote is
 	prefixed with a backslash.  This guarantees that commands like:
@@ -260,7 +260,16 @@
 	<programlisting><fvwmref cmd="Style"/> $[w.resource] <fvwmref cmd="Style" opt="Icon"/> norm/network.png</programlisting>
 
 	work correctly, regardless of any special symbols the value may
-	contain, like spaces and different kinds of quotes.
+    contain, like spaces and different kinds of quotes.
+      </para>
+      <para>
+    In the case of the window's visible name, this is the value returned
+    from the literal title of the window shown in the titlebar.  Typically
+    this will be the same as $[w.name] once expanded, although
+    in the case of using <fvwmref cmd="Style" opt="IndexedWindowName"/> then
+    this is more useful a distinction, and allows for referencing the
+    specific window by its visible name for inclusion in things like 
+    <fvwmref cmd="Style"/> commands.
       </para>
     </listitem>
   </varlistentry>
Index: fvwm/expand.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/expand.c,v
retrieving revision 1.40
diff -u -r1.40 expand.c
--- fvwm/expand.c	30 Jan 2007 20:18:35 -0000	1.40
+++ fvwm/expand.c	3 Oct 2008 21:48:45 -0000
@@ -122,6 +122,7 @@
 	"w.id",
 	"w.name",
 	"w.resource",
+	"w.visiblename",
 	"w.width",
 	"w.x",
 	"w.y",
@@ -194,6 +195,7 @@
 	VAR_W_ID,
 	VAR_W_NAME,
 	VAR_W_RESOURCE,
+	VAR_W_VISIBLE_NAME,
 	VAR_W_WIDTH,
 	VAR_W_X,
 	VAR_W_Y,
@@ -550,6 +552,13 @@
 			should_quote = True;
 		}
 		break;
+	case VAR_W_VISIBLE_NAME:
+		if (fw && !IS_EWMH_DESKTOP(FW_W(fw)))
+		{
+			string = fw->visible_name;
+			should_quote = True;
+		}
+		break;
 	case VAR_W_X:
 	case VAR_W_Y:
 	case VAR_W_WIDTH:
@@ -1070,6 +1079,19 @@
 				}
 				break;
 			case 'v':
+				if (fw && !IS_EWMH_DESKTOP(FW_W(fw)))
+				{
+					switch(input[i + 1])
+					{
+						case 'v':
+							if(fw->visible_name)
+							{
+								string = fw->visible_name;
+							}
+							break;
+					}
+				}
+
 				if (Fvwm_VersionInfo)
 				{
 					l2 += strlen(Fvwm_VersionInfo) + 2;

Reply via email to