Displaying items in a submenu of the main menu

Moderators: 666philb, Forum moderators

Post Reply
User avatar
Grey
Posts: 2078
Joined: Wed Jul 22, 2020 12:33 am
Location: Russia
Has thanked: 78 times
Been thanked: 399 times

Displaying items in a submenu of the main menu

Post by Grey »

Hello. Let's say we have a LOT of items in one of the submenus of the main menu. Does anyone know a way to make the items appear not infinitely vertically, but rather horizontally, split into multiple vertical columns?

Different devices. Different approach.

User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 120 times

Re: Displaying items in a submenu of the main menu

Post by taersh »

I don't think this would be possible. At least not in JWM, Openbox, Fluxbox, IceWM.
My OS has hundreds of programs that will usually go to the Multimedia menu.
To have a better overview I created additional Menu categories.

For this reason my OS has the following Menu categories instead of one Multimedia Menu.

- Audio - everything like Audio Editors and Recorders not using JACK
- JACK Suite - everything JACK related like QJackCtl, Cadence, Meterbridge, GuiTarix, Patchage etc.
- JACK Endmix - lots of Standalone FX programs like Equalizers, Compressors, Reverbs etc.
- Multimedia - everything for Audio Utilities like Players, Score Editors, Audio TAG Editors etc.
- Music Production - Sequencers, Samplers and Synthesizers
- Video - Video Editors and Recorders

My monitor has a resolution of 1920x1080.
The JACK Suite Menu has one entry more than it would fit to the screen height.
The JACK Endmix Menu only left space for three entries more.
The Multimedia Menu only left space for five entries more.
The Music Production Menu has twelve entries more than it would fit to the screen height.
The Video and Audio Menus fit well to the screen height.

To have additional Menu categories seems to be the only way to solve this.

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
Grey
Posts: 2078
Joined: Wed Jul 22, 2020 12:33 am
Location: Russia
Has thanked: 78 times
Been thanked: 399 times

Re: Displaying items in a submenu of the main menu

Post by Grey »

taersh wrote: Wed Oct 28, 2020 5:02 pm To have additional Menu categories seems to be the only way to solve this.
Yes, I have the same screen resolution. And the catch is also mainly with Multimedia, well, and also emulators. I was just hoping someone had figured out a neat trick to display the submenus and not have to clutter up the main menu.

Different devices. Different approach.

User avatar
foxpup
Posts: 186
Joined: Fri Jul 24, 2020 1:23 pm
Location: Europe near the Northsea
Has thanked: 75 times
Been thanked: 32 times

Re: Displaying items in a submenu of the main menu

Post by foxpup »

taersh wrote: Wed Oct 28, 2020 5:02 pm I don't think this would be possible. At least not in JWM, Openbox, Fluxbox, IceWM.
Yes it is possible!
musher0 on the old forum was the ace for these kind of things. I have not seen him here yet.
This is an example from him for icewm: http://oldforum.puppylinux.com/puppy/vi ... ?p=1062884

For jwm:
Look in /root/.jwmrc
A Menu has Programs.
You have to nest Menus to have submenus. Replace

Code: Select all

<Menu label="Document" icon="word48.png" height="24">
<Program label="Get LibreOffice download and install LibreOffice" icon="/usr/share/pixmaps/libreoffice-pup.svg">get_libreoffice</Program>
<Program label="NoteCase notes manager" icon="/usr/share/pixmaps/puppy/notes.svg">notecase</Program>
<Program label="QtNote Tray App" icon="/usr/share/icons/hicolor/scalable/apps/qtnote.svg">qtnote</Program>
<Program label="Trans_tray (translation program)" icon="/usr/share/pixmaps/trans_tray.png">trans_tray</Program>
<Program label="AbiWord" icon="abiword">abiword</Program>
<Separator/>
<Program label="Geany" icon="geany">geany</Program>
<Program label="Leafpad Simple text editor" icon="leafpad.png">leafpad</Program>
<Program label="MP console editor" icon="/usr/share/icons/mp.png">mp-5</Program>
<Separator/>
<Program label="Pdict online dictionary" icon="/usr/share/pixmaps/puppy/book_dictionary.svg">pdict</Program>
<Program label="puppyPDF convert file to PDF" icon="/usr/share/pixmaps/puppy/pdf.svg">puppypdf</Program>
<Program label="qpdfview" icon="qpdfview.svg">qpdfview --unique</Program>
</Menu>
with

