Subject: FVWM: problems with All command

From: "Thomas R. Dean" <[email-masked]>
Date: Mon, 23 Jun 2003 21:16:59 -0400

Hi. I've been using fvwm since I don't remember when, somewhere back
around Redhat 5 anyways. Great WM, not as heavyweight as some
of the others, and not as visually busy as the others as well.

Anyhow, I just recently upgraded the Motherboard in my system and
the keyboard.  The new keyboard has multimedia keys and I wanted
to used them to control XMMS.  I also have a mac powerbook and having
the volume keys work regardless of the application is very convenient.

Target System is RedHat 9,  FVWM version 2.4.16.

So i've done the following:
  Used xmodmap in .xinitrc to bind XF86AudioRaiseVolume, etc. to the
   appropriate keycodes. (and verified with xev)

Added the following to my .fvwm2rc:

Key XF86AudioRaiseVolume A A    ALL (XMMS*) Echo up $[w.id] $[w.name]
Key XF86AudioLowerVolume A A    ALL (XMMS*) Echo down $[w.id] $[w.name]
Key XF86AudioMute A A    ALL (XMMS*) Echo mute $[w.id] $[w.name]

I was going to replace echo with an exec to execute a command that will
send an KP_Up or KP_Down event directly to the XMMS window (which
will adjust the volume).  As I understand the man page, the $[w.id] is 
supposed to return
the window id that the command is called on. There are two xmms windows, the
main control and the playlist window.  Each press of the button should 
echo two window
ids (and the window name).

If the focus is on the root, then the correct window ids  and titles are 
echoed:

  0x1400066 XMMS - song title info
  0x14000cf  XMMS Playlist

All is well so far. However, if any window has the focus then I get the
window id of the window with the focus -- twice. So if the focus is on
an xterm, I get two lines of:
    up 0x1200026 xterm.

I've looked through several months worth of archive and used google to 
search
the site, but I haven't found any help.

Do I have the correct interpretation of $[w.id]? If not, what should I use?

I supposed I could write a command that searches all windows on the root
for one with the title XMMS, but that seems to be a bit of a waste if it
is already there in the window manager.

Thanks in advance..

Tom.

--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Dominik Vogt <[email-masked]>
Date: Tue, 24 Jun 2003 08:55:48 +0200

> Do I have the correct interpretation of $[w.id]? If not, what should I use?

  All (XMMS*) Echo $[w.id]

is actually two commands and thus the $[w.id] string is expanded
twice.  The first time is *before* the All command is run.  At
that moment, the context window is the window with the focus and
$[w.id] is replaced by its window id.  You need to protect the
$[w.id] from this step of variable expansion by adding additional
'$'s in front of it (even for me it's usually trial and error to
find out the correct number of '$'s):

  Key foo a a  All (XMMS*) Echo $$$[w.id]
                               ^^^^^

Bye

Dominik ^_^  ^_^

---

From: Kingsly John <[email-masked]>
Date: Tue, 24 Jun 2003 12:38:17 +0530

> Key XF86AudioMute A A    ALL (XMMS*) Echo mute $[w.id] $[w.name]

I think you are making things unnecessarily complex...

Here is what I use.. works for all apps and not just XMMS! And I run the OSD
Mixer from osdsh .. so I get a really cool meter on the bottom of the screen
when I'm changing the settings!

Here are the relevant lines from my .fvwm2rc ...

#Sound Controls....

#Master Volume
Key XF86AudioLowerVolume A N Exec /usr/bin/aumix -v -3
Key XF86AudioRaiseVolume A N Exec /usr/bin/aumix -v +3
#PCM Volume
Key XF86AudioLowerVolume A M Exec /usr/bin/aumix -w -3
Key XF86AudioRaiseVolume A M Exec /usr/bin/aumix -w +3
#Bass
Key XF86AudioLowerVolume A C Exec /usr/bin/aumix -b -3
Key XF86AudioRaiseVolume A C Exec /usr/bin/aumix -b +3
#Treble
Key XF86AudioLowerVolume A 4 Exec /usr/bin/aumix -t -3
Key XF86AudioRaiseVolume A 4 Exec /usr/bin/aumix -t +3
#Mute
Key XF86AudioMute A A Exec /usr/bin/amixer -c1 sset Master toggle

#XMMS Specific controls..

Key XF86AudioPlay  A N Exec /usr/bin/xmms -t
Key XF86AudioStop  A N Exec /usr/bin/xmms -s
Key XF86AudioPrev  A N Exec /usr/bin/xmms -r
Key XF86AudioNext  A N Exec /usr/bin/xmms -f

(you will have to change the Mute command.. I have two sound cards and use
Alsa)

Kingsly

---

From: "Thomas R.Dean" <[email-masked]>
Date: Tue, 24 Jun 2003 20:18:36 -0400

Ahh. Thanks. It's obvious when pointed out.
  It was the fact that it worked in the root window that threw me
off. But then looking at the man page, $[w.id] resolves to the text
if there is no window bound at the time of the command. So
it gets passed as is to the ALL command in that case.

Thanks for the help.

Tom.