You are not logged in.

#1 2020-03-01 23:56:41

damo
....moderator....
Registered: 2015-08-20
Posts: 6,405

jgmenu - Creating an Applications Menu

Creating an Applications Menu

For those odd occasions I want to use the Applications submenu (ie when I have forgotten what I have installed, or what the name of an app is!), I adapted a built-in template for this fancy one for applications-only.

                            eESWdtcm.jpg
                           


1:  Set up the menu layout

jgmenu ships with some menu/layout templates: the possible options can be seen by running

jgmenu_run init -i
.
Choose 't, theme'

The one we will use is greeneye, which you can also get with a direct command.

$ jgmenu_run greeneye --help
Usage: jgmenu_run greeneye [options]
Output config file and widget lines for a menu with the following layout:

 +----------------+-----------------------+
 |                |  a - search box       |
 |                |-----------------------|
 |                |                       |
 | b - categories |                       |
 |                |  c - applications     |
 |                |                       |
 |                |                       |
 +----------------+-----------------------+

Options:
    --widgets     print widget lines
    --config      print config lines

Example:
    jgmenu_run greeneye --config  >$HOME/.config/jgmenu/jgmenurc
    jgmenu_run greeneye --widgets >$HOME/.config/jgmenu/prepend.csv

So, to generate a new menu that you can run with jgmenu_run, make new greeneye-flavoured jgmenurc and prepend.csv. This looks like:

                            DSowVZfm.jpg
                           
However, I want to preserve my main menu, so instead let's save to different bespoke files:

jgmenu_run greeneye --config  >$HOME/.config/jgmenu/appsrc
jgmenu_run greeneye --widgets >$HOME/.config/jgmenu/apps.csv
2:  Get the system-applications csv menu data

It is possible to create a menu displaying only the Applications data, by the use of an environment variable to disregard prepend.csv and append.csv. Either show an apps-only menu directly, or save the csv to a file which could then be sourced by jgmenu --simple.

JGMENU_NO_PEND can be set for the apps or lx modules, although I am just using apps for this. There are now script parameters that do the job: --no-prepend and --no-append

jgmenu_run apps --no-prepend >mymenu.csv
.
or
.
JGMENU_NO_PEND=1 jgmenu_run apps | jgmenu --simple
.
or
.
JGMENU_NO_PEND=1 jgmenu_run apps >mymenu.csv

We are going to save the csv to a file, to be sourced by our apps.csv later.

jgmenu_run apps --no-prepend >"${HOME}/.config/jgmenu/apps-menu.csv"
3:  Enable jgmenu --simple to display the menu

If you try to run the command now, you get:

$ jgmenu --simple --csv-file='.config/jgmenu/apps.csv'
fatal: file did not contain any menu items

So source apps-menu.csv by adding this line to the end of apps.csv:

. ~/.config/jgmenu/apps-menu.csv

The "greeneye" apps menu we saw earlier can now be run with:

jgmenu --simple --config-file='.config/jgmenu/appsrc --csv-file='.config/jgmenu/apps.csv'
4:  Modify the menu layout

You can have great fun tweaking apps.csv, and this is one example of what I came up with:

~/.config/jgmenu/apps.csv

### Applications-only menu  "apps.csv"
### by @damo

# Top text
@text,,10,4,142,35,2,left,top,#e6e6e6 100,#000000 0,<span color="grey">Filters</span>
@text,,154,4,120,35,2,left,top,#e6e6e6 100,#000000 0,<span color="grey">Applications</span>

# Search box
@rect,,162,46,276,30,2,left,top,#000000 0,#656565 50,
@search,,164,44,244,30,2,left,top,#eeeeee 80,#000000 0,
@icon,,410,50,22,22,2,left,top,#000000 50,#000000 50,/home/damo/.config/jgmenu/greeneye-search.svg

# Applications box
@rect,,154,40,290,434,2,left,top,#e6e6e6 20,#282828 0,

# Categories box
@rect,^filter(*),4,40,142,35,2,left,top,#e6e6e6 20,#000000 0,
@icon,,10,40,32,32,2,left,top,#000000 50,#000000 50,/usr/share/icons/Paper/512x512/places/folder_home.png
@text,,50,40,142,35,2,left,top,#e6e6e6 100,#000000 0,All