Code: Select all

<Menu label="Document" icon="word48.png" height="24">
<Menu label="varia" icon="word48.png" height="24">[
   <Program label="Get LibreOffice download and install LibreOffice" icon="/usr/share/pixmaps/libreoffice-pup.svg">get_libreoffice</Program>
   <Program label="NoteCase notes manager" icon="/usr/share/pixmaps/puppy/notes.svg">notecase</Program>
   <Program label="QtNote Tray App" icon="/usr/share/icons/hicolor/scalable/apps/qtnote.svg">qtnote</Program>
   <Program label="Trans_tray (translation program)" icon="/usr/share/pixmaps/trans_tray.png">trans_tray</Program>
   <Program label="AbiWord" icon="abiword">abiword</Program>
</Menu>
<Menu label="write" icon="word48.png" height="24">
   <Program label="Geany" icon="geany">geany</Program>
   <Program label="Leafpad Simple text editor" icon="leafpad.png">leafpad</Program>
   <Program label="MP console editor" icon="/usr/share/icons/mp.png">mp-5</Program>
</Menu>
<Menu label="view" icon="word48.png" height="24">
   <Program label="Pdict online dictionary" icon="/usr/share/pixmaps/puppy/book_dictionary.svg">pdict</Program>
   <Program label="puppyPDF convert file to PDF" icon="/usr/share/pixmaps/puppy/pdf.svg">puppypdf</Program>
   <Program label="qpdfview" icon="qpdfview.svg">qpdfview --unique</Program>
</Menu>
</Menu>
Restart the windowmanager.

That's all.
But there is more. :-)

You can try this in /root/.jwmrc, but when you reboot, the old menu will be restored.
It's the script fixmenus. That runs at every startup or when you have installed new programs.
fixmenus uses the template _root_.jwmrc from /etc/xdg/templates/ to rebuild the menu in /root/.jwmrc
So you better make the changes you want in /etc/xdg/templates/_root_.jwmrc

In this template the lines with PUPPYMENU get executed, other lines are just copied over to /root/.jwmrc.
So it is easy to add fixed menu items.
The program that is executed from the template is the C program jwm-xdgmenu.
jwm-xdgmenu uses the .menu files in /etc/xdg/menus/ to build a Menu.
So it is more work for the parts of the menu you want to be rebuilt each time.
You have to work with the .menu files then.

You can make entire new .menu files, or
you can split an existing menu (for the example), or
you can add/remove Categories etc.
Happy puzzling.

There are other possibilities as well.
musher0 would make the script fixmenus unclear
and write his own script to make the .jwmrc from the content of the .desktop files in /usr/share/applications.
Puppy has findnrun or you can compile/install dmenu or rofi. These are with a search box.
User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 120 times

Re: Displaying items in a submenu of the main menu

Post by taersh »

@foxpup
The Main Menus already do have sub-menus. And there's an option to have the sub-menus closed.
Perhaps I did understand @Grey's purpose the wrong way.

Go to /etc/xdg/menus. There's some files like e.g. puppy-business.menu. These files contains lines like this.

Code: Select all

<Menuname inline="true" inline_limit="99">Business-Sub</Menuname>
By inline="true" or inline="false" one can choose to open or close a sub-menu in general.
By inline_limit="99" one can set a number and the sub-menu closes when entries expanding greater than that number.

I understood @Grey's purpose that way.

