Subject: FVWM: Most used applications?

From: Shay <[email-masked]>
Date: Tue, 04 May 2004 16:58:41 -0500

Is there a way for FVWM to find the most used applications? I'm dreaming 
of a command line interface which automatically builds a root menu for 
quick access to the most often used items.

 -Shay

--
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: Xavier Maillard <[email-masked]>
Date: Wed, 05 May 2004 00:52:09 +0200

On  4 May 2004, Shay wrote:

> Is  there a  way for  FVWM  to find  the most  used applications?  I'm
> dreaming of a command line interface which automatically builds a root
> menu for quick access to the most often used items.

Hummmm, dunno if it exists but I just love the idea yet :)

-- 
 In Gruuik we trust

---

From: Nicholas Paul Johnson <[email-masked]>
Date: Wed, 5 May 2004 00:31:55 -0400 (EDT)

Shay,

I don't think fvwm supports this directly; but you can script it...

If you could wrap all of your apps from a script which keeps a tally of
number of times its been run, then you would be able to create such a 
menu.  Unfortunately, you would still need to restart fvwm before this 
menu is updated.  

So, I wrote an example script (attached as tally.rb, written in ruby, < 60
lines).  One must modify his .fvwm2rc file to use it:

<snip>
	AddToMenu SomeMenu "Apps"
	+ "Browser" Exec exec tally.rb Browser
	+ "Editor" Exec exec tally.rb Editor --some-flag
</snip>

Compared to the original:

<snip>
	AddToMenu SomeMenu "Apps"
	+ "Browser" Exec exec Browser
	+ "Editor" Exec exec Editor --some-flag
</snip>

This script will then generate an fvwm-style menu in some file (the
attached example uses ~/.fvwm_dynamic_menu), which you can include into a
.fvwm2rc (note that you need to restart before changes take effect):

<snip>
	Read .fvwm_dynamic_menu
</snip>

This program could also be used from the command line, i.e.

	nick@home$ tally.rb echo Hello World
	Hello World

But this seems less useful; you cannot supply command line parameters in 
as useful a fashion in programs are launched from a menu.

Hope this helps.
- -- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  Nicholas Paul Johnson
  o nickjohnson \at\ virginia \dot\ edu
  o 3ebf10a7 subkeys.pgp.net
  o http://manjac.ath.cx/nick
  o "When all you've got is a hammer,
    everything looks like a nail.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

---

From: Chris Rouch <[email-masked]>
Date: Wed, 5 May 2004 10:17:07 +0200

On Wed, 5 May 2004 00:31:55 -0400 (EDT)
Nicholas Paul Johnson <[email-masked]> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Shay,
> 
> If you could wrap all of your apps from a script which keeps a tally
> of number of times its been run, then you would be able to create such
> a menu.  Unfortunately, you would still need to restart fvwm before
> this menu is updated.  
>

You can make it dynamic, e.g.

+   "&Most Recent%recent.png%"		    Popup Recent
+ DynamicPopupAction Piperead showrecent

An quick example showrecent script - just to show it is working
dynamically:
#!/bin/bash
cat <<EOF
DestroyMenu recreate "Recent"
AddToMenu Recent
+ "`date`"    Exec exec xmessage ok

EOF

The way I would implement this is to use the launch script to log to a
file what is being run, and use a showrecent script to parse this file
and decide what is appropriate to display in the "Most recent" menu. If
you add a timestamp then you can do this by count or by date. Add a cron
job to clear out everything that is too old and this would be really
sweet.

Time to start hacking.

BTW the DynamicPopupAction stuff is straight out of the man page (fvwm
2.5.10)

Chris

---

From: Spaceborne Calin <[email-masked]>
Date: Wed, 5 May 2004 11:16:10 +0200 (CEST)

--- Shay <[email-masked]> a écrit : > Is there a way for FVWM to
find the most used applications? I'm
> dreaming 

you can always write a cron job which builds a menu based on ps 
output ;-).

Yahoo! Mail - Votre e-mail personnel et gratuit qui vous suit partout !
 Créez votre adresse sur http://mail.yahoo.fr
--
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: Nicholas Paul Johnson <[email-masked]>
Date: Wed, 5 May 2004 17:28:41 -0400 (EDT)

> BTW the DynamicPopupAction stuff is straight out of the man page (fvwm

Sounds like the mechanism to use.  I think I have a working
implementation:

Two scripts: tally.rb (the execution wrapper) and menu.rb (converts the
usage database into a menu).  It sorts them by usage frequency (average
uses per day with second's accuracy) and supports a maximum number of
entries.  menu.rb should be used with DynamicPopupAction...

Example:

<snip>
[nick@manjac rb]$ ./tally.rb xcdroast

[nick@manjac rb]$ ./tally.rb xmms

[nick@manjac rb]$ ./tally.rb xcdroast

[nick@manjac rb]$ ./tally.rb xclock

[nick@manjac rb]$ cat ~/.tally_db 
xclock 1 1083791904
xcdroast 2 1083791870
xmms 1 1083791877     

[nick@manjac rb]$ ./menu.rb 
AddToMenu FrequentMenu "Common Applications" Title
+ "xclock" Exec exec tally.rb xclock # frequency 124.48988376584 uses/day
+ "xcdroast" Exec exec tally.rb xcdroast # frequency 63.2025731382508 uses/day
+ "xmms" Exec exec tally.rb xmms # frequency 37.3364468851539 uses/day

</snip>

(The averages are very large because we're dividing by about 30 seconds or 
so).

The point is, fvwm is great because it's not only configurable by you and 
I, but also by scripts or whatever.  I don't think one could do this kind 
of thing with gnome or kde.

Enjoy,
- --

---

From: Shay <[email-masked]>
Date: Thu, 06 May 2004 12:49:05 -0500

>Sounds like the mechanism to use.  I think I have a working
Whoa. That is very slick and very generous of you. It looks like it 
would be possible to merge your database with the grun database so that 
those programs run through grun would have command line options applied 
when they are re-running through the most-used menu. Thank you for this. 
I'm sure many of us will make use of it.

>of thing with gnome or kde.
You are very right. I got this idea messing around with KDE after 3.2 
came out. Some of the KDE programs are excellent. Knode, in particular 
for reading newsgroups. Knode has nice filtering and displays the number 
of responses under a threaded topic. Kate and Kwrite are also nice and 
Kmail is effortless to set up with SpamAssassin. KDE mouse focus is 
poor, however, and there is no way to make adjustments in focus policy 
for misbehaving programs. With KDE, you pretty much have to live with 
whatever problems/conflics arise from various Linux apps.

I did like the list of frequently used programs at the top of the menu, 
however. Unfortunately, the list was too hard to get to through the 
start button. I'll have the best of both when I get your Ruby scripts 
set up. I might even try to adopt them to a MS style (ME+) menu when 
I've got some time.

 -Shay