bbidulock / icewm

A window manager designed for speed, usability, and consistency
Other
577 stars 98 forks source link

Optionally display .desktop GenericName and/or Comment for menu items #646

Closed cheapy closed 2 years ago

cheapy commented 2 years ago

The freedesktop specs https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html say the Comment field is the one to use for a tooltip when the user hovers a menu option long enough (based on tooltipdelay). All three fields are usually translated that I've seen.

A short program name on the menu like "Arandr" might make sense to experienced Linux folks, but to most people (even some distro reviewers) it is cryptic. If we had the option to make it say "Arandr-Screen Settings" on the menu and optionally if you hovered a while a tooltip saying "Set Screen Settings" popped up, it would be much more friendly.

Is there a way to optionally build the GenericName and Comment into IceWM's menu syntax? I was thinking the GenericName (if different from the Name) could suffix the menu text for that menu item, and the tooltip Comment could be separated with a special separator or delimiter for the tooltip text? For my example below I used "|" as the tooltip separator, but I'm probably not the most knowledgeable person as to what would work best.

An option to ShowGenericName and another to ShowToolTip would need to control the menu generator.

Example: geany.desktop file relevant contents: Name=Geany GenericName=Integrated Development Environment Comment=A fast and lightweight IDE using GTK+

prog "Name[-GenericName]|[Comment]" iconfilename programfilename[ programparameters]

prog "Geany-Integrated Development Environment|A fast and lightweight IDE using GTK+" geany.png geany

When displaying the toolbar, currently the menu text pops up as a tooltip. That might still be ok.

Perhaps there is a better way? I was trying to accomplish this without breaking existing menu file syntax.

gijsbers commented 2 years ago

You can try this commit for the generic name. See the updated manpage.

The tooltip is difficult to do, because icewm shows a menu with a X server grab and then the timers for tooltips don't work.

cheapy commented 2 years ago

Thanks, I'll give it a try tonight.

Getting the generic name was the most important, thanks

cheapy commented 2 years ago

The results are quite good, and it does well on most menu options, but my definition wasn't perfect.
I said: I was thinking the GenericName (if different from the Name) could suffix the menu text for that menu item

I should have said: I was thinking the GenericName (if the case insensitive string not in the Name field) could suffix the menu text for that menu item

examples where all words were redundant with text in the name: prog "Meld Diff Viewer (Diff Viewer)" org.gnome.meld meld prog "Brave Web Browser (Web Browser)" brave-browser /usr/bin/brave-browser-stable prog "Firefox ESR Web Browser (Web Browser)" firefox-esr /usr/lib/firefox-esr/firefox-esr prog "LibreOffice (Office)" libreoffice-startcenter libreoffice prog "VLC media player (Media player)" vlc icewm-menu-fdo "/usr/share//applications/vlc.desktop"

gijsbers commented 2 years ago

Very well. Please try again.

cheapy commented 2 years ago

That cleaned up the rest, thanks. Its good to go. I will try asking the package authors to adjust the .desktop files they provide on any left that are unclear.

I saw you encased the generic name in (). It keeps the ones where the generic name was added from blending in seamlessly, but makes it clear whether what you see is what the authors referred to as the name or the short description. Being the Dev, I expect you are a better judge than I which is best.

Thanks again for your speedy assistance.