@rect,^filter(#Accessories #Util #Archiving #Compression #TextEditor ),4,90,142,35,2,left,top,#000000 0,#000000 0,
@icon,,10,90,32,32,2,left,top,#000000 50,#000000 50,/usr/share/icons/Paper/512x512/categories/applications-accessories.png
@text,,50,90,142,35,2,left,top,#e6e6e6 100,#000000 0,Accessories

@rect,^filter(#Development #Build #Debug #IDE #Profiling #RevisionControl ),4,140,142,35,2,left,top,#000000 0,#000000 0,
@icon,,10,140,32,32,2,left,top,#000000 50,#000000 50,/usr/share/icons/Paper/512x512/categories/applications-development.png
@text,,50,140,142,35,2,left,top,#e6e6e6 100,#000000 0,Development

@rect,^filter(#Graphics #Scanning #Photography ),4,190,142,35,2,left,top,#000000 0,#000000 0,
@icon,,10,190,32,32,2,left,top,#000000 50,#000000 50,/usr/share/icons/Paper/512x512/categories/applications-graphics.png
@text,,50,190,142,35,2,left,top,#e6e6e6 100,#000000 0,Graphics

@rect,^filter(#Internet #Network #Email #FileTransfer #WebBrowser ),4,240,142,35,2,left,top,#000000 0,#000000 0,
@icon,,10,240,32,32,2,left,top,#000000 50,#000000 50,/usr/share/icons/Paper/512x512/categories/applications-internet.png
@text,,50,240,142,35,2,left,top,#e6e6e6 100,#000000 0,Internet

@rect,^filter(#Multimedia #Player #Audio #Video #Recorder ),4,290,142,35,2,left,top,#000000 0,#000000 0,
@icon,,10,290,32,32,2,left,top,#000000 50,#000000 50,/usr/share/icons/Paper/512x512/categories/applications-multimedia.png
@text,,50,290,142,35,2,left,top,#e6e6e6 100,#000000 0,Multimedia

@rect,^filter(#Office #Calendar #Contact #Dictionary #Chart #Finance #Presentation #Spreadsheet #WordProcessor #Publishing #Viewer ),4,340,142,35,2,left,top,#000000 0,#000000 0,
@icon,,10,340,32,32,2,left,top,#000000 50,#000000 50,/usr/share/icons/Paper/512x512/categories/applications-office.png
@text,,50,340,142,35,2,left,top,#e6e6e6 100,#000000 0,Office

@rect,^filter(#Settings #Security #Preferences ),4,390,142,35,2,left,top,#000000 0,#000000 0,
@icon,,10,390,32,32,2,left,top,#000000 50,#000000 50,/usr/share/icons/Paper/512x512/categories/applications-utilities.png
@text,,50,390,142,35,2,left,top,#e6e6e6 100,#000000 0,Settings

@rect,^filter(#System #Emulator #FileManager #TerminalEmulator #Filesystem #Monitor ),4,440,142,35,2,left,top,#000000 0,#000000 0,
@icon,,10,440,32,32,2,left,top,#000000 50,#000000 50,/usr/share/icons/Paper/512x512/categories/applications-system.png
@text,,50,440,142,35,2,left,top,#e6e6e6 100,#000000 0,System

. ~/.config/jgmenu/apps-menu.csv

~/.config/jgmenu/appsrc

### Applications-only menu  "appsrc"
### by @damo
csv_cmd             = apps
tint2_look          = 0
position_mode       = fixed
menu_width          = 450
menu_height_min     = 480
menu_height_max     = 510
menu_margin_x       = 10
menu_margin_y       = 40
menu_padding_top    = 90
menu_padding_right  = 10
menu_padding_bottom = 16
menu_padding_left   = 158
menu_border         = 1
item_height         = 30
item_radius         = 2
item_border         = 1
item_margin_x       = 10
item_margin_y       = 4
color_menu_bg       = #212121 80
color_menu_border   = #eeeeee 10
#color_norm_fg       = #eeeeee 100
color_sel_bg        = #ffffff 10
#color_sel_fg        = #eeeeee 100
color_sel_border    = #eeeeee 8
color_scroll_ind    = #eeeeee 50
csv_name_format     = %n\n<span size="x-small">%g</span>
csv_no_dirs         = 1

icon_size           = 22
arrow_string        = ››
arrow_width         = 16
sep_halign          = left
sub_padding_left    = 10
item_halign         = left

                            veAofOBm.jpg
                           
                            rWTm9eSm.jpg

                       

5:  Making the menu dynamic

To ensure that the applications displayed reflect what you currently have installed, then apps-menu.csv must be generated at menu runtime. This wrapper script can do that:

.config/jgmenu/scripts/apps-menu.sh

#!/bin/sh
##  save jgmenu apps module output, and run with jgmenu
## by @damo March 2020

# apps-menu.csv is sourced by apps.csv
MENU_FILE="${HOME}/.config/jgmenu/apps-menu.csv"

# use env var to only output applications module
jgmenu_run apps --no-prepend >"${MENU_FILE}"

# display menu
jgmenu --simple --config-file=.config/jgmenu/appsrc --csv-file=.config/jgmenu/apps.csv

exit

[NB: there is another way using csv-cmd, but I found a script to be simpler hmm ]

I run it from a Tint2 panel button:

                            mGGl2R8m.jpg

Notice I have removed the "Games" category. I haven't got any, and anyway it is a frivolous time-wasting pursuit, compared with frivolous tweaking of configs tongue

Bonus Tip   Don't forget some handy utilities that are included with BL - these can be useful for themeing:

  • yad-icon-browser

  • yad --color

  • geany Colour Chooser

Last edited by damo (2020-03-03 03:21:57)


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

Board footer

Powered by FluxBB