Simple Menu for applications

Some desktops like Openbox, TWM and Fluxbox may need a proper menu. One simple option is to use a script which needs package yad for working. Menu is scrollable an there items are from /usr/share/applications.

Edit: 14.4.2024: Grid menu is more practical to use.

GRID-MENU.zip

Edit: 1.5.2024: rpm and deb installation packages.

grid-menu-deb-and-rpm-packages.zip

#!/bin/bash
##
## RJP 10.4.2024
## Simple menu2 for desktops like openbox, etc
# Package yad need to be installed
# This menu uses gio launch feature
# This is quote ugly but it works :D
# 14.4.2024 Grid menu is more practical

ls /usr/share/applications > /tmp/appmenu0
sed 's/^/gio launch \/usr\/share\/applications\/ /' /tmp/appmenu0 > /tmp/appmenu1
sed 's/.desktop$//' /tmp/appmenu1 > /tmp/appmenu2
sed -i 's/gio launch \/usr\/share\/applications\///g' /tmp/appmenu2
sed 's/^/--field="/' /tmp/appmenu2 > /tmp/appmenu3
sed -i s/$/\"":fbtn "\"""/ /tmp/appmenu3
paste -d' ' /tmp/appmenu3 /tmp/appmenu1 > /tmp/appmenu4
sed 's/$/ "/' /tmp/appmenu4 > /tmp/appmenu5
sed -i "s|$\\" /tmp/appmenu5
sed -i 's/applications\/ /applications\//g' /tmp/appmenu5
sed -i '1 i\yad --form --columns=5 --rows=5 --scroll --height=600 --width=1400 --text="GRID MENU :" ' /tmp/appmenu5
sed -e 's/$/ \\/' /tmp/appmenu5 > /tmp/appmenu6
sed -i '1 i\#/bin/bash' /tmp/appmenu6
sed -i -e '$a\'$'\n''--button=Exit:1' /tmp/appmenu6
chmod +x /tmp/appmenu6 && cd /tmp && ./appmenu6

#####################################

SIMPLE_MENU2.zip

#!/bin/bash
##
## RJP 10.4.2024
## Simple menu2 for desktops like openbox, etc
# Package yad need to be installed
# This menu uses gio launch feature
# This is quote ugly but it works :D
#

ls /usr/share/applications > /tmp/appmenu0
sed 's/^/gio launch \/usr\/share\/applications\/ /' /tmp/appmenu0 > /tmp/appmenu1
sed 's/.desktop$//' /tmp/appmenu1 > /tmp/appmenu2
sed -i 's/gio launch \/usr\/share\/applications\///g' /tmp/appmenu2
sed 's/^/--field="/' /tmp/appmenu2 > /tmp/appmenu3
sed -i s/$/\"":fbtn "\"""/ /tmp/appmenu3
paste -d' ' /tmp/appmenu3 /tmp/appmenu1 > /tmp/appmenu4
sed 's/$/ "/' /tmp/appmenu4 > /tmp/appmenu5
sed -i "s|$\\" /tmp/appmenu5
sed -i 's/applications\/ /applications\//g' /tmp/appmenu5
sed -i '1 i\yad --form --columns=1 --rows=5 --scroll --height=600 --width=400 --text="SIMPLE MENU 2:" ' /tmp/appmenu5
sed -e 's/$/ \\/' /tmp/appmenu5 > /tmp/appmenu6
sed -i '1 i\#/bin/bash' /tmp/appmenu6
sed -i -e '$a\'$'\n''--button=Exit:1' /tmp/appmenu6
chmod +x /tmp/appmenu6 && cd /tmp && ./appmenu6

########################################

A basic version which does not use gio launch

SIMPLE_MENU.zip

The code:

#!/bin/bash
##
## RJP 6.4.2024
## Simple menu for desktops like openbox, etc
# Package yad need to be installed
#
ls /usr/share/applications > /tmp/appmenu1
sed 's/.desktop$//' /tmp/appmenu1 > /tmp/appmenu2
sed 's/^/--field="/' /tmp/appmenu2 > /tmp/appmenu3
sed -i s/$/\"":fbtn "\"""/ /tmp/appmenu3
paste -d' ' /tmp/appmenu3 /tmp/appmenu2 > /tmp/appmenu4
sed 's/$/ "/' /tmp/appmenu4 > /tmp/appmenu5
sed -i "s|$\\" /tmp/appmenu5
sed -i '1 i\yad --form --columns=1 --rows=5 --scroll --height=600 --width=350 --text="SIMPLE MENU:" ' /tmp/appmenu5
sed -e 's/$/ \\/' /tmp/appmenu5 > /tmp/appmenu6
sed -i '1 i\#/bin/bash' /tmp/appmenu6
sed -i -e '$a\'$'\n''--button=Exit:1' /tmp/appmenu6
sed -e 's/\(.*\)/\L\1/' /tmp/appmenu6 > /tmp/appmenu7
chmod +x /tmp/appmenu7 && cd /tmp && ./appmenu7

Edit: there is some irregular desktop filenames (capital letters and sh:s) so fixed version where capital letters are corrected. Also some lauchers names are different than desktop filenames, so they need to edit by hand.