Instead of having Menu entries in vertical order e.g.
Program 1
Program 2
Program 3


to have them in horizontal order e.g.
Program 1 | Program 2 | Program 3

etc.

Sorry for misunderstanding...

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
foxpup
Posts: 186
Joined: Fri Jul 24, 2020 1:23 pm
Location: Europe near the Northsea
Has thanked: 75 times
Been thanked: 32 times

Re: Displaying items in a submenu of the main menu

Post by foxpup »

@taersh
Thanks for explaining about inline and the submenus. I did not know that.
Makes it a lot easier to do what I was doing.
No need to rip menu's into pieces :-)

Reading @Grey's question again, I think you are right.
He may even want something like this:

Program 1 | Program 4 | Program 7
Program 2 | Program 5 | Program 8
Program 3 | Program 6

I cannot make something like that.
williams2
Posts: 1071
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 306 times

Re: Displaying items in a submenu of the main menu

Post by williams2 »

Puppy has findnrun or you can compile/install dmenu or rofi. These are with a search box
This is my dmenu_run script using /usr/share/applications

Code: Select all

#!/bin/ash
a="$(ls /usr/share/applications|sed 's/[.]desktop$//'|dmenu -i)"
b="/usr/share/applications/${a}.desktop"
test -f "$b" || exit
rox "$b" &>/dev/null
musher0 would make the script fixmenus unclear
and write his own script ...
This seems to be musher0's last post:
viewtopic.php?p=1236#p1236
User avatar
Grey
Posts: 2078
Joined: Wed Jul 22, 2020 12:33 am
Location: Russia
Has thanked: 78 times
Been thanked: 399 times

Re: Displaying items in a submenu of the main menu

Post by Grey »

taersh is right. He understood me correctly. And without third-party soft, just about the native menu.

Different devices. Different approach.

User avatar
Flash
Moderator
Posts: 1037
Joined: Tue Dec 03, 2019 3:13 pm
Location: Arizona, U.S.
Has thanked: 60 times
Been thanked: 140 times

Re: Displaying items in a submenu of the main menu

Post by Flash »

Grey: so taersh answered your question? Your problem is solved?
Chaos coordinator :?
User avatar
Grey
Posts: 2078
Joined: Wed Jul 22, 2020 12:33 am
Location: Russia
Has thanked: 78 times
Been thanked: 399 times

Re: Displaying items in a submenu of the main menu

Post by Grey »

Flash wrote: Wed Oct 28, 2020 10:31 pm Grey: so taersh answered your question? Your problem is solved?
Yes and no. The problem is not solved. But the answer to the question has been received.

Different devices. Different approach.

User avatar
Flash
Moderator
Posts: 1037
Joined: Tue Dec 03, 2019 3:13 pm
Location: Arizona, U.S.
Has thanked: 60 times
Been thanked: 140 times

Re: Displaying items in a submenu of the main menu

Post by Flash »

Keep us posted. :thumbup2:
Chaos coordinator :?
User avatar
foxpup
Posts: 186
Joined: Fri Jul 24, 2020 1:23 pm
Location: Europe near the Northsea
Has thanked: 75 times
Been thanked: 32 times

Re: Displaying items in a submenu of the main menu

Post by foxpup »

williams2 wrote: Wed Oct 28, 2020 9:48 pm

Puppy has findnrun or you can compile/install dmenu or rofi. These are with a search box

This is my dmenu_run script using /usr/share/applications

Code: Select all

#!/bin/ash
a="$(ls /usr/share/applications|sed 's/[.]desktop$//'|dmenu -i)"
b="/usr/share/applications/${a}.desktop"
test -f "$b" || exit
rox "$b" &>/dev/null

@williams2 Thank you for your script for dmenu.
Nice!
Works good!

This seems to be musher0's last post:
viewtopic.php?p=1236#p1236

About musher0, :(
A bit of a temper(ament). Too bad.

Post Reply

Return to “Fossapup64”