Results 1 to 4 of 4

Thread: Action Menus

  1. #1
    Join Date
    Oct 2008
    Location
    Mojave desert
    Posts
    357

    Default Action Menus

    In your desktop's application launcher menu, right-click the icon for LibreOffice. See how it gives a menu of Writer, Calc, etc? That's called an action menu. Have you ever wished you had something similar for some other program's variants? For instance, Hugin, the Panorama Stitcher, makes 3 entries in your graphics sub-menu, and DisplayCAL, a program you will use only rarely if you've a need for it at all, makes 9, which may well be more than half of all entries in the submenu.

    Here's how to make an action menu.

    First you need to know that the *.desktop entries from which your menu is assembled live in /usr/share/applications, but the items in that directory are over-ridden by whatever's in /home/<user>/.local/share/applications. Start by copying the relevant *.desktop entries to the local directory. Sometimes the names are weird, but you can probably find them quickly by scanning for their icons.

    For all the main entries you wish to replace with action menu entries, edit the corresponding *.desktop file and append the line "NoDisplay=true" - it's case sensitive. The local entry will over-ride the global entry, and it won't change. You COULD edit the global entry instead, but the next software update could undo all your hard work.

    In the main *.desktop file, add the action menu. First, under the line "[Desktop Entry]" add a new line that says "Actions=1;2;3;4;" and so on, depending on how many entries your action menu will have. I think you need a semi-colon even after the last entry - in any case the referents I've seen all have one. As for the numerals, you can replace them with words if you want, because they're just labels.

    Above that line that says "[Desktop Entry]" type the following for each item in the action menu:

    [Desktop Action 1]
    Name=
    Exec=
    Icon=

    Again, this is case-sensitive. Instead of 1, use whatever label corresponds to what you typed in the action list (and they'll appear as ordered in that list). After those equals signs, cut and paste whatever was in the *.desktop files you're replacing. Here are some examples, where the code replaces [Desktop Entry] in the original file:

    Scilab.desktop
    Code:
    [Desktop Action scinotes]
    Name=scinotes
    Exec=xterm -title "Scilab launcher: DO NOT CLOSE" -e scinotes
    Icon=scinotes
    
    
    [Desktop Action xcos]
    Name=xcos
    Exec=xterm -title "Scilab launcher: DO NOT CLOSE" -e xcos
    Icon=xcos
    
    
    [Desktop Entry]
    Actions=scinotes;xcos;
    DisplayCAL.desktop
    Code:
    [Desktop Action LUT]
    Name=3D LUT Maker
    Exec=displaycal-3dlut-maker
    Icon=displaycal-3dlut-maker
    
    
    [Desktop Action Curve]
    Name=Curve Viewer
    Exec=displaycal-curve-viewer
    Icon=displaycal-curve-viewer
    
    
    [Desktop Action Profile-Info]
    Name=Profile Infor
    Exec=displaycal-profile-info
    Icon=displaycal-profile-info
    
    
    [Desktop Action Profile-Loader]
    Name=Profile Loader
    Exec=displaycal-apply-profiles --force
    Icon=displaycal-apply-profiles
    
    
    [Desktop Action Scripting]
    Name=Scripting Client
    Exec=displaycal-scripting-client
    Icon=displaycal-scripting-client
    
    
    [Desktop Action Synth-Profile]
    Name=Synthetic Profile
    Exec=displaycal-synthprofile
    Icon=displaycal-synthprofile
    
    
    [Desktop Action Testchart]
    Name=Testchart Editor
    Exec=displaycal-testchart-editor
    Icon=displaycal-testchart-editor
    
    
    [Desktop Action Converter]
    Name=VRML to X3D Converter
    Exec=displaycal-vrml-to-x3d-converter %F
    Icon=displaycal-vrml-to-x3d-converter
    
    
    [Desktop Entry]
    Actions=LUT;Curve;Profile-Info;Profile-Loader;Scripting;Synth-Profile;Testchart;Converter;
    Hugin.desktop
    Code:
    [Desktop Action Batch-Processor]
    Exec=PTBatcherGUI %F
    Name=Batch-Processor
    
    
    [Desktop Action Lens-Calibrator]
    Exec=calibrate_lens_gui
    Name=Lens-Calibrator
    
    
    [Desktop Entry]
    Actions=Batch-Processor;Lens-Calibrator;


    Notice that the last example has no Icon lines - that's okay, the entries appear as text with no icon.

    There's no theoretical reason why you couldn't lump disparate programs together this way, for instance create a KasualGames.desktop entry just to have an action menu full of KDE games. Let me know if you do anything cool with this technique!

    GEF

  2. #2
    Join Date
    Oct 2008
    Location
    Mojave desert
    Posts
    357

    Default Re: Action Menus

    Here's one more that I think is really useful as a template for apps with documentation that's not accessible from within the program:

    Enigma.desktop
    Code:
    [Desktop Action Doc]
    Exec=call-browser file:/usr/share/doc/packages/enigma/index.html
    Icon=enigma-help
    Name=Instructions
    
    
    [Desktop Entry]
    Actions=Doc;
    This one's for the game Enigma, just because it normally puts its instruction in the games menu as a separate entry, but there are plenty of apps with a separate doc package.

  3. #3
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    23,104
    Blog Entries
    1

    Default Re: Action Menus

    Will shift this from 'General Chit-Chat' to our 'Unreviewed How To and FAQ' as it's a better fit.
    openSUSE Leap 15.2; KDE Plasma 5

  4. #4
    Join Date
    Oct 2008
    Location
    Mojave desert
    Posts
    357

    Default Re: Action Menus

    Thanks, Deano. I only put this in chit-chat because my last attempt to post a tip got moved there! Wherever it's good for you guys is fine with me; this article is all about organizing to taste. -GEF

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •