Re: FVWM: Hostname in root menu

From: Joey Hess <joey_at_kite.preferred.com>
Date: Tue, 17 Sep 1996 15:28:55 -0400 (EDT)

> I am trying to have the root menu (pop-up) have as its title
> the name of the machine it's running on. I assume I might have
> to do something with M4 or CPP but I can't figure out what. I
> don't see anything in the fvwm doc's about putting something in
> the title dynamically. Anyone know if it can be done?

I've done this with M4. I have 3 machines that all use the same fvwmrc
files, and I set up a hostname (and a host icon) in the FvwmButtons bar.
Warning: I am just learning M4, there are probably much better ways to
handle this.

# Handy capitalization functions from the M4 info pages:
define(`UPCASE', `translit(`$*', `a-z',`A-Z')')
define(`DOWNCASE', `translit(`$*', `A-Z', `a-z')')
define(`CAPITALIZE_WORD',`regexp(`$1', `^\(\w\)\(\w*\)',`UPCASE(`\1')`'DOWNCASE(`\2')')')

# Get base hostname, and capitalize 1st letter.
define(NAME_LEN,index(HOSTNAME,`.'))
# If NAME_LEN=-1, there isn't a fqdn.
define(BASENAME,ifelse(NAME_LEN,-1,HOSTNAME,substr(HOSTNAME,0,NAME_LEN)))
define(BASENAME,CAPITALIZE_WORD(BASENAME))
undefine(NAME_LEN)

Then it's just a matter of using BASENAME at some point in the menu
definition. I guess something like this:

AddToMenu "Desktop" "BASENAME" Title
+ ...

-- 
#!/usr/bin/perl -i\$q='$q',\$p='$p';eval\$q.\$\^I\n"#  #  jeh22_at_cornell.edu
$q='print"$p$^I\n',$p='#!/usr/bin/perl -i';eval$q.$^I  #          Joey Hess
      "How appropriate, you fight like a cow." - - Guybrush Threepwood
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_hpc.uh.edu.
To report problems, send mail to fvwm-owner_at_hpc.uh.edu.
Received on Tue Sep 17 1996 - 14:37:21 BST

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:59 BST