Discussion:
FVWM: fvwm-menu-desktop improvement: add keybindings to items
Stuart Longland
2012-03-10 01:35:01 UTC
Permalink
Hi all,

I've been a long time user of Linux, and since about 1996, I've moved
between many window managers and desktop environments.

I started out with FVWM, on Red Hat 4.0, and since then have moved
between environments such as FVWM95 (mainly on Slackware), MWM, OLVWM,
WindowMaker, KDE, Gnome (1 & 2), XFCE (3 & 4), LXDE, CTWM, and numerous
others. I still quite often find myself oscillating between KDE and
FVWM; often the former on more high-end systems, and the latter where I
want something minimal.

Recently I've got fed up of KDE's antics, and have started setting up
FVWM2 proper. I wanted a convenient way of updating the menus from the
KDE menus. Luckily, there's fvwm-menu-desktop. However, I struck a
couple of snags.

One, is that the documentation seems out of date. It tells us to use
the --desktop option, which is now "obsolete". Easily fixed once I
realised what was wrong, but still worth noting.

Second, it initially couldn't find the root menu. It was looking for
/etc/xdg/menus/applications.menu, but couldn't find it. I did notice a
"kde-4-applications.menu" however, so I symlinked it, and that worked.

Third thing I noticed, is that there were no keybindings (&-prefixed
characters) generated, and if a menu happened to contain a & symbol,
that symbol was falsely interpreted as a key-binding. So I concocted
the attached patch.

This is a patch against the 2.6.3 release of FVWM's fvwm-menu-desktop.
It first prefixes & characters with a second & so they don't get
gobbled up. Next, it looks for the first letter or digit that isn't
already allocated to another menu item, and prefixes that with an &.
DestroyMenu "FvwmMenu-Utilities"
AddToMenu "FvwmMenu-Utilities" "Utilities" Title
+ "&Akonaditray" Exec akonaditray
+ "A&rk" Exec ark -caption "Ark"
+ "&Disk Utility" Exec palimpsest
+ "&Filelight" Exec filelight
+ "&HP Device Manager" Exec hp-toolbox
+ "&KAlarm" Exec kalarm -caption "KAlarm"
+ "K&Calc" Exec kcalc -caption "KCalc"
+ "KChar&Select" Exec kcharselect -caption "KCharSelect"
+ "KD&E Groupware Wizard" Exec groupwarewizard
+ "K&Gpg" Exec kgpg
+ "K&Jots" Exec kjots -caption "KJots"
+ "K&Notes" Exec knotes
+ "K&TeaTime" Exec kteatime
A better solution might be to see if there is some sort of keybinding
mnemonic field in the .menu file; I didn't look into this, but this
works well enough for my needs, and so I submit it here in the hope it
may be helpful to someone else.

Regards,
--
Stuart Longland (aka Redhatter, VK4MSL) .'''.
Gentoo Linux/MIPS Cobalt and Docs Developer '.'` :
. . . . . . . . . . . . . . . . . . . . . . .'.'
http://dev.gentoo.org/~redhatter :.'

I haven't lost my mind...
...it's backed up on a tape somewhere.
Dan Espen
2012-03-10 02:59:57 UTC
Permalink
Post by Stuart Longland
Hi all,
I've been a long time user of Linux, and since about 1996, I've moved
between many window managers and desktop environments.
I started out with FVWM, on Red Hat 4.0, and since then have moved
between environments such as FVWM95 (mainly on Slackware), MWM, OLVWM,
WindowMaker, KDE, Gnome (1 & 2), XFCE (3 & 4), LXDE, CTWM, and numerous
others. I still quite often find myself oscillating between KDE and
FVWM; often the former on more high-end systems, and the latter where I
want something minimal.
Recently I've got fed up of KDE's antics, and have started setting up
FVWM2 proper. I wanted a convenient way of updating the menus from the
KDE menus. Luckily, there's fvwm-menu-desktop. However, I struck a
couple of snags.
One, is that the documentation seems out of date. It tells us to use
the --desktop option, which is now "obsolete". Easily fixed once I
realised what was wrong, but still worth noting.
Second, it initially couldn't find the root menu. It was looking for
/etc/xdg/menus/applications.menu, but couldn't find it. I did notice a
"kde-4-applications.menu" however, so I symlinked it, and that worked.
Third thing I noticed, is that there were no keybindings (&-prefixed
characters) generated, and if a menu happened to contain a & symbol,
that symbol was falsely interpreted as a key-binding. So I concocted
the attached patch.
This is a patch against the 2.6.3 release of FVWM's fvwm-menu-desktop.
It first prefixes & characters with a second & so they don't get
gobbled up. Next, it looks for the first letter or digit that isn't
already allocated to another menu item, and prefixes that with an &.
DestroyMenu "FvwmMenu-Utilities"
AddToMenu "FvwmMenu-Utilities" "Utilities" Title
+ "&Akonaditray" Exec akonaditray
+ "A&rk" Exec ark -caption "Ark"
+ "&Disk Utility" Exec palimpsest
+ "&Filelight" Exec filelight
+ "&HP Device Manager" Exec hp-toolbox
+ "&KAlarm" Exec kalarm -caption "KAlarm"
+ "K&Calc" Exec kcalc -caption "KCalc"
+ "KChar&Select" Exec kcharselect -caption "KCharSelect"
+ "KD&E Groupware Wizard" Exec groupwarewizard
+ "K&Gpg" Exec kgpg
+ "K&Jots" Exec kjots -caption "KJots"
+ "K&Notes" Exec knotes
+ "K&TeaTime" Exec kteatime
A better solution might be to see if there is some sort of keybinding
mnemonic field in the .menu file; I didn't look into this, but this
works well enough for my needs, and so I submit it here in the hope it
may be helpful to someone else.
Recently I started working on a new version of fvwm-menu-desktop.

Using the new version I'm able to edit menu descriptions using Alacarte
to include "&" where desired and have shortcuts appear in the menus.

Plus it gets the mini-icons right.

I'll redo the documentation when I'm ready to commit the changes.

If you like, I'll send you a copy.
--
Dan Espen
Stuart Longland
2012-03-10 03:20:28 UTC
Permalink
Hi Dan,
Post by Dan Espen
Post by Stuart Longland
A better solution might be to see if there is some sort of keybinding
mnemonic field in the .menu file; I didn't look into this, but this
works well enough for my needs, and so I submit it here in the hope it
may be helpful to someone else.
Recently I started working on a new version of fvwm-menu-desktop.
Using the new version I'm able to edit menu descriptions using Alacarte
to include "&" where desired and have shortcuts appear in the menus.
Plus it gets the mini-icons right.
That sounds even better. I just did a quick hack without really
understanding the full innards of .menu files or fvwm-menu-desktop. :-)
Post by Dan Espen
I'll redo the documentation when I'm ready to commit the changes.
No worries. Let us know when it goes in and I'll pull CVS down and take
it for a spin. Good to know FVWM development is still ticking after all
these years.

(Hmmm... 1993 through to 2012; I do believe that makes next year the
20th anniversary of FVWM.)

Regards,
--
Stuart Longland (aka Redhatter, VK4MSL) .'''.
Gentoo Linux/MIPS Cobalt and Docs Developer '.'` :
. . . . . . . . . . . . . . . . . . . . . . .'.'
http://dev.gentoo.org/~redhatter :.'

I haven't lost my mind...
...it's backed up on a tape somewhere.
Dan Espen
2012-03-10 03:01:58 UTC
Permalink
Post by Stuart Longland
Hi all,
...
Post by Stuart Longland
A better solution might be to see if there is some sort of keybinding
mnemonic field in the .menu file; I didn't look into this,
I did.
I couldn't find anything in the files or the XDG standard for hot keys.
--
Dan Espen
Thomas Adam
2012-03-10 11:44:32 UTC
Permalink
Post by Stuart Longland
Third thing I noticed, is that there were no keybindings (&-prefixed
characters) generated, and if a menu happened to contain a & symbol,
that symbol was falsely interpreted as a key-binding. So I concocted
the attached patch.
The spec does not mention anything about hotkeys, and I can't say I am that
surprised since it's an implementation detail which not all WMs support.

That said, your patch is somewhat redundant anyway, given:

MenuStyle ... AutomaticHotkeys

-- Thomas Adam
--
"It was the cruelest game I've ever played and it's played inside my head."
-- "Hush The Warmth", Gorky's Zygotic Mynci.
Loading...